Skip to content

Commit

Permalink
Merge pull request #2959 from alphagov/use-time-zone-parse-for-parsin…
Browse files Browse the repository at this point in the history
…g-updated-at-time-for-manuals

Use Time.zone.parse instead of Date.parse in ManualUpdatesPresenter
  • Loading branch information
davidgisbey authored Oct 18, 2023
2 parents 9c30d45 + ca02d69 commit 6aed5b5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion app/presenters/content_item/manual_updates.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def change_notes
end

def updated_at(published_at)
Date.parse(published_at)
Time.zone.parse(published_at).to_date
end

def group_updates_by_year(updates)
Expand Down
6 changes: 3 additions & 3 deletions test/presenters/content_item/manual_updates_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def initialize
"base_path" => "/guidance/content-design/content-policy",
"title" => "Content policy",
"change_note" => "New section added.",
"published_at" => "2014-10-06T23:49:25Z",
"published_at" => "2014-10-06T22:49:25Z",
},
{
"base_path" => "/guidance/content-design/user-needs",
Expand All @@ -34,7 +34,7 @@ def initialize
"base_path" => "/guidance/content-design/random-section",
"title" => "Random section",
"change_note" => "New section added.",
"published_at" => "2013-11-06T10:49:25Z",
"published_at" => "2013-09-06T23:49:25Z",
},
],
},
Expand Down Expand Up @@ -88,7 +88,7 @@ def initialize
2013,
[
[
"6 November 2013 <span class=\"govuk-visually-hidden\">#{I18n.t('manuals.updates_amendments')}</span>",
"7 September 2013 <span class=\"govuk-visually-hidden\">#{I18n.t('manuals.updates_amendments')}</span>",
{
(fourth_note["base_path"]).to_s => [fourth_note],
},
Expand Down

0 comments on commit 6aed5b5

Please sign in to comment.