Skip to content

Commit 664e61c

Browse files
authored
Merge pull request #6631 from NHSDigital/show-consent-closes-today
Fix consent period copy on the day consent closes
2 parents 51cfda7 + aa5ca2f commit 664e61c

2 files changed

Lines changed: 8 additions & 0 deletions

File tree

app/helpers/sessions_helper.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ def session_consent_period(session)
99
"Not provided"
1010
elsif open_at.future?
1111
"Opens #{open_at.to_fs(:short)}"
12+
elsif close_at.today?
13+
"Closes today at midnight"
1214
elsif close_at.future?
1315
"Open from #{open_at.to_fs(:short)} until #{close_at.to_fs(:short)}"
1416
else

spec/helpers/sessions_helper_spec.rb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,12 @@
2323
it { should eq("Open from 23 September until 13 October") }
2424
end
2525

26+
context "when the consent period closes today" do
27+
let(:date) { Date.new(2024, 10, 2) }
28+
29+
it { should eq("Closes today at midnight") }
30+
end
31+
2632
context "when in the far future" do
2733
let(:date) { Date.new(2025, 1, 1) }
2834

0 commit comments

Comments
 (0)