create datetime mixin

This commit is contained in:
LouisLam
2021-08-17 16:41:12 +08:00
parent 61e758d872
commit 5e52f230b1
4 changed files with 60 additions and 20 deletions

View File

@@ -22,15 +22,11 @@ export default {
computed: {
displayText() {
if (this.value !== undefined && this.value !== "") {
let format = "YYYY-MM-DD HH:mm:ss";
if (this.dateOnly) {
format = "YYYY-MM-DD";
}
return dayjs.utc(this.value).tz(this.$root.timezone).format(format);
if (this.dateOnly) {
return this.$root.date(this.value);
} else {
return this.$root.datetime(this.value);
}
return "";
},
},
}