Use app locale with toLocaleString/toLocaleDateString

Fixes inconsistent date formatting when browser language is different
from PleromaFE language.
This commit is contained in:
rinpatch 2020-12-03 00:17:55 +03:00
parent 0358284ebf
commit 60a8a89f5b
3 changed files with 9 additions and 4 deletions

View file

@ -5,6 +5,8 @@
</template>
<script>
import localeService from 'src/services/locale/locale.service.js'
export default {
name: 'Timeago',
props: ['date'],
@ -16,7 +18,7 @@ export default {
if (this.date.getTime() === today.getTime()) {
return this.$t('display_date.today')
} else {
return this.date.toLocaleDateString('en', { day: 'numeric', month: 'long' })
return this.date.toLocaleDateString(localeService.internalToBrowserLocale(this.$i18n.locale), { day: 'numeric', month: 'long' })
}
}
}