This commit is contained in:
2019-03-06 17:06:42 +00:00
parent 66e9e99c71
commit 85bd23ada2

View File

@@ -59,8 +59,7 @@ export default {
}
},
computed: {
formatDateTime() {
//console.log("FORMAT DATE TIME");
formatDateTime() {
//debugger;
return this.value
? this.dayjs(this.value).add(this.locale.timeZoneOffset, "hour").format(this.locale.formats.shortDateAndTime)
@@ -77,34 +76,28 @@ export default {
? this.dayjs(this.value)
.add(this.locale.timeZoneOffset, "hour")
.format(this.locale.formats.shortTime)
: "";
//Note in original code this would be parsed expecting source value to be in UTC format coming in but display in local time format
//so
// let momentObj = this.$moment.utc();
// if (this.value) {
// momentObj = this.$moment.utc(this.value);
// }
// return momentObj.local().format("h:mm a");
: "";
},
dateOnly: {
get() {
return this.value ? this.value.substr(0, 10) : null;
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 = value + " " + this.timeOnly;
//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 = value + " " + this.timeOnly;
}
},
timeOnly: {
get() {
return this.value ? this.value.substr(11, 8) : null;
// let momentObj = this.$moment.utc();
// if (this.value) {
// momentObj = this.$moment.utc(this.value);
// }
// return momentObj.local().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) {
this.date = this.dateOnly + " " + 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();
}
}
}