Skip to content

CMS-1933: Add DateType display name transform function - #697

Merged
duncan-oxd merged 2 commits into
mainfrom
CMS-1933-only-frontend
Aug 6, 2026
Merged

CMS-1933: Add DateType display name transform function#697
duncan-oxd merged 2 commits into
mainfrom
CMS-1933-only-frontend

Conversation

@duncan-oxd

@duncan-oxd duncan-oxd commented Aug 5, 2026

Copy link
Copy Markdown
Collaborator

Jira Ticket

CMS-1933

Description

We need to change the label for the "Operation" date type to say "Facility available" - only on the frontend, without changing the database. This branch adds a getDateTypeDisplayName function on the frontend and backend that simply takes the name as input and returns the changed string as output (or the unchanged string, in most cases).

Requirements from the ticket:

Update the ‘Operation’ label where it appears:

  • All season forms
  • On the submit table
  • In the exported (CSV) file

Acceptance criteria

  • Updates are only done on the front-end
  • On the back end and strapi, labels remain ‘Operation’

There's a more comprehensive branch in #696 that would be good to merge some time, but it doesn't need to happen for this release so I've marked it "DO NOT MERGE". It would prevent the app from breaking if we ever changed the DateType names in the CMS.

@duncan-oxd duncan-oxd self-assigned this Aug 5, 2026
@duncan-oxd duncan-oxd added the v2.5.0 DOOT validation changes before the ACT release label Aug 5, 2026
@duncan-oxd
duncan-oxd marked this pull request as ready for review August 5, 2026 21:21

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a centralized “display name” transformation for DateType names so the UI can show “Facility available” wherever the API/CMS still uses “Operation”, without changing the underlying DateType record in Strapi/DB.

Changes:

  • Added getDateTypeDisplayName() helper(s) and applied them across season forms, submit table UI, filters, and validation labels.
  • Updated the CSV export generation to output the transformed DateType label in the exported file.
  • Adjusted Strapi feature import to default datesCanSpan2Years to false when the source value is null/undefined.

Reviewed changes

Copilot reviewed 16 out of 16 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
frontend/src/lib/getDateTypeDisplayName.js New frontend helper to map API DateType names to display labels (Operation → Facility available).
frontend/src/hooks/useValidation/rules/winterDateYears.js Uses display-name transform in winter date field labels.
frontend/src/hooks/useValidation/rules/startDateBeforeEndDate.js Uses display-name transform for date range validation label.
frontend/src/hooks/useValidation/rules/requiredDateRanges.js Uses display-name transform in required-field labels.
frontend/src/hooks/useValidation/rules/noOverlapPrevious.js Uses display-name transform in overlap validation label.
frontend/src/hooks/useValidation/rules/dateInOperatingYear.js Uses display-name transform in operating-year validation labels.
frontend/src/hooks/useValidation/rules/completeDateRanges.js Uses display-name transform in completeness validation labels.
frontend/src/components/SubmitPageTable.jsx Displays transformed DateType name in submit table row header.
frontend/src/components/SeasonForms/ParkSeasonForm.jsx Displays transformed DateType name in park season form headings.
frontend/src/components/SeasonForms/FeatureSeasonForm.jsx Displays transformed DateType name in feature season form headings.
frontend/src/components/SeasonForms/AreaSeasonForm.jsx Displays transformed DateType name in area season form headings (two sections).
frontend/src/components/FilterStatus.jsx Displays transformed DateType name in active filter tags.
frontend/src/components/DateRangeFields.jsx Uses transformed DateType name in “Add more … dates” UI copy.
backend/utils/getDateTypeDisplayName.js New backend helper mirroring the frontend mapping (Operation → Facility available).
backend/strapi-sync/import-features/import-features.js Defaults datesCanSpan2Years to false when missing from Strapi payload.
backend/routes/api/export.js Uses backend display-name transform for the CSV export Date type column.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread backend/routes/api/export.js Outdated
Comment thread backend/utils/getDateTypeDisplayName.js

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 22 out of 22 changed files in this pull request and generated no new comments.

Comment thread frontend/src/components/DateRangeFields.jsx

@molund molund left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added one comment about a line I didn't understand

@duncan-oxd

Copy link
Copy Markdown
Collaborator Author

I added one comment about a line I didn't understand

I posted a knowledge dump 🎓 🎓 , let me know if you have any questions! I'll send it over to QA and see what they think of it 👍

@duncan-oxd
duncan-oxd merged commit 37ff934 into main Aug 6, 2026
4 checks passed
@duncan-oxd
duncan-oxd deleted the CMS-1933-only-frontend branch August 6, 2026 03:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

v2.5.0 DOOT validation changes before the ACT release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants