This commit is contained in:
@@ -76,9 +76,9 @@ export default {
|
||||
return window.$gz.store.state.userOptions.hour12;
|
||||
},
|
||||
|
||||
///////////////////////////////////////////
|
||||
// Turn a utc date into a vueitfy calendar
|
||||
// schedule control compatible format
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
// Turn a utc ISO date from server into a vuetify calendar
|
||||
// schedule control compatible (epoch) format
|
||||
// localized.
|
||||
// For ease of use in schedule the epoch (milliseconds) is the best format
|
||||
// "It must be a Date, number of seconds since Epoch, or a string in the format of YYYY-MM-DD or YYYY-MM-DD hh:mm. Zero-padding is optional and seconds are ignored.""
|
||||
@@ -94,12 +94,40 @@ export default {
|
||||
return null;
|
||||
}
|
||||
|
||||
return new Date(
|
||||
//sv-SE is iso-8601 format so cleanest to parse accurately
|
||||
new Date(value).toLocaleString("sv-SE", {
|
||||
timeZone: timeZoneName
|
||||
})
|
||||
).getTime();
|
||||
//Not sure what all the parsing was about below, but
|
||||
//if it comes from teh server in iso standard format and ends in '...z' for zulu / utc time
|
||||
//then not sure what the parsing is needed for as this would output the same epoch value as that's independant of anything
|
||||
//I'm thinking I meant to adjust to a new epoch value by offset so need to test this with a forced alternate time zone
|
||||
return new Date(value).getTime();
|
||||
|
||||
// //convert to locale timezone and output in the closest thing to iso-8601 format
|
||||
// let tmp = new Date(value).toLocaleString("sv-SE", {
|
||||
// timeZone: timeZoneName
|
||||
// });
|
||||
// tmp = tmp.replace(" ", "T");
|
||||
// let ret = new Date(
|
||||
// tmp
|
||||
// //sv-SE is iso-8601 format so cleanest to parse accurately
|
||||
// //bugbug: potential bug here, sv-sE not working on iPad??
|
||||
// //this always seemed sketchy, how to replace with something
|
||||
// //less flakey??
|
||||
// // new Date(value).toLocaleString("sv-SE", {
|
||||
// // timeZone: timeZoneName
|
||||
// // })
|
||||
// ).getTime();
|
||||
|
||||
// window.$gz.store.commit(
|
||||
// "logItem",
|
||||
// `utcDateToScheduleCompatibleFormatLocalized:${JSON.stringify({
|
||||
// value: value,
|
||||
// timeZoneName: timeZoneName,
|
||||
// tmp: tmp,
|
||||
// ret: ret,
|
||||
// newTest: newtest
|
||||
// })}`
|
||||
// );
|
||||
|
||||
// return ret;
|
||||
},
|
||||
///////////////////////////////////////////////
|
||||
// Convert a local schedule epoch timestamp
|
||||
@@ -294,6 +322,7 @@ export default {
|
||||
///////////////////////////////////////////////
|
||||
// Convert a local time only string with date string
|
||||
// to UTC and output as ISO 8601
|
||||
// also converts to time zone specified if diff from browser
|
||||
// (used by time and date picker components)
|
||||
//
|
||||
localTimeDateStringToUTC8601String(value, timeZoneName) {
|
||||
|
||||
Reference in New Issue
Block a user