This commit is contained in:
@@ -49,6 +49,7 @@ SHELL / NAV / MENUS / LAYOUT
|
|||||||
|
|
||||||
TODO: LOCALIZATION
|
TODO: LOCALIZATION
|
||||||
- ACTIONS
|
- ACTIONS
|
||||||
|
- AM PM or 24 hour time sb a setting in locale
|
||||||
- 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
|
||||||
|
|||||||
@@ -784,11 +784,11 @@ export default function initialize() {
|
|||||||
window.$gz.store.commit("setLocale", {
|
window.$gz.store.commit("setLocale", {
|
||||||
decimalSeparator: ".",
|
decimalSeparator: ".",
|
||||||
currencySymbol: "$",
|
currencySymbol: "$",
|
||||||
shortDate: "YYYY-MM-DD",
|
hour12: false,
|
||||||
shortTime: "hh:mm:ss A",
|
// shortDate: "YYYY-MM-DD",
|
||||||
shortDateAndTime: "YYYY-MM-DD hh:mm:ss A",
|
// shortTime: "hh:mm:ss A",
|
||||||
timeZoneOffset: res.data.timeZoneOffset,
|
// shortDateAndTime: "YYYY-MM-DD hh:mm:ss A",
|
||||||
tag: res.data.tag || "en-US"
|
timeZoneOffset: res.data.timeZoneOffset
|
||||||
});
|
});
|
||||||
|
|
||||||
resolve();
|
resolve();
|
||||||
|
|||||||
@@ -14,7 +14,12 @@
|
|||||||
:error="!!error"
|
:error="!!error"
|
||||||
></v-text-field>
|
></v-text-field>
|
||||||
</template>
|
</template>
|
||||||
<v-time-picker scrollable ampm-in-title v-model="timeOnly">
|
<v-time-picker
|
||||||
|
scrollable
|
||||||
|
ampm-in-title
|
||||||
|
:format="24hr"
|
||||||
|
v-model="timeOnly"
|
||||||
|
>
|
||||||
<v-spacer></v-spacer>
|
<v-spacer></v-spacer>
|
||||||
<v-btn text color="primary" @click="dlgtime = false">{{
|
<v-btn text color="primary" @click="dlgtime = false">{{
|
||||||
lt("OK")
|
lt("OK")
|
||||||
@@ -52,7 +57,12 @@ export default {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
data: () => ({ date: null, oldDate: null, dlgtime: false }),
|
data: () => ({
|
||||||
|
date: null,
|
||||||
|
oldDate: null,
|
||||||
|
dlgtime: false,
|
||||||
|
ampmFormat: "ampm" //or "24hr"
|
||||||
|
}),
|
||||||
props: {
|
props: {
|
||||||
label: String,
|
label: String,
|
||||||
rules: Array,
|
rules: Array,
|
||||||
|
|||||||
@@ -147,14 +147,21 @@ Vue.filter("capitalize", function vueFilterCapitalize(value) {
|
|||||||
return value.charAt(0).toUpperCase() + value.slice(1);
|
return value.charAt(0).toUpperCase() + value.slice(1);
|
||||||
});
|
});
|
||||||
|
|
||||||
//Convert date to localized value and return as short date format chosen
|
//Convert date to offset value and return as short date time based on browser format
|
||||||
Vue.filter("shortdatelocalized", function vueFilterShortDateLocalized(value) {
|
Vue.filter("shortdatelocalized", function vueFilterShortDateAndTimeLocalized(
|
||||||
|
value
|
||||||
|
) {
|
||||||
if (!value) return "";
|
if (!value) return "";
|
||||||
|
|
||||||
return dayjs
|
var localizedDate = dayjs
|
||||||
.utc(value)
|
.utc(value)
|
||||||
.add(locale.format().timeZoneOffset, "hour")
|
.add(locale.format().timeZoneOffset, "hour")
|
||||||
.format(locale.format().shortDateAndTime);
|
.toDate();
|
||||||
|
return localizedDate.toLocaleString(undefined, {
|
||||||
|
dateStyle: "short",
|
||||||
|
timeStyle: "short",
|
||||||
|
hour12: locale.format().hour12
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
//Convert date to localized value and return as short date format chosen
|
//Convert date to localized value and return as short date format chosen
|
||||||
@@ -176,7 +183,8 @@ Vue.filter("shorttimeonlylocalized", function vueFilterShortTimeOnlyLocalized(
|
|||||||
) {
|
) {
|
||||||
//TODO NOT DONE
|
//TODO NOT DONE
|
||||||
if (!value) return "";
|
if (!value) return "";
|
||||||
|
//new Date().toLocaleString(undefined,{dateStyle:"short",timeStyle:"short",hour12:false})
|
||||||
|
//also toLocaleDateString and toLocaleTimeString well supported use similar options
|
||||||
return dayjs
|
return dayjs
|
||||||
.utc(value)
|
.utc(value)
|
||||||
.add(locale.format().timeZoneOffset, "hour")
|
.add(locale.format().timeZoneOffset, "hour")
|
||||||
|
|||||||
@@ -24,9 +24,10 @@ export default new Vuex.Store({
|
|||||||
tag: "en-US",
|
tag: "en-US",
|
||||||
decimalSeparator: ".",
|
decimalSeparator: ".",
|
||||||
currencySymbol: "$",
|
currencySymbol: "$",
|
||||||
shortDate: "YYYY-MM-DD",
|
hour12: true,
|
||||||
shortTime: "hh:mm:ss A",
|
// shortDate: "YYYY-MM-DD",
|
||||||
shortDateAndTime: "YYYY-MM-DD hh:mm:ss A",
|
// shortTime: "hh:mm:ss A",
|
||||||
|
// shortDateAndTime: "YYYY-MM-DD hh:mm:ss A",
|
||||||
timeZoneOffset: -7 //timeZoneOffset is in decimal hours
|
timeZoneOffset: -7 //timeZoneOffset is in decimal hours
|
||||||
},
|
},
|
||||||
navItems: [],
|
navItems: [],
|
||||||
@@ -60,9 +61,10 @@ export default new Vuex.Store({
|
|||||||
state.locale.tag = "en-US";
|
state.locale.tag = "en-US";
|
||||||
state.locale.decimalSeparator = ".";
|
state.locale.decimalSeparator = ".";
|
||||||
state.locale.currencySymbol = "$";
|
state.locale.currencySymbol = "$";
|
||||||
state.locale.shortDate = "YYYY-MM-DD";
|
state.locale.hour12 = true;
|
||||||
state.locale.shortTime = "hh:mm:ss A";
|
// state.locale.shortDate = "YYYY-MM-DD";
|
||||||
state.locale.shortDateAndTime = "YYYY-MM-DD hh:mm:ss A";
|
// state.locale.shortTime = "hh:mm:ss A";
|
||||||
|
// state.locale.shortDateAndTime = "YYYY-MM-DD hh:mm:ss A";
|
||||||
state.locale.timeZoneOffset = -7;
|
state.locale.timeZoneOffset = -7;
|
||||||
},
|
},
|
||||||
addNavItem(state, data) {
|
addNavItem(state, data) {
|
||||||
@@ -80,9 +82,10 @@ export default new Vuex.Store({
|
|||||||
// mutate state
|
// mutate state
|
||||||
state.locale.decimalSeparator = data.decimalSeparator;
|
state.locale.decimalSeparator = data.decimalSeparator;
|
||||||
state.locale.currencySymbol = data.currencySymbol;
|
state.locale.currencySymbol = data.currencySymbol;
|
||||||
state.locale.shortDate = data.shortDate;
|
state.locale.hour12 = data.hour12;
|
||||||
state.locale.shortTime = data.shortTime;
|
// state.locale.shortDate = data.shortDate;
|
||||||
state.locale.shortDateAndTime = data.shortDateAndTime;
|
// state.locale.shortTime = data.shortTime;
|
||||||
|
// state.locale.shortDateAndTime = data.shortDateAndTime;
|
||||||
state.locale.timeZoneOffset = data.timeZoneOffset;
|
state.locale.timeZoneOffset = data.timeZoneOffset;
|
||||||
state.locale.tag = data.tag;
|
state.locale.tag = data.tag;
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user