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 }} {{ props.item.roles }}
</td> </td>
<td class="text-xs-left" @click="editItem(props.item)"> <td class="text-xs-left" @click="editItem(props.item)">
{{ props.item.startDate | shortdate }} {{ props.item.startDate | shortdatelocalized }}
</td> </td>
<td class="text-xs-left" @click="editItem(props.item)"> <td class="text-xs-left" @click="editItem(props.item)">
{{ props.item.endDate | shortdate }} {{ props.item.endDate | shortdatelocalized }}
</td> </td>
</tr> </tr>
</template> </template>

View File

@@ -10,7 +10,7 @@ import "./registerServiceWorker";
import errorHandler from "./api/errorhandler"; import errorHandler from "./api/errorhandler";
import NProgress from "nprogress"; import NProgress from "nprogress";
import "nprogress/nprogress.css"; import "nprogress/nprogress.css";
import dayjs from "dayjs"; import dayjs, { Dayjs } from "dayjs";
import UTC from "dayjs/plugin/utc"; // load on demand import UTC from "dayjs/plugin/utc"; // load on demand
dayjs.extend(UTC); // use plugin dayjs.extend(UTC); // use plugin
import lodash from "./libs/lodash.min.js"; 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); 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 ""; 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) { Vue.filter("currency", function vueFilterCurrency(value) {