From 7231b5bb8137bb26ae9ef91bc6bfaaaefe95976f Mon Sep 17 00:00:00 2001 From: G-nizam-A Date: Tue, 19 Mar 2024 15:46:17 +0530 Subject: [PATCH 1/2] Feat: Localization of dates/times #4584 --- src/mixins/datetime.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/mixins/datetime.js b/src/mixins/datetime.js index 1946d190..d30e79de 100644 --- a/src/mixins/datetime.js +++ b/src/mixins/datetime.js @@ -92,7 +92,11 @@ export default { */ datetimeFormat(value, format) { if (value !== undefined && value !== "") { - return dayjs.utc(value).tz(this.timezone).format(format); + const date = new Date(value); + return date.toLocaleString(this.$i18n.locale, { ...format, + hour12: false }); // 24 hour format + // return date.toLocaleString(this.$i18n.locale, format); // 12 hours format + // return dayjs.utc(value).tz(this.timezone).format(format); } return ""; }, From 1f98d1944eb9760892cf6d950f87f302189bf912 Mon Sep 17 00:00:00 2001 From: G-nizam-A Date: Tue, 19 Mar 2024 19:46:27 +0530 Subject: [PATCH 2/2] Feat: Localization of date/time #4584 --- src/mixins/datetime.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/mixins/datetime.js b/src/mixins/datetime.js index d30e79de..3b4afeb3 100644 --- a/src/mixins/datetime.js +++ b/src/mixins/datetime.js @@ -94,9 +94,8 @@ export default { if (value !== undefined && value !== "") { const date = new Date(value); return date.toLocaleString(this.$i18n.locale, { ...format, - hour12: false }); // 24 hour format - // return date.toLocaleString(this.$i18n.locale, format); // 12 hours format - // return dayjs.utc(value).tz(this.timezone).format(format); + hour12: false, + timeZone: this.timezone }); // 24 hours format } return ""; },