Merge pull request #5215 from achillesrasquinha/check-moment

check moment exists the right way
This commit is contained in:
Achilles Rasquinha 2018-03-19 12:07:57 +05:30 committed by GitHub
commit 4f4bf25d92
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -4,7 +4,7 @@ function prettyDate(time, mini) {
if (!time) {
time = new Date();
}
if (moment) {
if ('moment' in window) { // use frappe.ImportError ;)
let ret;
if (frappe.sys_defaults && frappe.sys_defaults.time_zone) {
ret = moment.tz(time, frappe.sys_defaults.time_zone).locale(frappe.boot.lang).fromNow(mini);