Open vpstuart opened 9 years ago
This is the answer. All possible format options MUST be specified. I am using date only here, so I have to provide both format
and formatDate
.
jQuery(function() {
var fmt = 'DD.MM.YYYY';
Date.parseDate = function (input, format) {
return moment(input, format).toDate();
};
Date.prototype.dateFormat = function (format) {
return moment(this).format(format);
};
$.datetimepicker.setLocale("en");
jQuery('#last-login-from').datetimepicker({
format: fmt,
formatDate: fmt,
validateOnBlur: true,
allowBlank: true,
closeOnDateSelect: true,
datepicker: true,
timepicker: false,
onShow: function (ct) {
var endR = jQuery('#last-login-to').val();
this.setOptions({
maxDate: endR ? endR : false
})
}
});
jQuery('#last-login-to').datetimepicker({
format: fmt,
formatDate: fmt,
validateOnBlur: true,
allowBlank: true,
closeOnDateSelect: true,
datepicker: true,
timepicker: false,
onShow: function (ct) {
var stR = jQuery('#last-login-from').val();
alert(stR);
this.setOptions({
minDate: stR ? stR : false
})
}
});
});
Hi guys,
Loving the datepicker.
My users aren't too happy that when they enter a date in a format that is slightly different from that specified for the date picker, it is replaced with the current date/time.
I am currently implementing a workaround for a slightly fuzzier parsing function, and wanted to ask if it was worth putting back into the datetimepicker master:
This is the workaround: