diff --git a/ayanova/src/components/gzdateandtimepicker.vue b/ayanova/src/components/gzdateandtimepicker.vue index 41cd9fa8..4af2fcca 100644 --- a/ayanova/src/components/gzdateandtimepicker.vue +++ b/ayanova/src/components/gzdateandtimepicker.vue @@ -47,7 +47,7 @@ export default { label: String, value: String, readonly: { type: Boolean, default: false }, - dayjs: Function, + //dayjs: Function, locale: Object }, watch: { @@ -62,42 +62,42 @@ export default { formatDateTime() { //debugger; return this.value - ? this.dayjs(this.value).add(this.locale.timeZoneOffset, "hour").format(this.locale.formats.shortDateAndTime) + ? this.$dayjs(this.value).add(this.locale.timeZoneOffset, "hour").format(this.locale.formats.shortDateAndTime) : ""; }, formatDate() { return this.value - ? this.dayjs(this.value).add(this.locale.timeZoneOffset, "hour").format(this.locale.formats.shortDate) + ? this.$dayjs(this.value).add(this.locale.timeZoneOffset, "hour").format(this.locale.formats.shortDate) : ""; }, formatTime() { //debugger; return this.value - ? this.dayjs(this.value) + ? this.$dayjs(this.value) .add(this.locale.timeZoneOffset, "hour") .format(this.locale.formats.shortTime) : ""; }, dateOnly: { get() { - return this.dayjs(this.value).add(this.locale.timeZoneOffset, "hour").format("YYYY-MM-DD"); + return this.$dayjs(this.value).add(this.locale.timeZoneOffset, "hour").format("YYYY-MM-DD"); //return this.value ? this.value.substr(0, 10) : null; }, set(value) { //this .date is always utc so convert back here before setting or all hell will break loose! - this.date = this.dayjs(value + " " + this.timeOnly).subtract(this.locale.timeZoneOffset, "hour").toISOString(); + this.date = this.$dayjs(value + " " + this.timeOnly).subtract(this.locale.timeZoneOffset, "hour").toISOString(); //this.date = value + " " + this.timeOnly; } }, timeOnly: { get() { - return this.dayjs(this.value).add(this.locale.timeZoneOffset, "hour").format("HH:mm:ss"); + return this.$dayjs(this.value).add(this.locale.timeZoneOffset, "hour").format("HH:mm:ss"); //return this.value ? this.value.substr(11, 8) : null; }, set(value) { //debugger; //this .date is always utc so convert back here before setting or all hell will break loose! - this.date = this.dayjs(this.dateOnly + " " + value).subtract(this.locale.timeZoneOffset, "hour").toISOString(); + this.date = this.$dayjs(this.dateOnly + " " + value).subtract(this.locale.timeZoneOffset, "hour").toISOString(); } } } diff --git a/ayanova/src/main.js b/ayanova/src/main.js index 1e735c20..02f9ebe3 100644 --- a/ayanova/src/main.js +++ b/ayanova/src/main.js @@ -13,6 +13,12 @@ import "nprogress/nprogress.css"; import dayjs from "dayjs"; import gzdateandtimepicker from "./components/gzdateandtimepicker.vue"; +///////////////////////////////////////////////////////////////// +// LIBS +// (https://medium.com/js-dojo/use-any-javascript-library-with-vue-js-3f7e2a4974a8) +// +Object.defineProperty(Vue.prototype, "$dayjs", { value: dayjs }); + ///////////////////////////////////////////////////////////////// // FORM VALIDATION // diff --git a/ayanova/src/views/inventory-widget-edit.vue b/ayanova/src/views/inventory-widget-edit.vue index 9b93d201..a8f4de07 100644 --- a/ayanova/src/views/inventory-widget-edit.vue +++ b/ayanova/src/views/inventory-widget-edit.vue @@ -50,11 +50,8 @@ - {{ obj.startDate }} - {{ lc.timeZoneOffset }} @@ -94,7 +91,7 @@ //import store from "../store"; import locale from "../api/locale"; import api from "../api/apiutil"; -import dayjs from "dayjs"; +//import dayjs from "dayjs"; //import _ from "../utils/libs/lodash.js"; export default { components: {}, @@ -102,7 +99,7 @@ export default { return { obj: {}, lc: locale, - dayjsLib: dayjs, + // dayjsLib: dayjs, theDate: new Date(), date: new Date().toISOString().substr(0, 10), menu: false,