Skip to content

Bug: date input doesn't work on 2.2.0 #436

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Kize opened this issue Apr 11, 2018 · 4 comments
Closed

Bug: date input doesn't work on 2.2.0 #436

Kize opened this issue Apr 11, 2018 · 4 comments

Comments

@Kize
Copy link

Kize commented Apr 11, 2018

Hi there,

I noticed a bug on the last release of your plugin.

On 2.1.1, the input type='date' works perfectly, it can be tested on this fiddle

On 2.2.0, vue-form-generator uses a valueAsDate property of the input, which returns a timestamp instead of a string (YYYY-MM-DD), which breaks the input. (See the console warning after the onBlur event, it specifies that a timeStamp is given)

The bug can be reproduced on this fiddle. The input resets itself on blur.


It seems to come from #363, but I'm not sure of it...
@zoul0813
Copy link
Member

@Kize provide a format property for the date to have it stored differently. VFG uses FechaJs to translate dates and if no format is provided it just calls fechaObject.valueOf().

Here's an updated copy of your 2.2.0 Fiddle running against 2.2.1 with a Format property

@Kize
Copy link
Author

Kize commented Apr 11, 2018

@zoul0813 your solution is kind of a workaround, as you can't choose the format of your date.
You have to specify that format: 'YYYY-MM-DD' in order to make it work. (a HTML input date doesn't allow other format)

So there is still a major breaking change between 2.1.0 and 2.2.x, as an optional property becomes mandatory.

But anyway, thanks for your answer, it fixes my problem 😄

@zoul0813
Copy link
Member

@Kize I wasn't aware of the HTML5 Date Fields requirement to be in YYYY-MM-DD format. I'm flagging this as a bug, and will try to get the date field to default to the YYYY-MM-DD format so you don't have to specify it manually.

@zoul0813
Copy link
Member

Fixed in #557

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants