Skip to content

fieldInput - invalid date in fecha.format #341

Closed
@zoul0813

Description

@zoul0813

When entering dates manually using the keyboard in Chrome, fecha throws errors.

JSFiddle: https://jsfiddle.net/zoul0813/21ba3on5/

{
    type: "input",
    inputType: "date",
    label: "Date",
    model: "date_field",
    format: "YYYY-MM-DD"
}

When the input is focused, you can enter the date via the keyboard, such as "01", "01", "1980". As soon as you type the "1" for the year fecha throws an error because the Date field currently has "01/01/0001" but Chrome allows you to continue appending to the value by entering the other 3 digits. fecha throws 3 errors during this time, as "0001", "0019" and "0198" are invalid years but the user has not finished entering the date.

The same error occurs when you use the "x" in Chrome to clear the field. When clearing the field value, the value is not "null" and appears to be an empty string. fieldInput checks against null.

Once the date has been made valid, the model is not properly updated to reflect the correct value. Once the fecha errors are thrown, data binding appears to break ... clearing the field with the "x" and using the built-in date dropdown prevents the model from being updated as well.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions