fix(datetime): persist datetime fieldvalue on clicking instead of clearing
This commit is contained in:
parent
3f6ee6388d
commit
1008899bc8
1 changed files with 5 additions and 0 deletions
|
|
@ -10,11 +10,16 @@ frappe.ui.form.ControlDatetime = class ControlDatetime extends frappe.ui.form.Co
|
|||
} else if (value.toLowerCase() === "now") {
|
||||
value = frappe.datetime.now_datetime();
|
||||
}
|
||||
const raw_value = value;
|
||||
let should_refresh = this.last_value && this.last_value !== value;
|
||||
value = this.format_for_input(value);
|
||||
this.$input && this.$input.val(value);
|
||||
if (should_refresh) {
|
||||
this.datepicker.selectDate(frappe.datetime.user_to_obj(value));
|
||||
} else if (value && !this.datepicker.selectedDates.length) {
|
||||
const date_obj = frappe.datetime.str_to_obj(raw_value);
|
||||
this.datepicker.selectedDates = [date_obj];
|
||||
this.datepicker.viewDate = date_obj;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue