This commit is contained in:
2020-02-06 20:27:20 +00:00
parent b9d87afcfc
commit 7c8308f149
3 changed files with 48 additions and 51 deletions

View File

@@ -282,6 +282,38 @@ export default {
timeZone: timeZoneName,
dateStyle: "short"
});
}, ///////////////////////////////////////////
// Turn a utc date into a displayable
// short time
//
utcDateToShortTimeLocalized(value, timeZoneName, languageName, hour12) {
if (!value) {
return "";
}
if (!timeZoneName) {
timeZoneName = this.getTimeZoneName();
}
if (!languageName) {
languageName = this.getBrowserLanguages();
}
if (!hour12) {
hour12 = window.$gz.store.state.locale.hour12;
}
//parse the date which is identified as utc ("2020-02-06T18:18:49.148011Z")
var parsedDate = new Date(value);
//is it a valid date?
if (!(parsedDate instanceof Date && !isNaN(parsedDate))) {
return "not valid";
}
return parsedDate.toLocaleTimeString(languageName, {
timeZone: timeZoneName,
timeStyle: "short",
hour12: hour12
});
},
////////////////////////////////////////////////////////
// dynamically set the vuetify language elements from