mirror of
https://github.com/frappe/books.git
synced 2024-12-25 20:11:15 +00:00
fix: Support JS Date in frappe.format
This commit is contained in:
parent
0a401d32cd
commit
b00de586cf
@ -25,7 +25,15 @@ module.exports = {
|
|||||||
dateFormat = frappe.SystemSettings.dateFormat;
|
dateFormat = frappe.SystemSettings.dateFormat;
|
||||||
}
|
}
|
||||||
|
|
||||||
value = luxon.DateTime.fromISO(value).toFormat(dateFormat);
|
if (typeof value === 'string') {
|
||||||
|
// ISO String
|
||||||
|
value = luxon.DateTime.fromISO(value);
|
||||||
|
} else if (Object.prototype.toString.call(value) === '[object Date]') {
|
||||||
|
// JS Date
|
||||||
|
value = luxon.DateTime.fromJSDate(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
value = value.toFormat(dateFormat);
|
||||||
if (value === 'Invalid DateTime') {
|
if (value === 'Invalid DateTime') {
|
||||||
value = '';
|
value = '';
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user