Skip to content
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

fieldInput - invalid date in fecha.format #341

Closed
zoul0813 opened this issue Nov 10, 2017 · 0 comments
Closed

fieldInput - invalid date in fecha.format #341

zoul0813 opened this issue Nov 10, 2017 · 0 comments
Assignees

Comments

@zoul0813
Copy link
Member

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.

@zoul0813 zoul0813 self-assigned this Dec 12, 2017
@icebob icebob closed this as completed in a46fe31 Dec 12, 2017
icebob added a commit that referenced this issue Dec 12, 2017
fixes #341 - introduced debounce functionality into `formatValueToModel`
zoul0813 added a commit to zoul0813/vue-form-generator that referenced this issue Dec 13, 2017
* master:
  reverting back to original test
  reverted back to `schema.required` for "none selected" disabled state, per @icebob
  fixes vue-generators#340 - "none" value set to `null`, formatValueToField checks for `isNil(value)` and returns `null`, none options are always disabled
  fixes vue-generators#362 - `integer` validator now calls `number` validator, and returns `invalidIntegerl: "The value is not an integer"` as well as any errors generated by `number`
  fixes vue-generators#361 - use $event.target.valueAsNumber for number/range inputs, debounce `formatValueToModel` for number/range, removed `formatValueToField`
  added missing comma that failed in Travis
  requested by @icebob
  fixes vue-generators#341 - introduced debounce functionality into `formatValueToModel`

# Conflicts:
#	dist/vfg-core.js
#	dist/vfg.js
#	package-lock.json
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant