This commit is contained in:
@@ -75,6 +75,8 @@ TODO: LOCALIZATION
|
|||||||
- Make functional user settings form so can test shit out
|
- Make functional user settings form so can test shit out
|
||||||
- Need override for locale, currency setting, 12hr clock etc etc
|
- Need override for locale, currency setting, 12hr clock etc etc
|
||||||
|
|
||||||
|
- Need a browser check on opening the login page that will check to ensure the browser can do the date conversions properly etc and tell user browser is unsuitable if it isn't
|
||||||
|
|
||||||
- TRY AN ALTERNATE LANGUAGE IN VUETIFY USING THEIR METHOD, SEE WHATS INVOLVED
|
- TRY AN ALTERNATE LANGUAGE IN VUETIFY USING THEIR METHOD, SEE WHATS INVOLVED
|
||||||
- Find out how to override the default locale for vuetify to set specific items to our localized text version
|
- Find out how to override the default locale for vuetify to set specific items to our localized text version
|
||||||
- this saves having to use a whole locale for just the calendar etc
|
- this saves having to use a whole locale for just the calendar etc
|
||||||
|
|||||||
@@ -214,6 +214,7 @@ export default {
|
|||||||
///////////////////////////////////////////
|
///////////////////////////////////////////
|
||||||
// Get users default time zone
|
// Get users default time zone
|
||||||
//https://www.iana.org/time-zones
|
//https://www.iana.org/time-zones
|
||||||
|
//https://en.wikipedia.org/wiki/List_of_tz_database_time_zones
|
||||||
getTimeZoneName() {
|
getTimeZoneName() {
|
||||||
return Intl.DateTimeFormat().resolvedOptions().timeZone;
|
return Intl.DateTimeFormat().resolvedOptions().timeZone;
|
||||||
},
|
},
|
||||||
@@ -316,6 +317,27 @@ export default {
|
|||||||
hour12: hour12
|
hour12: hour12
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
///////////////////////////////////////////////
|
||||||
|
// Convert a utc date to local time zone
|
||||||
|
// and return time portion only in iso 8601
|
||||||
|
// format (used by time and date picker components)
|
||||||
|
//
|
||||||
|
utcDateStringTo8601TimeOnlyString(value, timeZoneName) {
|
||||||
|
if (!value) {
|
||||||
|
//if no value, return the current time as expected by the time picker
|
||||||
|
} else {
|
||||||
|
//ok, the reason for sv-SE is that it's a locale that returns the time already in ISO format and 24hr by default
|
||||||
|
//that can change over time so if this breaks that's why
|
||||||
|
//also fr-CA does as well as possibly en-CA
|
||||||
|
//https://stackoverflow.com/a/58633686/8939
|
||||||
|
if (!timeZoneName) {
|
||||||
|
timeZoneName = this.getTimeZoneName();
|
||||||
|
}
|
||||||
|
return new Date(value).toLocaleTimeString("sv-SE", {
|
||||||
|
timeZone: timeZoneName
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////
|
||||||
// dynamically set the vuetify language elements from
|
// dynamically set the vuetify language elements from
|
||||||
// users localized text (am/pm etc)
|
// users localized text (am/pm etc)
|
||||||
|
|||||||
@@ -229,16 +229,20 @@ export default {
|
|||||||
//-----------------
|
//-----------------
|
||||||
//expects just the hours minutes seconds portion: 18:18:49
|
//expects just the hours minutes seconds portion: 18:18:49
|
||||||
//TODO: Need to convert to desired time zone first or the control will show the UTC time instead
|
//TODO: Need to convert to desired time zone first or the control will show the UTC time instead
|
||||||
|
//console.log(new Date().toLocaleTimeString('sv-SE',{timeZone:"America/Vancouver"}));
|
||||||
|
//console.log(new Date().toLocaleTimeString('sv-SE',{timeZone:"UTC"}));
|
||||||
get() {
|
get() {
|
||||||
if (this.value) {
|
if (this.value) {
|
||||||
console.log(this.value.substr(11, 8));
|
//Ok, this looks weird but sv-SE is the same format as iso8601 format required so if this breaks that's why
|
||||||
return this.value.substr(11, 8);
|
return new Date(this.value).toLocaleTimeString("sv-SE", {
|
||||||
|
timeZone: this.timeZoneName
|
||||||
|
});
|
||||||
} else {
|
} else {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
set(value) {
|
set(value) {
|
||||||
this.value = value;
|
//this.value = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user