This commit is contained in:
2020-02-07 00:01:57 +00:00
parent c7daec159a
commit 2e05fd48fa
2 changed files with 59 additions and 19 deletions

View File

@@ -181,33 +181,52 @@ 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 = window.$gz
.dayjs()
.utc()
.add(window.$gz.locale.format().timeZoneOffset, "hour")
.format("YYYY-MM-DD");
//----------------------------
// 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 = window.$gz
// .dayjs()
// .utc()
// .add(window.$gz.locale.format().timeZoneOffset, "hour")
// .format("YYYY-MM-DD");
return this.value
? window.$gz.dayjs
.utc(this.value)
.add(window.$gz.locale.format().timeZoneOffset, "hour")
.format("YYYY-MM-DD")
: defaultDateString;
// return this.value
// ? window.$gz.dayjs
// .utc(this.value)
// .add(window.$gz.locale.format().timeZoneOffset, "hour")
// .format("YYYY-MM-DD")
// : defaultDateString;
// },
// set(value) {
// this.date = window.$gz.dayjs
// .utc(value + " " + this.timeOnly)
// .subtract(window.$gz.locale.format().timeZoneOffset, "hour")
// .toISOString();
// }
//---------------------------
get() {
//TODO: return date only portion converted to local working time zone: YYYY-MM-DD
var v = window.$gz.locale.utcDateStringToLocal8601DateOnlyString(
this.value,
this.timeZoneName
);
console.log(this.value);
console.log(v);
return v;
},
set(value) {
this.date = window.$gz.dayjs
.utc(value + " " + this.timeOnly)
.subtract(window.$gz.locale.format().timeZoneOffset, "hour")
.toISOString();
this.date = window.$gz.locale.localTimeDateStringToUTC8601String(
value + "T" + this.timeOnly,
this.timeZoneName
);
}
},
timeOnly: {
//expects just the hours minutes seconds portion: 18:18:49
//Needs to convert into and out of the desired time zone or the control will show the UTC time instead
get() {
return window.$gz.locale.utcDateStringTo8601TimeOnlyString(
return window.$gz.locale.utcDateStringToLocal8601TimeOnlyString(
this.value,
this.timeZoneName
);