This commit is contained in:
2021-09-15 22:42:55 +00:00
parent 8584baf01e
commit 8cb5211e55
4 changed files with 97 additions and 99 deletions

View File

@@ -75,6 +75,41 @@ export default {
getHour12() {
return window.$gz.store.state.userOptions.hour12;
},
//////////////////////////////////////////////////
// Get the user's chosen / auto time zone offset
//
getTZOffset(timeZoneName) {
if (!timeZoneName) {
timeZoneName = this.getResolvedTimeZoneName();
}
let dtNow = window.$gz.DateTime.local();
var rezoned = dtNow.setZone(timeZoneName);
return rezoned.offset;
},
// ///////////////////////////////////////////
// // Convert timestamp utc epoch value
// // to local timestamp epoch value
// //
// utcEpochToLocalEpoch(value, timeZoneName) {
// if (!value) {
// return null;
// }
// if (!timeZoneName) {
// timeZoneName = this.getResolvedTimeZoneName();
// }
// let parsedDate = new Date(value);
// //is it a valid date?
// if (!(parsedDate instanceof Date && !isNaN(parsedDate))) {
// return null;
// }
// return parsedDate.toLocaleDateString(languageName, {
// timeZone: timeZoneName,
// dateStyle: "short"
// });
// },
///////////////////////////////////////////
// Turn a utc date into a displayable
// short date and time