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

Problem with inputType="date" #138

Closed
gkurdej opened this issue Mar 1, 2017 · 8 comments
Closed

Problem with inputType="date" #138

gkurdej opened this issue Mar 1, 2017 · 8 comments

Comments

@gkurdej
Copy link

gkurdej commented Mar 1, 2017

I have problem with field type="input", inputType="date" and inputType="datetime-local"
This fields save date in format: Fri Nov 30 1973 00:00:00 GMT+0100 (CET)
But cannot read such format. I expects number: 123412323232

Fiddle:
https://jsfiddle.net/ebmgv286/3/

@icebob
Copy link
Member

icebob commented Mar 2, 2017

Thanks, missing some formatter from field code

@icebob
Copy link
Member

icebob commented Mar 2, 2017

Hot fix: https://jsfiddle.net/icebob/ebmgv286/4/

{
	type: "input",
	inputType: "date",
	label: "Example date",
	model: "exampleDate",
	set: function(model, val) {
		model.exampleDate = new Date(val).valueOf();
	}
}

@gkurdej
Copy link
Author

gkurdej commented Mar 2, 2017

I checked fiddle - now I can save and read dates without errors. Much better :)

Is it possible to save dates in other format? E.g. "2017-03-02 12:04:00"?

@icebob
Copy link
Member

icebob commented Mar 2, 2017

If I fixed this bug in vfg then yes.

@dflock dflock added this to the v2.0.0 milestone Jun 2, 2017
@icebob icebob closed this as completed in c82cd9a Jun 2, 2017
@icebob
Copy link
Member

icebob commented Jun 2, 2017

I fixed it. Fiddle with the fixed bundle: https://jsfiddle.net/ebmgv286/5/

Other example with formatted date value: https://jsfiddle.net/ebmgv286/6/

@dflock
Copy link
Collaborator

dflock commented Jun 2, 2017

Does this require any docs changes?

@icebob
Copy link
Member

icebob commented Jun 2, 2017

@dflock Maybe. Because now type="input" field have a "format" property if the inputType is date, ˛datetime or datetime-local

@brunofullstack
Copy link

Hot fix: https://jsfiddle.net/icebob/ebmgv286/4/

{
	type: "input",
	inputType: "date",
	label: "Example date",
	model: "exampleDate",
	set: function(model, val) {
		model.exampleDate = new Date(val).valueOf();
	}
}

This work for me. Thanks!

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

4 participants