Date validation failed with Timezone (related to DayJS issue)
Package version
2.1.0
Describe the bug
When validating a date with a format containing the symbol Z (see https://day.js.org/docs/en/display/format#list-of-all-available-formats) it will fail.
This issue seems to be related on DayJS latest version. Here some tickets open on their github :
- https://github.com/iamkun/dayjs/issues/2730
- https://github.com/iamkun/dayjs/issues/2724
Here an example to test :
vine.object({
startDateTime: vine
.date({
formats: ['YYYY-MM-DD[T]HH:mmZ'],
})
})
input : "startDateTime": "2024-09-11T14:20+0200"
I wish you all a lovely day :)
Reproduction repo
No response
dayjs/plugin/timezone not found in issue. what to do?
Seems like a lot of issues coming from DayJS. Maybe, we should consider moving a more stable (yet small) library for dates parsing
Investigating https://tempo.formkit.com/#timezones-apply-offsets and like it so far. Most probably we will swap it under the hood with DayJS
Investigating https://tempo.formkit.com/#timezones-apply-offsets and like it so far. Most probably we will swap it under the hood with DayJS
If we are going to change the library used by Vine, I would prefer to rely on Temporal directly since it will be part of the JS spec.
At the moment, we can use this polyfill to make it work internally: https://github.com/fullcalendar/temporal-polyfill
@RomainLanz Any recommendations on how to parse dates with custom formats?