Applying a date formatter to a date field #4322
-
I tried passing a date formatter like let dateFormatter = useDateFormatter({ month: "2-digit", day: "2-digit" }) to |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 9 replies
-
Seems like something we could expose on the options here: https://github.com/adobe/react-spectrum/blob/main/packages/%40react-stately/datepicker/src/useDateFieldState.ts#L190 At least, doing that works for me locally. It probably didn't work for you since the internals of useDateFieldState would need access to the same formatter you've created. @devongovett any concerns? |
Beta Was this translation helpful? Give feedback.
I just came across this issue myself where we support multiple locales but dates are always displayed in ISO-8601 format. A somewhat hacky way to accomplish this is by mapping
DateSegments[]
to a different list of segments: