cds-snc / platform-forms-client

NextJS application that serves the public-facing website for Forms
https://forms-staging.cdssandbox.xyz/
MIT License
35 stars 13 forks source link

Canadian notation for "Date" field: YYYY-MM-DD #1644

Open anikbrazeau opened 1 year ago

anikbrazeau commented 1 year ago

Issue/opportunity

The current date field format suggests mm/dd/yyyy, which is typically an American notation?

Perhaps we might consider changing it to YYYY-MM-DD to align with the more expected Canadian format that works in French as well?

Screenshots

Screenshot 2023-02-21 at 3 12 46 PM

Screenshot 2023-02-21 at 8 39 39 AM Screenshot 2023-02-21 at 8 40 37 AM Screenshot 2023-02-21 at 8 40 49 AM

Related card: https://app.zenhub.com/workspaces/gcforms-60cb8929764d71000e481cab/issues/gh/cds-snc/platform-forms-client/1666

Acceptance Criteria:

anikbrazeau commented 1 year ago

potentially somewhat related to #1712

srtalbot commented 1 year ago

Confirmed that the standard for the GC is YYYY-MM-DD

This also affect our error validation.

timarney commented 1 year ago

@srtalbot can you point me to an existing "live" form / json with a date field --- I'm looking to confirm confirm current production (ideally pre form builder) vs staging.

srtalbot commented 1 year ago

@timarney here's an example with the date validation: https://forms-formulaires.alpha.canada.ca/en/id/167

One thing to consider is how we update the content for live forms (there's often a description with the format that is manually input.)

I thiiink (but would have to check) that all of our forms use the date validation string, so we could make sure they all update.

Would probably also want to reach out to clients that have it because they'd be getting it in a different format.

Seeming like a bigger lift than iniitally thought.

timarney commented 1 year ago

Okay yes --- any existing forms with a date field could have the wrong description if we update our description + field validation. ⚠️ Which would break existing forms ⚠️ .

For reference we're not using a "date" input but in the schema we define date as the validation type

 {
      "id": 1,
      "type": "textField",
      "properties": {
       ...
        "validation": {
          "required": false,
          "type": "date"
        },
        "descriptionEn": "Enter a date like, mm/dd/yyyy",
        "descriptionFr": "Entrez une date comme mm/dd/yyyy",

      }
    }

The input field itself is just a text input

Screen Shot 2023-03-30 at 12 55 18 PM

Validation in the code:

Screen Shot 2023-03-30 at 1 00 55 PM
srtalbot commented 1 year ago

Right, so I'd have to manually search all the forms and update them to use the existing "date" input, rather than just as a validation type. Could we do that programmatically in a release to migrate that code and then merge in the changes to the format in a later update?

timarney commented 1 year ago

It's a bit tricky and we need to be very careful --- i.e. don't try to do that for this release.

The input remains the same input

1) timing --- We need to push a release to update the date validation

Once that's pushed ... any descriptions that say mm/dd/yyyy will be incorrect

2) Yes we would need to write a migration script looking for fields that have "date" as the validation type and "mm/dd/yyyy" in the description text.

☝️

ping @bryan-robitaille and @craigzour --- has anything like this been done before on this project ?

bryan-robitaille commented 1 year ago

No, nothing of that magnitude where we're scanning existing forms for a specific form field/description and then swapping out the block. I agree the lift is going to be bigger than initially thought if we have to take all existing old forms into account.

srtalbot commented 1 year ago

Moved to product backlog given the lift.

If we're looking at error messages and writing migration scripts, let's see if there's anything in the Error messaging and Pages epic.

connorscarolyns commented 1 year ago

Is there an option for users to choose which format they want to request? dd-mm-yyyy mm-dd-yyyy or yyyy-mm-dd ? Guidance from the UK is that dates should be requested in the format that dates are printed on source documents. Like the date printed on their renewal form or whatever. In this case, there is a need to have different options. Also would allow us to be backward compatible.

anikbrazeau commented 1 year ago

Maybe we could have the default be one of the more bilingual-friendly formats: yyyy-mm-dd?

Curious, whether there have also been other explorations done to break up this field into multiple? ex: Day [] Month [____] Year []

connorscarolyns commented 1 year ago

I have recommended the three-field approach and would like to see it implemented, but the order of the fields still needs to be addressed. Taking our cues from the UKDS they suggest ordering the dates in the order they appear on the source material, not by any formal standard format. This reduces entry errors. That said, the default should be as inclusive as possible.

connorscarolyns commented 1 year ago

Concept designs for date entry options: image.png image.png image.png https://www.figma.com/file/89fRce4gmy64UIArSZoAM8/v3.-GC-Forms-(builder-and-vault)?type=design&node-id=1507%3A52213&t=UPzEeErNjTgDJIgO-1

connorscarolyns commented 9 months ago

New design proposal for dates: https://www.figma.com/file/gkmd5aQpcnjuPeAT51oIFs/v2.-Add-modal?type=design&node-id=2241-3599&mode=design&t=W5zabKMhl3wg910R-4

anikbrazeau commented 9 months ago

Design system component for dates: https://www.figma.com/file/mh2maMG2NBtk41k1O1UGHV/branch/zbR8hajann6ga4AHWPOWcm/Canadian-Digital-Service%E2%80%A8---GC-Design-System?type=design&node-id=14220-878&mode=design&t=dKx2jbPugc4knxC3-0

srtalbot commented 5 months ago

Feedback from end-users filling out the date field at a live event providing consent to use their likeness in press releases:

Perhaps we could scope down the designs above to get a smaller version of the feature out sooner? What do you think @dsamojlenko @connorscarolyns ?

connorscarolyns commented 5 months ago

@srtalbot @dsamojlenko I will happily pair this down as much as needed to see this ticket move forward. It was scoped at a point when we thought we had more time. Dave, let's meet and see what's the best way to cut this back. SR - how many story-points can we get to complete it?

srtalbot commented 2 months ago

First version of the date component has shipped. Moving this to Icebox to be reprioritized in the future.