This commit is contained in:
@@ -60,10 +60,10 @@ export default {
|
||||
//debugger;
|
||||
//check pre-requisites exist just in case
|
||||
if (this.$gzdevmode()) {
|
||||
if (!this.$dayjs) {
|
||||
if (!window.$gz.dayjs) {
|
||||
throw "DateTimeControl: the DayJS library is required and missing";
|
||||
}
|
||||
if (!this.$gzlocale) {
|
||||
if (!window.$gz.locale) {
|
||||
throw "DateTimeControl: $gzlocale is required and missing";
|
||||
}
|
||||
}
|
||||
@@ -100,7 +100,7 @@ export default {
|
||||
computed: {
|
||||
formatDateTime() {
|
||||
return this.value
|
||||
? this.$dayjs
|
||||
? window.$gz.dayjs
|
||||
.utc(this.value)
|
||||
.add(this.$gzlocale.format().timeZoneOffset, "hour")
|
||||
.format(this.$gzlocale.format().shortDateAndTime)
|
||||
@@ -108,7 +108,7 @@ export default {
|
||||
},
|
||||
formatDate() {
|
||||
return this.value
|
||||
? this.$dayjs
|
||||
? window.$gz.dayjs
|
||||
.utc(this.value)
|
||||
.add(this.$gzlocale.format().timeZoneOffset, "hour")
|
||||
.format(this.$gzlocale.format().shortDate)
|
||||
@@ -116,7 +116,7 @@ export default {
|
||||
},
|
||||
formatTime() {
|
||||
return this.value
|
||||
? this.$dayjs
|
||||
? window.$gz.dayjs
|
||||
.utc(this.value)
|
||||
.add(this.$gzlocale.format().timeZoneOffset, "hour")
|
||||
.format(this.$gzlocale.format().shortTime)
|
||||
@@ -125,20 +125,21 @@ export default {
|
||||
dateOnly: {
|
||||
get() {
|
||||
//TODO: this will likely need an improvement for forms where there should be an automatic pre-set time chosen like workorder labor;
|
||||
var defaultDateString = this.$dayjs()
|
||||
var defaultDateString = window.$gz
|
||||
.dayjs()
|
||||
.utc()
|
||||
.add(this.$gzlocale.format().timeZoneOffset, "hour")
|
||||
.format("YYYY-MM-DD");
|
||||
|
||||
return this.value
|
||||
? this.$dayjs
|
||||
? window.$gz.dayjs
|
||||
.utc(this.value)
|
||||
.add(this.$gzlocale.format().timeZoneOffset, "hour")
|
||||
.format("YYYY-MM-DD")
|
||||
: defaultDateString;
|
||||
},
|
||||
set(value) {
|
||||
this.date = this.$dayjs
|
||||
this.date = window.$gz.dayjs
|
||||
.utc(value + " " + this.timeOnly)
|
||||
.subtract(this.$gzlocale.format().timeZoneOffset, "hour")
|
||||
.toISOString();
|
||||
@@ -147,20 +148,20 @@ export default {
|
||||
timeOnly: {
|
||||
get() {
|
||||
//TODO: this will likely need an improvement for forms where there should be an automatic pre-set time chosen like workorder labor;
|
||||
var defaultTimeString = this.$dayjs
|
||||
var defaultTimeString = window.$gz.dayjs
|
||||
.utc()
|
||||
.add(this.$gzlocale.format().timeZoneOffset, "hour")
|
||||
.format("HH:mm:ss");
|
||||
|
||||
return this.value
|
||||
? this.$dayjs
|
||||
? window.$gz.dayjs
|
||||
.utc(this.value)
|
||||
.add(this.$gzlocale.format().timeZoneOffset, "hour")
|
||||
.format("HH:mm:ss")
|
||||
: defaultTimeString;
|
||||
},
|
||||
set(value) {
|
||||
this.date = this.$dayjs
|
||||
this.date = window.$gz.dayjs
|
||||
.utc(this.dateOnly + " " + value)
|
||||
.subtract(this.$gzlocale.format().timeZoneOffset, "hour")
|
||||
.toISOString();
|
||||
|
||||
Reference in New Issue
Block a user