This commit is contained in:
@@ -47,7 +47,7 @@ export default {
|
||||
label: String,
|
||||
value: String,
|
||||
readonly: { type: Boolean, default: false },
|
||||
dayjs: Function,
|
||||
//dayjs: Function,
|
||||
locale: Object
|
||||
},
|
||||
watch: {
|
||||
@@ -62,42 +62,42 @@ export default {
|
||||
formatDateTime() {
|
||||
//debugger;
|
||||
return this.value
|
||||
? this.dayjs(this.value).add(this.locale.timeZoneOffset, "hour").format(this.locale.formats.shortDateAndTime)
|
||||
? this.$dayjs(this.value).add(this.locale.timeZoneOffset, "hour").format(this.locale.formats.shortDateAndTime)
|
||||
: "";
|
||||
},
|
||||
formatDate() {
|
||||
return this.value
|
||||
? this.dayjs(this.value).add(this.locale.timeZoneOffset, "hour").format(this.locale.formats.shortDate)
|
||||
? this.$dayjs(this.value).add(this.locale.timeZoneOffset, "hour").format(this.locale.formats.shortDate)
|
||||
: "";
|
||||
},
|
||||
formatTime() {
|
||||
//debugger;
|
||||
return this.value
|
||||
? this.dayjs(this.value)
|
||||
? this.$dayjs(this.value)
|
||||
.add(this.locale.timeZoneOffset, "hour")
|
||||
.format(this.locale.formats.shortTime)
|
||||
: "";
|
||||
},
|
||||
dateOnly: {
|
||||
get() {
|
||||
return this.dayjs(this.value).add(this.locale.timeZoneOffset, "hour").format("YYYY-MM-DD");
|
||||
return this.$dayjs(this.value).add(this.locale.timeZoneOffset, "hour").format("YYYY-MM-DD");
|
||||
//return this.value ? this.value.substr(0, 10) : null;
|
||||
},
|
||||
set(value) {
|
||||
//this .date is always utc so convert back here before setting or all hell will break loose!
|
||||
this.date = this.dayjs(value + " " + this.timeOnly).subtract(this.locale.timeZoneOffset, "hour").toISOString();
|
||||
this.date = this.$dayjs(value + " " + this.timeOnly).subtract(this.locale.timeZoneOffset, "hour").toISOString();
|
||||
//this.date = value + " " + this.timeOnly;
|
||||
}
|
||||
},
|
||||
timeOnly: {
|
||||
get() {
|
||||
return this.dayjs(this.value).add(this.locale.timeZoneOffset, "hour").format("HH:mm:ss");
|
||||
return this.$dayjs(this.value).add(this.locale.timeZoneOffset, "hour").format("HH:mm:ss");
|
||||
//return this.value ? this.value.substr(11, 8) : null;
|
||||
},
|
||||
set(value) {
|
||||
//debugger;
|
||||
//this .date is always utc so convert back here before setting or all hell will break loose!
|
||||
this.date = this.dayjs(this.dateOnly + " " + value).subtract(this.locale.timeZoneOffset, "hour").toISOString();
|
||||
this.date = this.$dayjs(this.dateOnly + " " + value).subtract(this.locale.timeZoneOffset, "hour").toISOString();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user