This commit is contained in:
2020-02-07 00:51:36 +00:00
parent 99d37a2d5b
commit ff35bda367
4 changed files with 46 additions and 23 deletions

View File

@@ -747,26 +747,26 @@ export default function initialize() {
);
window.$gz.eventBus.$emit("notify-error", msg);
} else {
//TODO: also need the other locale settings such as number and date formats etc
var localOffset = new Date().getTimezoneOffset();
if (localOffset != 0) {
localOffset = (localOffset / 60) * -1; //time is in minutes and reversed from what we want or expect
}
// //TODO: also need the other locale settings such as number and date formats etc
// var localOffset = new Date().getTimezoneOffset();
// if (localOffset != 0) {
// localOffset = (localOffset / 60) * -1; //time is in minutes and reversed from what we want or expect
// }
if (res.data.timeZoneOffset != localOffset) {
//TODO: localize message and also actually have a fix for it here
//so this should be a confirm prompt but for now will just show it
// if (res.data.timeZoneOffset != localOffset) {
// //TODO: localize message and also actually have a fix for it here
// //so this should be a confirm prompt but for now will just show it
//for now just show the message
window.$gz.eventBus.$emit(
"notify-info",
"Time zone offset for your account is set to " +
res.data.timeZoneOffset +
" which doesn't match the local timezone offset of " +
localOffset,
window.$gz.store.state.helpUrl + "intro/#searching"
);
}
// //for now just show the message
// window.$gz.eventBus.$emit(
// "notify-info",
// "Time zone offset for your account is set to " +
// res.data.timeZoneOffset +
// " which doesn't match the local timezone offset of " +
// localOffset,
// window.$gz.store.state.helpUrl + "intro/#searching"
// );
// }
// window.$gz.eventBus.$emit("notify-success", "Success");
// window.$gz.eventBus.$emit(
@@ -782,7 +782,7 @@ export default function initialize() {
//TODO: also need the other locale settings such as number and date formats etc to be added at server
window.$gz.store.commit("setLocale", {
decimalSeparator: ".",
currencySymbol: "$",
currencyName: "USD",
hour12: true,
// shortDate: "YYYY-MM-DD",
// shortTime: "hh:mm:ss A",

View File

@@ -376,6 +376,24 @@ export default {
});
}
},
///////////////////////////////////////////
// Turn a decimal number into a local
// currency display
//
currencyLocalized(value, languageName, currencyName) {
if (!value) return "";
if (!languageName) {
languageName = this.getBrowserLanguages();
}
if (!currencyName) {
currencyName = window.$gz.store.state.locale.currencyName;
}
return new Intl.NumberFormat(languageName, {
style: "currency",
currency: currencyName
}).format(value);
},
////////////////////////////////////////////////////////
// dynamically set the vuetify language elements from
// users localized text (am/pm etc)