fix chinese datapicker #105

This commit is contained in:
Alireza Ahmadi
2024-04-23 19:42:09 +02:00
parent ae7fa7285f
commit fa922291ea
3 changed files with 10 additions and 2 deletions
+1
View File
@@ -13,6 +13,7 @@
"chart.js": "^4.4.1",
"clipboard": "^2.0.11",
"core-js": "^3.29.0",
"moment": "^2.30.1",
"pinia": "^2.1.7",
"qrcode.vue": "^3.4.1",
"roboto-fontface": "*",
+1
View File
@@ -14,6 +14,7 @@
"chart.js": "^4.4.1",
"clipboard": "^2.0.11",
"core-js": "^3.29.0",
"moment": "^2.30.1",
"pinia": "^2.1.7",
"qrcode.vue": "^3.4.1",
"roboto-fontface": "*",
+8 -2
View File
@@ -10,7 +10,7 @@
<DatePicker
v-model="Input"
@input="Input=$event"
:locale="$i18n.locale"
:locale="locale"
element="expiry"
compact-time
type="datetime">
@@ -42,6 +42,8 @@
<script lang="ts">
import DatePicker from 'vue3-persian-datetime-picker'
import { i18n } from '@/locales'
import 'moment/locale/zh-cn'
import 'moment/locale/zh-tw'
export default {
props: ['expiry'],
@@ -54,10 +56,14 @@ export default {
},
components: { DatePicker },
computed: {
locale() {
const l = i18n.global.locale.value
return l.replace('zh', 'zh-')
},
dateFormatted() {
if (this.expDate == 0) return i18n.global.t('unlimited')
const date = new Date(this.expDate*1000)
return date.toLocaleString(i18n.global.locale.value)
return date.toLocaleString(this.locale)
},
expDate() {
return parseInt(this.expiry?? 0)