This commit is contained in:
2020-02-06 20:34:46 +00:00
parent 2398d04bae
commit ed8b3491ce
2 changed files with 54 additions and 33 deletions

View File

@@ -100,6 +100,10 @@ export default {
oldDate: null,
dlgdate: false,
dlgtime: false,
//cache display format stuff
timeZoneName: window.$gz.locale.getTimeZoneName(),
languageName: window.$gz.locale.getBrowserLanguages(),
hour12: window.$gz.store.state.locale.hour12,
defaultLocale: window.$gz.locale.getBrowserFirstLanguage().split("-", 1)[0],
ampmFormat: window.$gz.locale.format().hour12 ? "ampm" : "24hr"
}),
@@ -138,28 +142,45 @@ export default {
},
computed: {
formatDateTime() {
return this.value
? window.$gz.dayjs
.utc(this.value)
.add(window.$gz.locale.format().timeZoneOffset, "hour")
.format(window.$gz.locale.format().shortDateAndTime)
: "";
return window.$gz.locale.utcDateToShortDateAndTimeLocalized(
this.value,
this.timeZoneName,
this.languageName,
this.hour12
);
// return this.value
// ? window.$gz.dayjs
// .utc(this.value)
// .add(window.$gz.locale.format().timeZoneOffset, "hour")
// .format(window.$gz.locale.format().shortDateAndTime)
// : "";
},
formatDate() {
return this.value
? window.$gz.dayjs
.utc(this.value)
.add(window.$gz.locale.format().timeZoneOffset, "hour")
.format(window.$gz.locale.format().shortDate)
: "";
return window.$gz.locale.utcDateToShortDateLocalized(
this.value,
this.timeZoneName,
this.languageName
);
// return this.value
// ? window.$gz.dayjs
// .utc(this.value)
// .add(window.$gz.locale.format().timeZoneOffset, "hour")
// .format(window.$gz.locale.format().shortDate)
// : "";
},
formatTime() {
return this.value
? window.$gz.dayjs
.utc(this.value)
.add(window.$gz.locale.format().timeZoneOffset, "hour")
.format(window.$gz.locale.format().shortTime)
: "";
return window.$gz.locale.utcDateToShortTimeLocalized(
this.value,
this.timeZoneName,
this.languageName,
this.hour12
);
// return this.value
// ? window.$gz.dayjs
// .utc(this.value)
// .add(window.$gz.locale.format().timeZoneOffset, "hour")
// .format(window.$gz.locale.format().shortTime)
// : "";
},
dateOnly: {
get() {

View File

@@ -450,22 +450,22 @@ function buildRecords(listData, columndefinitions, filters) {
var display = column.v;
switch (dataType) {
case 1: //datetime format to shortdatetime
// display = window.$gz.locale.utcDateToShortDateAndTimeLocalized(
// display,
// timeZoneName,
// languageName,
// hour12
// );
// break;
// case 2: //date only
// display = window.$gz.locale.utcDateToShortDateLocalized(
// display,
// timeZoneName,
// languageName
// );
// break;
display = window.$gz.locale.utcDateToShortDateAndTimeLocalized(
display,
timeZoneName,
languageName,
hour12
);
break;
case 2: //date only
display = window.$gz.locale.utcDateToShortDateLocalized(
display,
timeZoneName,
languageName
);
break;
case 3: //time only
display = display = window.$gz.locale.utcDateToShortTimeLocalized(
display = window.$gz.locale.utcDateToShortTimeLocalized(
display,
timeZoneName,
languageName,