Open DanielDornhardt opened 10 years ago
Ah, yes - that is an unfortunate oversight within the API.
This will be resolved as of v4 because proper event objects will be used. Keeping this open until then.
Appreciate you bringing this up!
Maybe it would be nice to add a reference / short explanation to the docs on how to normalize the result in onSet for the current version?
I'm right now not able to properly create a pull request, but maybe the code I am using is helpful as an example to somebody:
onSet: function(context) {
var val;
if (!(context != null ? context.select : void 0)) {
return '';
}
val = context.select;
if ('object' === typeof val) {
return val = val.obj.getTime();
}
}
Maybe you could add some of it to the http://amsul.ca/pickadate.js/date.htm - help at the bottom, where the onSet - callback is described.
Thanks & best wishes
Daniel
Just noticed this issue while playing with the onSet callback. Would be great to see this implemented in some future version.
Hello,
One of my clients discovered that the date wasn't saved correctly when he was tabbing through a form and selecting the value of the datepicker via the keyboard and pressing enter.
Upon debugging the issue, I noticed that indeed the datepicker supplies different values, depending on whether the keyboard or the mouse was used to trigger the selection:
Code in onSet - callback:
Selecting a date with the mouse returns this:
Selecting a date via keyboard returns this:
The object looks nice, and I can definitely use it, but I just wanted to let you know that it's an issue people who would use onSet: without testing keyboard interaction could stumble about:
Anyways, the datepicker itself is awesome, and very well supported, very professional, I can't thank you enough.
Best wishes
Daniel