This commit is contained in:
2019-07-19 19:16:25 +00:00
parent 5ed7fa8f0e
commit 177f08f49d
4 changed files with 19 additions and 18 deletions

View File

@@ -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();