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

Not including 'format' option in schema for an 'inputType: date' fails v2.2.2 #480

Closed
evild70 opened this issue Jul 31, 2018 · 4 comments · Fixed by #557
Closed

Not including 'format' option in schema for an 'inputType: date' fails v2.2.2 #480

evild70 opened this issue Jul 31, 2018 · 4 comments · Fixed by #557

Comments

@evild70
Copy link

evild70 commented Jul 31, 2018

Not including the format option in the schema an input with the inputType: date will cause validation to fail. It will reset the input and put the UNIX timestamp into the model. It will then put the following warning in the Chrome console:

The specified value "1286686800000" does not conform to the required format, "yyyy-MM-dd".

This issue does not exist in v2.1.1.

Correct schema:

{
    type: 'input',
    inputType: 'date',
    model: 'date',
    format: 'YYYY-MM-DD',
    validator: VueFormGenerator.validators.date
}

Example: https://jsfiddle.net/evild70/w3e0p2a6/ (see Chrome console for warning)

I couldn't find any mention of this in the documentation.

@tomdickie
Copy link

There's an issue I came across in Chrome recently where in value always has to be set in the format yyyy-mm-dd, regardless of how it's displayed on the screen and the submitted value will also always be in the same format.

https://developers.google.com/web/updates/2012/08/Quick-FAQs-on-input-type-date-in-Google-Chrome

@zoul0813
Copy link
Member

zoul0813 commented Oct 3, 2018

@evild70 is this still an issue in the latest 2.3.x?

@vafl-brut
Copy link

Still an issue

zoul0813 added a commit to zoul0813/vue-form-generator that referenced this issue Dec 10, 2018
…etime-local" elements using the standard format (YYYY-MM-DD or YYYY-MM-DDTHH:mm:ss), and "datetime" elements are converted into "datetime-local" (datetime is deprecated/obsolete).
@zoul0813
Copy link
Member

@evild70 @tomdickie @vafl-brut - does this PR solve the problem?

When there is no "format", the model will be set to the timestamp but the HTML5 field will still be set properly using YYYY-MM-DDTHH:mm:ss ... I also added a catch for "datetime" fields to convert them into "datetime-local" as "datetime" is obsolete now.

zoul0813 added a commit that referenced this issue Dec 14, 2018
fixes #480 - dates are always passed to "date" and "datetime-local" e…
zoul0813 added a commit to zoul0813/vue-form-generator that referenced this issue Dec 14, 2018
* samples/fsfiddle-demo:
  jsfiddle-sample embedded into repo
  migrated VFG docs to newer GitBooks, created GitHub Repo for Docs to allow for easier maintenance, updated JSFiddle to use "latest" VFG, and created a CodePen version as well
  Codacy (guard-for-in) fix
  fixed code structure
  added "options" to VFG install function, appending custom "validators" to the validators object that are passed into `Vue.use(VueFormGenerator, { validators: { key: (value, field, model) => {} })
  added an optional "unique" flag to "getFieldID" that appends lodash "uniqueId" to the ID when true.  Fixes vue-generators#468
  fixed single-quotes
  added "type" attribute to inside buttons schema, defaults to "button" when one is not provided
  fixes vue-generators#480 - dates are always passed to "date" and "datetime-local" elements using the standard format (YYYY-MM-DD or YYYY-MM-DDTHH:mm:ss), and "datetime" elements are converted into "datetime-local" (datetime is deprecated/obsolete).
  added "item.disabled" logic, supporting both boolean values and a function that is passed a reference to the model to determine disabled logic based on the model.
  listen for model-updated from `fields`, and fix `debounceFormatFunction` property to match fieldInput's `debounceFormatFunc` instead.
  Fix required number input does not require a value
zoul0813 added a commit to zoul0813/vue-form-generator that referenced this issue Dec 14, 2018
* master-origin:
  fix issue with null values on datetime
  2.3.3 releases
  added newline
  migrated VFG docs to newer GitBooks, created GitHub Repo for Docs to allow for easier maintenance, updated JSFiddle to use "latest" VFG, and created a CodePen version as well
  code fix
  fixes an issue with fieldPikaday modifying the field schema and attaching `this.$el` to it, the pikadayOptions are now stored as `this.options` and created with `defaults({}, this.schema.pikadayOptions, {...})` to prevent this
  Codacy (guard-for-in) fix
  fixed code structure
  added "options" to VFG install function, appending custom "validators" to the validators object that are passed into `Vue.use(VueFormGenerator, { validators: { key: (value, field, model) => {} })
  added an optional "unique" flag to "getFieldID" that appends lodash "uniqueId" to the ID when true.  Fixes vue-generators#468
  fixed single-quotes
  added "type" attribute to inside buttons schema, defaults to "button" when one is not provided
  fixes vue-generators#480 - dates are always passed to "date" and "datetime-local" elements using the standard format (YYYY-MM-DD or YYYY-MM-DDTHH:mm:ss), and "datetime" elements are converted into "datetime-local" (datetime is deprecated/obsolete).
  added "item.disabled" logic, supporting both boolean values and a function that is passed a reference to the model to determine disabled logic based on the model.
  listen for model-updated from `fields`, and fix `debounceFormatFunction` property to match fieldInput's `debounceFormatFunc` instead.
  Fix required number input does not require a value
  feat: add maxElements slot to fieldVueMultiSelect
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

Successfully merging a pull request may close this issue.

4 participants