Closed jerocosio closed 7 years ago
This error is still happening, anyway to fix this?
It's annoying. I had to set up hooks for any autoform's that use the datepicker.
formToDoc:function(doc) {
var badDate = doc.date;
//get the number of minutes the local timezone is offset from UTC
var zone = new Date().getTimezoneOffset();
/*
make a new Date object using the milliseconds from epoch of badDate
+ timezoneOffset converted to milliseconds
*/
var newDate = new Date(badDate.getTime() + (zone * 60000));
//This will set the submitted date to be midnight local time of the day selected in datepicker
doc.date = newDate;
return doc;
}
Since timezone does not matter, dates are stored UTC by convention. Be sure to specify UTC timezone whenever you display them.
Hi, I think there is a bug or something wrong with this plugin, when you choose the type as Date and try to add a new date, the plugin don't saves the actual date you want, it saves a day before, you can see this even on the Demos: http://autoform.meteor.com/types just add any date, and then check out the console to see how it changes.