trussworks / react-uswds

USWDS 3.0 components built in React
https://trussworks.github.io/react-uswds/
Apache License 2.0
182 stars 81 forks source link

[feat] Modifiable external_date_format #2537

Open tylerbarna opened 1 year ago

tylerbarna commented 1 year ago

Does your feature request relate to a specific USWDS component?

DatePicker and, by extension, DateRangePicker

What USWDS Version is this feature present in?

2.8.0 via #803

Is your feature request related to a problem? Please describe.

The date range picker doesn't seem to have a way to modify the external date format from MM/DD/YYYY to other common formats, though YYYY-MM-DD is used in the backend

Describe the solution you'd like

Provide a property to a call to DateRangePicker or DatePicker to specify the external date format. In my case, having an option to use the YYYY-MM-DD format in both the backend and frontend

Describe alternatives you've considered

Attempted to work around this by converting from MM/DD/YYYY to YYYY-MM-DD after setting a URL parameter, but this is not reflected in the URL parameter itself and also results in the date picker element being blank

Additional context

I'm attempting to implement a date range filter for the NASA GCN Project (in-progress PR for backend here) with a consistent ISO format for both front and backend, as astronomers are more inclined to use YYYY-MM-DD than MM/DD/YYYY

brandonlenz commented 1 year ago

Seems worth implementing. USWDS does not provide strict guidance on only using a specific format, just describing the format used to the user clearly: https://designsystem.digital.gov/components/date-picker/

werdnanoslen commented 7 months ago

@tylerbarna would #2726 deliver this feature fully for you?

tylerbarna commented 7 months ago

@tylerbarna would #2726 deliver this feature fully for you?

Yes, I believe so!