This commit is contained in:
2020-02-06 20:25:05 +00:00
parent c3ead923d9
commit b9d87afcfc
3 changed files with 32 additions and 37 deletions

View File

@@ -255,6 +255,33 @@ export default {
timeStyle: "short",
hour12: hour12
});
}, ///////////////////////////////////////////
// Turn a utc date into a displayable
// short date
//
utcDateToShortDateLocalized(value, timeZoneName, languageName) {
if (!value) {
return "";
}
if (!timeZoneName) {
timeZoneName = this.getTimeZoneName();
}
if (!languageName) {
languageName = this.getBrowserLanguages();
}
//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.toLocaleDateString(languageName, {
timeZone: timeZoneName,
dateStyle: "short"
});
},
////////////////////////////////////////////////////////
// dynamically set the vuetify language elements from