This commit is contained in:
2020-02-06 23:50:06 +00:00
parent fe206f5c87
commit 6ac4bf58fe
2 changed files with 33 additions and 34 deletions

View File

@@ -338,6 +338,23 @@ export default {
});
}
},
///////////////////////////////////////////////
// Convert a local time only string with date string
// to UTC and output as ISO 8601
// (used by time and date picker components)
//
localTimeDateStringToUTC8601String(value, timeZoneName) {
//https://moment.github.io/luxon/docs/manual/zones.html#creating-datetimes-in-a-zone
if (!timeZoneName) {
timeZoneName = this.getTimeZoneName();
}
//parse in the time in the currently used timezone
return window.$gz.DateTime.fromISO(value, {
zone: this.timeZoneName
})
.setZone("utc") //convert to UTC
.toISO(); //output as ISO 8601
},
////////////////////////////////////////////////////////
// dynamically set the vuetify language elements from
// users localized text (am/pm etc)