[fix] datepicker defaults to now

This commit is contained in:
Rushabh Mehta 2015-07-03 10:21:46 +05:30
parent 69fac8f5e9
commit 2cae554596

View file

@ -547,9 +547,13 @@ frappe.ui.form.ControlTime = frappe.ui.form.ControlData.extend({
frappe.ui.form.ControlDatetime = frappe.ui.form.ControlDate.extend({
set_datepicker: function() {
this.datepicker_options.timeFormat = "HH:mm:ss";
this.datepicker_options.dateFormat =
(frappe.boot.sysdefaults.date_format || 'yy-mm-dd').replace('yyyy','yy');
var now = new Date();
$.extend(this.datepicker_options, {
"timeFormat": "HH:mm:ss",
"dateFormat": (frappe.boot.sysdefaults.date_format || 'yy-mm-dd').replace('yyyy','yy'),
"hour": now.getHours(),
"minute": now.getMinutes()
});
this.$input.datetimepicker(this.datepicker_options);
},