Browse Source

Make the collection period end at the end of the day (#1499)

pull/1500/head
James Rose 2 years ago committed by GitHub
parent
commit
e09c4caad4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      app/helpers/collection_time_helper.rb
  2. 8
      spec/helpers/collection_time_helper_spec.rb

4
app/helpers/collection_time_helper.rb

@ -22,11 +22,11 @@ module CollectionTimeHelper
end end
def collection_end_date(date) 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 end
def current_collection_end_date 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 end
def previous_collection_end_date def previous_collection_end_date

8
spec/helpers/collection_time_helper_spec.rb

@ -24,7 +24,7 @@ RSpec.describe CollectionTimeHelper do
end end
it "returns the correct current end date" do 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
end end
@ -40,7 +40,7 @@ RSpec.describe CollectionTimeHelper do
end end
it "returns the correct current end date" do 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 end
end end
@ -58,7 +58,7 @@ RSpec.describe CollectionTimeHelper do
end end
it "returns the correct current end date" do 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
end end
@ -74,7 +74,7 @@ RSpec.describe CollectionTimeHelper do
end end
it "returns the correct current end date" do 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 end
end end

Loading…
Cancel
Save