This commit is contained in:
2019-12-12 00:16:54 +00:00
parent 1d2ef74b35
commit 007f528bcf
2 changed files with 10 additions and 6 deletions

View File

@@ -74,10 +74,10 @@
{{ props.item.roles }}
</td>
<td class="text-xs-left" @click="editItem(props.item)">
{{ props.item.startDate | shortdate }}
{{ props.item.startDate | shortdatelocalized }}
</td>
<td class="text-xs-left" @click="editItem(props.item)">
{{ props.item.endDate | shortdate }}
{{ props.item.endDate | shortdatelocalized }}
</td>
</tr>
</template>

View File

@@ -10,7 +10,7 @@ import "./registerServiceWorker";
import errorHandler from "./api/errorhandler";
import NProgress from "nprogress";
import "nprogress/nprogress.css";
import dayjs from "dayjs";
import dayjs, { Dayjs } from "dayjs";
import UTC from "dayjs/plugin/utc"; // load on demand
dayjs.extend(UTC); // use plugin
import lodash from "./libs/lodash.min.js";
@@ -144,10 +144,14 @@ Vue.filter("capitalize", function vueFilterCapitalize(value) {
return value.charAt(0).toUpperCase() + value.slice(1);
});
Vue.filter("shortdate", function vueFilterShortDate(value) {
//Convert date to localized value and return as short date format chosen
Vue.filter("shortdatelocalized", function vueFilterShortDateLocalized(value) {
if (!value) return "";
var dj = dayjs(value);
return dj.format("YYYY-MM-DD hh:mm:ss A");
return dayjs
.utc(value)
.add(locale.format().timeZoneOffset, "hour")
.format(locale.format().shortDateAndTime);
});
Vue.filter("currency", function vueFilterCurrency(value) {