This commit is contained in:
@@ -147,14 +147,21 @@ Vue.filter("capitalize", function vueFilterCapitalize(value) {
|
||||
return value.charAt(0).toUpperCase() + value.slice(1);
|
||||
});
|
||||
|
||||
//Convert date to localized value and return as short date format chosen
|
||||
Vue.filter("shortdatelocalized", function vueFilterShortDateLocalized(value) {
|
||||
//Convert date to offset value and return as short date time based on browser format
|
||||
Vue.filter("shortdatelocalized", function vueFilterShortDateAndTimeLocalized(
|
||||
value
|
||||
) {
|
||||
if (!value) return "";
|
||||
|
||||
return dayjs
|
||||
var localizedDate = dayjs
|
||||
.utc(value)
|
||||
.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
|
||||
@@ -176,7 +183,8 @@ Vue.filter("shorttimeonlylocalized", function vueFilterShortTimeOnlyLocalized(
|
||||
) {
|
||||
//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
|
||||
return dayjs
|
||||
.utc(value)
|
||||
.add(locale.format().timeZoneOffset, "hour")
|
||||
|
||||
Reference in New Issue
Block a user