Replies: 2 comments
-
@timmaier It seems the format you use for the dates is ISO 8601. (Although, a date/time object would need a little bit of adjustment on the backend so that it follows the ISO 8601 format, e.g.
Both of these functions will return a Would these functions from |
Beta Was this translation helpful? Give feedback.
-
I solved it like this:
|
Beta Was this translation helpful? Give feedback.
-
Hey in the application I'm building I'm wanting to use the DatePicker from radix-vue.
My backend sends date/datetime strings such as
2024-06-20
,2024-06-15 13:24:37
I'm wanting to wrap the DatePicker of radix-vue in a CommonDatePicker that consumes this date string and makes the ergonomics of building forms that pre-populate with date string values that my backend sends and expects to receive easier.
Way's I've attempted this is with a computed to map the string modelValue passed to CommonDatePicker into a CalendarDate consumable by the DatePicker. This works but then I lose the ability to type the date into the input as each update mutates.
My work around for the moment is to run the cast to CalendarDate before the modelValue is set into the input and then cast it back to string right before we send the value to the backend. This is fine it's just always up to the dev to ensure this happens for each form that is built.
Maybe the best approach would be to put the work in on the backend and ensure that the date value the backend sends conforms with CalendarDate type of the import {CalendarDate} from "@internationalized/date";
Beta Was this translation helpful? Give feedback.
All reactions