From e09c4caad4b2c0d362081ca971d895ef1196709e Mon Sep 17 00:00:00 2001 From: James Rose Date: Fri, 31 Mar 2023 10:25:30 +0100 Subject: [PATCH] Make the collection period end at the end of the day (#1499) --- app/helpers/collection_time_helper.rb | 4 ++-- spec/helpers/collection_time_helper_spec.rb | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/app/helpers/collection_time_helper.rb b/app/helpers/collection_time_helper.rb index b9dee7dcc..ed0fdf839 100644 --- a/app/helpers/collection_time_helper.rb +++ b/app/helpers/collection_time_helper.rb @@ -22,11 +22,11 @@ module CollectionTimeHelper end def collection_end_date(date) - Time.zone.local(collection_start_year(date) + 1, 3, 31) + Time.zone.local(collection_start_year(date) + 1, 3, 31).end_of_day end def current_collection_end_date - Time.zone.local(current_collection_start_year + 1, 3, 31) + Time.zone.local(current_collection_start_year + 1, 3, 31).end_of_day end def previous_collection_end_date diff --git a/spec/helpers/collection_time_helper_spec.rb b/spec/helpers/collection_time_helper_spec.rb index 43a14025e..1537926ab 100644 --- a/spec/helpers/collection_time_helper_spec.rb +++ b/spec/helpers/collection_time_helper_spec.rb @@ -24,7 +24,7 @@ RSpec.describe CollectionTimeHelper do end it "returns the correct current end date" do - expect(current_collection_end_date).to eq(Time.zone.local(2023, 3, 31)) + expect(current_collection_end_date).to eq(Time.zone.local(2023, 3, 31).end_of_day) end end @@ -40,7 +40,7 @@ RSpec.describe CollectionTimeHelper do end it "returns the correct current end date" do - expect(current_collection_end_date).to eq(Time.zone.local(2022, 3, 31)) + expect(current_collection_end_date).to eq(Time.zone.local(2022, 3, 31).end_of_day) end end end @@ -58,7 +58,7 @@ RSpec.describe CollectionTimeHelper do end it "returns the correct current end date" do - expect(collection_end_date(now)).to eq(Time.zone.local(2023, 3, 31)) + expect(collection_end_date(now)).to eq(Time.zone.local(2023, 3, 31).end_of_day) end end @@ -74,7 +74,7 @@ RSpec.describe CollectionTimeHelper do end it "returns the correct current end date" do - expect(collection_end_date(now)).to eq(Time.zone.local(2022, 3, 31)) + expect(collection_end_date(now)).to eq(Time.zone.local(2022, 3, 31).end_of_day) end end end