vine icon indicating copy to clipboard operation
vine copied to clipboard

Date validation failed with Timezone (related to DayJS issue)

Open crbast opened this issue 1 year ago • 5 comments

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

crbast avatar Sep 28 '24 16:09 crbast

dayjs/plugin/timezone not found in issue. what to do? image

mahfuz271 avatar Oct 01 '24 13:10 mahfuz271

Seems like a lot of issues coming from DayJS. Maybe, we should consider moving a more stable (yet small) library for dates parsing

thetutlage avatar Nov 29 '24 03:11 thetutlage

Investigating https://tempo.formkit.com/#timezones-apply-offsets and like it so far. Most probably we will swap it under the hood with DayJS

thetutlage avatar Apr 28 '25 04:04 thetutlage

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 avatar Apr 28 '25 06:04 RomainLanz

@RomainLanz Any recommendations on how to parse dates with custom formats?

thetutlage avatar May 05 '25 10:05 thetutlage