fix: Do not convert timezone of date field
This commit is contained in:
parent
e5b36b214a
commit
852dbae6ce
3 changed files with 8 additions and 7 deletions
|
|
@ -137,13 +137,13 @@ frappe.ui.form.ControlDate = class ControlDate extends frappe.ui.form.ControlDat
|
|||
});
|
||||
}
|
||||
parse(value) {
|
||||
if(value) {
|
||||
return frappe.datetime.user_to_str(value);
|
||||
if (value) {
|
||||
return frappe.datetime.user_to_str(value, false, true);
|
||||
}
|
||||
}
|
||||
format_for_input(value) {
|
||||
if(value) {
|
||||
return frappe.datetime.str_to_user(value);
|
||||
if (value) {
|
||||
return frappe.datetime.str_to_user(value, false, true);
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
|
|
|||
|
|
@ -45,8 +45,6 @@ frappe.ui.form.ControlDatetime = class ControlDatetime extends frappe.ui.form.Co
|
|||
}
|
||||
format_for_input(value) {
|
||||
if (!value) return "";
|
||||
|
||||
|
||||
return frappe.datetime.str_to_user(value, false);
|
||||
}
|
||||
set_description() {
|
||||
|
|
|
|||
|
|
@ -133,7 +133,7 @@ $.extend(frappe.datetime, {
|
|||
return frappe.sys_defaults && frappe.sys_defaults.date_format || "yyyy-mm-dd";
|
||||
},
|
||||
|
||||
str_to_user: function(val, only_time = false) {
|
||||
str_to_user: function(val, only_time=false, only_date=false) {
|
||||
if (!val) return "";
|
||||
const user_date_fmt = frappe.datetime.get_user_date_fmt().toUpperCase();
|
||||
const user_time_fmt = frappe.datetime.get_user_time_fmt();
|
||||
|
|
@ -142,6 +142,9 @@ $.extend(frappe.datetime, {
|
|||
if (only_time) {
|
||||
let date_obj = moment(val, frappe.defaultTimeFormat);
|
||||
return date_obj.format(user_format);
|
||||
} else if (only_date) {
|
||||
let date_obj = moment(val, frappe.defaultDateFormat);
|
||||
return date_obj.format(user_date_fmt);
|
||||
} else {
|
||||
let date_obj = moment.tz(val, frappe.boot.time_zone.system);
|
||||
if (typeof val !== "string" || val.indexOf(" ") === -1) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue