This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user