This commit is contained in:
2020-02-06 20:27:20 +00:00
parent b9d87afcfc
commit 7c8308f149
3 changed files with 48 additions and 51 deletions

View File

@@ -149,46 +149,6 @@ Vue.filter("capitalize", function vueFilterCapitalize(value) {
//Convert date to localized value and return as short date format chosen
Vue.filter("shortdateonlylocalized", function vueFilterShortDateOnlyLocalized(
value
) {
//TODO NOT DONE
if (!value) return "";
var localizedDate = dayjs
.utc(value)
.add(locale.format().timeZoneOffset, "hour")
.toDate();
return localizedDate.toLocaleDateString(
window.$gz.locale.getBrowserLanguages(),
{
dateStyle: "short"
}
);
});
//Convert date to localized value and return as short date format chosen
Vue.filter("shorttimeonlylocalized", function vueFilterShortTimeOnlyLocalized(
value
) {
//TODO NOT DONE
if (!value) return "";
//new Date().toLocaleString(undefined,{dateStyle:"short",timeStyle:"short",hour12:false})
//also toLocaleDateString and toLocaleTimeString well supported use similar options
var localizedDate = dayjs
.utc(value)
.add(locale.format().timeZoneOffset, "hour")
.toDate();
return localizedDate.toLocaleTimeString(
window.$gz.locale.getBrowserLanguages(),
{
timeStyle: "short",
hour12: locale.format().hour12
}
);
});
//https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/toLocaleString#Browser_compatibility
//https://www.currency-iso.org/en/home.html