diff --git a/app/helpers/collection_time_helper.rb b/app/helpers/collection_time_helper.rb
index 4df769fc0..ed0fdf839 100644
--- a/app/helpers/collection_time_helper.rb
+++ b/app/helpers/collection_time_helper.rb
@@ -44,16 +44,4 @@ module CollectionTimeHelper
def previous_collection_start_date
current_collection_start_date - 1.year
end
-
- def currently_crossover_period?
- # generally the crossover period ends on the first Friday in June, but there may be arbitrary exceptions such as in 2023
- today = Time.zone.today
- if today.year == 2023
- today.between?(Time.zone.local(2023, 4, 1).to_date, Time.zone.local(2023, 6, 9).to_date)
- else
- crossover_end_date = Time.zone.local(today.year, 6, 1).to_date
- crossover_end_date += 1 until crossover_end_date.friday?
- today.between?(Time.zone.local(today.year, 4, 1).to_date, crossover_end_date)
- end
- end
end
diff --git a/app/views/schemes/toggle_active.html.erb b/app/views/schemes/toggle_active.html.erb
index 2fae18368..8ce3df8ae 100644
--- a/app/views/schemes/toggle_active.html.erb
+++ b/app/views/schemes/toggle_active.html.erb
@@ -11,7 +11,7 @@
<%= form_with model: @scheme_deactivation_period, url: toggle_scheme_form_path(action, @scheme), method: "patch", local: true do |f| %>
- <% collection_start_date = currently_crossover_period? ? previous_collection_start_date : current_collection_start_date %>
+ <% collection_start_date = FormHandler.instance.in_crossover_period? ? previous_collection_start_date : current_collection_start_date %>
<%= f.govuk_error_summary %>
<%= f.govuk_radio_buttons_fieldset date_type_question(action),
legend: { text: I18n.t("questions.scheme.toggle_active.apply_from") },
diff --git a/spec/helpers/collection_time_helper_spec.rb b/spec/helpers/collection_time_helper_spec.rb
index 017d68551..1537926ab 100644
--- a/spec/helpers/collection_time_helper_spec.rb
+++ b/spec/helpers/collection_time_helper_spec.rb
@@ -109,64 +109,4 @@ RSpec.describe CollectionTimeHelper do
end
end
end
-
- describe "#currently_crossover_period?" do
- subject(:result) { currently_crossover_period? }
-
- around do |example|
- Timecop.freeze(now) do
- example.run
- end
- end
-
- context "when it is January" do
- let(:now) { Time.utc(2022, 1, 3) }
-
- it "returns false" do
- expect(result).to be false
- end
- end
-
- context "when it is December" do
- let(:now) { Time.utc(2020, 12, 3) }
-
- it "returns false" do
- expect(result).to be false
- end
- end
-
- context "when it is April" do
- let(:now) { Time.utc(2023, 4, 3) }
-
- it "returns true" do
- expect(result).to be true
- end
- end
-
- context "when it is June" do
- context "and it is the first Friday" do
- let(:now) { Time.utc(2024, 6, 7) }
-
- it "returns true" do
- expect(result).to be true
- end
- end
-
- context "and it is after the first Friday" do
- let(:now) { Time.utc(2024, 6, 8) }
-
- it "returns false" do
- expect(result).to be false
- end
- end
-
- context "and it is 2023, after the first Friday, but before the arbitrary crossover period end" do
- let(:now) { Time.utc(2023, 6, 7) }
-
- it "returns true" do
- expect(result).to be true
- end
- end
- end
- end
end