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

View File

@@ -60,7 +60,6 @@ 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)
@@ -78,33 +77,27 @@ export default {
.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();
} }
} }
} }