gcds-components icon indicating copy to clipboard operation
gcds-components copied to clipboard

feat: yyyy-MM-dd date input

Open radmorecameron opened this issue 2 months ago • 2 comments

Prerequisites | Prérequis

Describe the feature request. | Décrivez la fonctionnalité demandée

For data entry, it's valuable to be able to enter dates in yyyy-MM-dd format (ex: when writing someone's birthdate down based on a driver's license that was submitted)

Describe the use case. | Décrivez les cas d’utilisation

For our usecase, it'd also be useful if people could just type a date in this format instead of having to use a dropdown to select the month.

Describe the preferred solution. | Décrivez la solution souhaitée

For our usecase, it'd also be useful if our users could just type a date in this format instead of having to use a dropdown to select the month and if they can enter it in yyyy-MM-dd format since that is the format of the documents that they are entering into the system follow.

Describe all alternatives. | Décrivez toutes les solutions possibles

  • add property to specify display format on gcds-date-input

Provide related code or examples. | Fournissez du code ou des exemples pertinents

No response

Add other relevant resources. | Ajoutez toute autre ressource utile

No response

radmorecameron avatar Oct 03 '25 22:10 radmorecameron

@radmorecameron while it's not in our documentation, you should be able to set the type="date" to the <gcds-input> component, giving you the browser's datepicker. You could also set min and max for additional validation. Would this work for your use-case?

At the moment we don't have a datepicker component and the date input supports a different pattern for gathering date inputs.

daine avatar Oct 08 '25 16:10 daine

@radmorecameron while it's not in our documentation, you should be able to set the type="date" to the <gcds-input> component, giving you the browser's datepicker. You could also set min and max for additional validation. Would this work for your use-case?

At the moment we don't have a datepicker component and the date input supports a different pattern for gathering date inputs.

Hi, this may be a bit of an edge case but the problem with type="date" is the display format can be weird. It doesn't follow the ISO 8601 standard and instead does it in a localized non-standard way (it varies based on operating system and browser).

Ex for windows and Microsoft Edge: If french (Canada) is the region setting in windows then microsoft edge displays it like this (which I believe is the France french version and not the Canadian french?): Date format of dd-mm-yyyy for an input element

If english (Canada) is the region setting in windows then microsoft edge displays it in the: yyyy-mm-dd format (which is the only official date format for all numerical dates in Canada - and what we want)

If English (United States) is the region setting in windows then microsoft edge displays it as: mm-dd-yyyy (which isn't a great format and will cause issues for shorter dates. Ex: october 8th entered in the system instead of August 10th if they don't use the date picker)

Edit: Also an issue with the browser's built-in datepicker is that it ignores the language of the page so if the page you're on has the language set to French but your operating system is set to English then the calendar popup will be in English instead of French

radmorecameron avatar Oct 08 '25 19:10 radmorecameron