vee-validate: Date 08/10/2000 in DD/MM/YYYY format is invalid

Versions

  • vee-validate: 2.1.0-beta.9
  • vue: 2.5.2

Describe the bug I have fields set in v-validate="{date_format: 'DD/MM/YYYY'}", but when I enter the date 10/8/2000 the validation returns an error saying that the date is not in DD/MM/YYYY format

To Reproduce Steps to reproduce the behavior:

  1. Go to https://baianat.github.io/vee-validate/guide/rules.html#date-format. In my browser, the default format is DD/MM/YYYY (pt-br)
  2. Type the date 08/10/2000
  3. See error

Demo Link Edit Vue Template

Desktop (please complete the following information):

  • OS: [e.g. Windows]
  • Browser [chrome]
  • Version [69]

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 18 (4 by maintainers)

Most upvoted comments

Same here, i have another dates too: 08/10/2000, 06/10/1996, 06/10/1997, … http://prntscr.com/l5o7v0 @woodyalan, @viniazvd and i are brazilians, maybe have some connection with the language of the browser

I believe the problem is just the documentation. Changing date_format from "DD/MM/YYYY" to "dd/MM/yyyy" worked fine.

I have the same problem.

The date he used does not work here either.

Another example is: 04/11/2018

This issue is a pain to debug properly since firefox and chrome seem to have different opinions on what new Date() should return. This offsets the date validation.

This is related to #1693

VeeValidate uses date-fns@2.0.0-alpha.7 to validate dates, but the library isn’t equipped (yet) to deal with timezones and overflown dates eg: 22/33/2013. So we account for that by parsing the date, then formatting the parsed result and match it with the input. If nothing changes then its a valid date, if something changed (day, hour, or whatever) then the date was manipulated in some way (overflow or timezone offset by new Date()) the latter wasn’t accounted for.

The new versions seem to address this issue, as the offset isn’t observed in firefox anymore, there is a PR that introduces the pkg update #1698 Which introduces a breaking change to the format.

I would appreciate testing the PR against your environments:

* Clone the repo

* Checkout the `update-date-fns` branch.

* install the dependencies: `yarn` and build the project: `yarn build`

* Run the local docs version: `yarn docs:dev`

* Test the page

It looks like in this branch the validation stopped working.

Tested on: Firefox 63.0.1 (locale pt_BR) - Windows 10 Chrome 70.0.3538.77 (locale pt_BR) - Windows 10

image

I am having the same problem. Valid dates are not validating. Has this been merged in yet?

Same here, i have another dates too: 08/10/2000, 06/10/1996, 06/10/1997, … http://prntscr.com/l5o7v0 @woodyalan, @viniazvd and i are brazilians, maybe have some connection with the language of the browser

Given the people who reported this problem really seems to have some connection with environments configured with the Brazilian Portuguese language.