From 60a8a89f5b7526af44c9682e151dd92c979b1412 Mon Sep 17 00:00:00 2001
From: rinpatch <rinpatch@sdf.org>
Date: Thu, 3 Dec 2020 00:17:55 +0300
Subject: Use app locale with toLocaleString/toLocaleDateString

Fixes inconsistent date formatting when browser language is different
from PleromaFE language.
---
 src/components/timeago/timeago.vue | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

(limited to 'src/components/timeago/timeago.vue')

diff --git a/src/components/timeago/timeago.vue b/src/components/timeago/timeago.vue
index 6df0524d..55a2dd94 100644
--- a/src/components/timeago/timeago.vue
+++ b/src/components/timeago/timeago.vue
@@ -9,6 +9,7 @@
 
 <script>
 import * as DateUtils from 'src/services/date_utils/date_utils.js'
+import localeService from 'src/services/locale/locale.service.js'
 
 export default {
   name: 'Timeago',
@@ -21,9 +22,10 @@ export default {
   },
   computed: {
     localeDateString () {
+      const browserLocale = localeService.internalToBrowserLocale(this.$i18n.locale)
       return typeof this.time === 'string'
-        ? new Date(Date.parse(this.time)).toLocaleString()
-        : this.time.toLocaleString()
+        ? new Date(Date.parse(this.time)).toLocaleString(browserLocale)
+        : this.time.toLocaleString(browserLocale)
     }
   },
   created () {
-- 
cgit v1.2.3-70-g09d2

