This commit is contained in:
@@ -59,8 +59,7 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
formatDateTime() {
|
formatDateTime() {
|
||||||
//console.log("FORMAT DATE TIME");
|
|
||||||
//debugger;
|
//debugger;
|
||||||
return this.value
|
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)
|
||||||
@@ -77,34 +76,28 @@ export default {
|
|||||||
? this.dayjs(this.value)
|
? this.dayjs(this.value)
|
||||||
.add(this.locale.timeZoneOffset, "hour")
|
.add(this.locale.timeZoneOffset, "hour")
|
||||||
.format(this.locale.formats.shortTime)
|
.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: {
|
dateOnly: {
|
||||||
get() {
|
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) {
|
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: {
|
timeOnly: {
|
||||||
get() {
|
get() {
|
||||||
return this.value ? this.value.substr(11, 8) : null;
|
return this.dayjs(this.value).add(this.locale.timeZoneOffset, "hour").format("HH:mm:ss");
|
||||||
// let momentObj = this.$moment.utc();
|
//return this.value ? this.value.substr(11, 8) : null;
|
||||||
// if (this.value) {
|
|
||||||
// momentObj = this.$moment.utc(this.value);
|
|
||||||
// }
|
|
||||||
// return momentObj.local().format("HH:mm:ss");
|
|
||||||
},
|
},
|
||||||
set(value) {
|
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();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user