This commit is contained in:
@@ -64,7 +64,7 @@ export default {
|
||||
throw "DateTimeControl: the DayJS library is required and missing";
|
||||
}
|
||||
if (!window.$gz.locale) {
|
||||
throw "DateTimeControl: $gzlocale is required and missing";
|
||||
throw "DateTimeControl: $gz.locale is required and missing";
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -102,24 +102,24 @@ export default {
|
||||
return this.value
|
||||
? window.$gz.dayjs
|
||||
.utc(this.value)
|
||||
.add(this.$gzlocale.format().timeZoneOffset, "hour")
|
||||
.format(this.$gzlocale.format().shortDateAndTime)
|
||||
.add(window.$gz.locale.format().timeZoneOffset, "hour")
|
||||
.format(window.$gz.locale.format().shortDateAndTime)
|
||||
: "";
|
||||
},
|
||||
formatDate() {
|
||||
return this.value
|
||||
? window.$gz.dayjs
|
||||
.utc(this.value)
|
||||
.add(this.$gzlocale.format().timeZoneOffset, "hour")
|
||||
.format(this.$gzlocale.format().shortDate)
|
||||
.add(window.$gz.locale.format().timeZoneOffset, "hour")
|
||||
.format(window.$gz.locale.format().shortDate)
|
||||
: "";
|
||||
},
|
||||
formatTime() {
|
||||
return this.value
|
||||
? window.$gz.dayjs
|
||||
.utc(this.value)
|
||||
.add(this.$gzlocale.format().timeZoneOffset, "hour")
|
||||
.format(this.$gzlocale.format().shortTime)
|
||||
.add(window.$gz.locale.format().timeZoneOffset, "hour")
|
||||
.format(window.$gz.locale.format().shortTime)
|
||||
: "";
|
||||
},
|
||||
dateOnly: {
|
||||
@@ -128,20 +128,20 @@ export default {
|
||||
var defaultDateString = window.$gz
|
||||
.dayjs()
|
||||
.utc()
|
||||
.add(this.$gzlocale.format().timeZoneOffset, "hour")
|
||||
.add(window.$gz.locale.format().timeZoneOffset, "hour")
|
||||
.format("YYYY-MM-DD");
|
||||
|
||||
return this.value
|
||||
? window.$gz.dayjs
|
||||
.utc(this.value)
|
||||
.add(this.$gzlocale.format().timeZoneOffset, "hour")
|
||||
.add(window.$gz.locale.format().timeZoneOffset, "hour")
|
||||
.format("YYYY-MM-DD")
|
||||
: defaultDateString;
|
||||
},
|
||||
set(value) {
|
||||
this.date = window.$gz.dayjs
|
||||
.utc(value + " " + this.timeOnly)
|
||||
.subtract(this.$gzlocale.format().timeZoneOffset, "hour")
|
||||
.subtract(window.$gz.locale.format().timeZoneOffset, "hour")
|
||||
.toISOString();
|
||||
}
|
||||
},
|
||||
@@ -150,20 +150,20 @@ export default {
|
||||
//TODO: this will likely need an improvement for forms where there should be an automatic pre-set time chosen like workorder labor;
|
||||
var defaultTimeString = window.$gz.dayjs
|
||||
.utc()
|
||||
.add(this.$gzlocale.format().timeZoneOffset, "hour")
|
||||
.add(window.$gz.locale.format().timeZoneOffset, "hour")
|
||||
.format("HH:mm:ss");
|
||||
|
||||
return this.value
|
||||
? window.$gz.dayjs
|
||||
.utc(this.value)
|
||||
.add(this.$gzlocale.format().timeZoneOffset, "hour")
|
||||
.add(window.$gz.locale.format().timeZoneOffset, "hour")
|
||||
.format("HH:mm:ss")
|
||||
: defaultTimeString;
|
||||
},
|
||||
set(value) {
|
||||
this.date = window.$gz.dayjs
|
||||
.utc(this.dateOnly + " " + value)
|
||||
.subtract(this.$gzlocale.format().timeZoneOffset, "hour")
|
||||
.subtract(window.$gz.locale.format().timeZoneOffset, "hour")
|
||||
.toISOString();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user