diff --git a/app/helpers/locations_helper.rb b/app/helpers/locations_helper.rb index 128d9fc36..5c51fc88c 100644 --- a/app/helpers/locations_helper.rb +++ b/app/helpers/locations_helper.rb @@ -113,9 +113,9 @@ private return sorted_linked_authorities.first[field] if sorted_linked_authorities.count == 1 sorted_linked_authorities.map { |linked_local_authority| - formatted_start_date = linked_local_authority.start_date&.to_formatted_s(:govuk_date) + formatted_start_date = linked_local_authority.start_date.year == 2021 ? "until" : "#{linked_local_authority.start_date&.to_formatted_s(:govuk_date)} -" formatted_end_date = linked_local_authority.end_date&.to_formatted_s(:govuk_date) || "present" - "#{linked_local_authority[field]} (#{formatted_start_date} - #{formatted_end_date})" + "#{linked_local_authority[field]} (#{formatted_start_date} #{formatted_end_date})" }.join("\n") end end diff --git a/spec/helpers/locations_helper_spec.rb b/spec/helpers/locations_helper_spec.rb index 7c65cb536..ae63c2e84 100644 --- a/spec/helpers/locations_helper_spec.rb +++ b/spec/helpers/locations_helper_spec.rb @@ -162,11 +162,11 @@ RSpec.describe LocationsHelper do attributes = [ { attribute: "postcode", name: "Postcode", value: location.postcode }, { attribute: "name", name: "Location name", value: location.name }, - { attribute: "local_authority", name: "Local authority", value: "Eden (1 April 2021 - 31 March 2023)\nCumberland (1 April 2023 - present)" }, + { attribute: "local_authority", name: "Local authority", value: "Eden (until 31 March 2023)\nCumberland (1 April 2023 - present)" }, { attribute: "units", name: "Number of units", value: location.units }, { attribute: "type_of_unit", name: "Most common unit", value: location.type_of_unit }, { attribute: "mobility_standards", name: "Mobility standards", value: location.mobility_type }, - { attribute: "location_code", name: "Location code", value: "E07000030 (1 April 2021 - 31 March 2023)\nE06000063 (1 April 2023 - present)" }, + { attribute: "location_code", name: "Location code", value: "E07000030 (until 31 March 2023)\nE06000063 (1 April 2023 - present)" }, { attribute: "availability", name: "Availability", value: "Active from 1 April 2022" }, { attribute: "status", name: "Status", value: :active }, ]