From 263426a7414f293ee049e6fc93e9a10f876d377b Mon Sep 17 00:00:00 2001 From: John Cardinal Date: Mon, 11 Mar 2019 23:04:29 +0000 Subject: [PATCH] --- ayanova/src/api/gzvalidate.js | 25 +++++++++++++++++++ ayanova/src/api/initialize.js | 2 +- ayanova/src/api/locale.js | 3 ++- .../src/components/gzdateandtimepicker.vue | 2 ++ ayanova/src/views/inventory-widget-edit.vue | 1 + 5 files changed, 31 insertions(+), 2 deletions(-) diff --git a/ayanova/src/api/gzvalidate.js b/ayanova/src/api/gzvalidate.js index 0d7a96f8..eee693f5 100644 --- a/ayanova/src/api/gzvalidate.js +++ b/ayanova/src/api/gzvalidate.js @@ -27,5 +27,30 @@ export default { } else { return false; } + }, + After(startDate, endDate) { + if (startDate === undefined || startDate === null) { + return false; + } + + if (endDate === undefined || endDate === null) { + return false; + } + + startDate = dayjs(startDate); + endDate = dayjs(endDate); + + // if either is not valid. + if (!startDate || !endDate) { + return false; + } + + if (startDate.isAfter(endDate)) { + // "ErrorStartDateAfterEndDate": "Start date must be earlier than stop / end date", + var err = locale.get("ErrorStartDateAfterEndDate"); + return err; + } else { + return false; + } } }; diff --git a/ayanova/src/api/initialize.js b/ayanova/src/api/initialize.js index 9ed6f1d7..138de4fa 100644 --- a/ayanova/src/api/initialize.js +++ b/ayanova/src/api/initialize.js @@ -17,7 +17,7 @@ function addNavItem(title, icon, route) { // on change of authentication status export default function initialize() { if (store.state.authenticated) { - //GET ALL DEFAULT LOCALIZED TEXT FOR SHELL + //Fetch the core localized text keys that will always be required by user locale .fetch(locale.coreKeys) .then(function() { diff --git a/ayanova/src/api/locale.js b/ayanova/src/api/locale.js index 74faa698..ccbbd82d 100644 --- a/ayanova/src/api/locale.js +++ b/ayanova/src/api/locale.js @@ -65,7 +65,8 @@ export default { "WikiPage", "Duplicate", "RecordHistory", - "ErrorFieldLengthExceeded" + "ErrorFieldLengthExceeded", + "ErrorStartDateAfterEndDate" ], decimalValidate(required) { return { required: required, decimal: [2, this.formats.decimalSeparator] }; diff --git a/ayanova/src/components/gzdateandtimepicker.vue b/ayanova/src/components/gzdateandtimepicker.vue index 878872ca..b88aeec1 100644 --- a/ayanova/src/components/gzdateandtimepicker.vue +++ b/ayanova/src/components/gzdateandtimepicker.vue @@ -10,6 +10,7 @@ @click:prepend="dlgdate = true" v-model="formatDate" v-bind:label="label" + v-bind:rules="rules" readonly :error="!(!error)" > @@ -65,6 +66,7 @@ export default { data: () => ({ date: null, dlgdate: false, dlgtime: false }), props: { label: String, + rules: Array, value: String, readonly: { type: Boolean, default: false }, error: { diff --git a/ayanova/src/views/inventory-widget-edit.vue b/ayanova/src/views/inventory-widget-edit.vue index 1d53b335..1abea8fb 100644 --- a/ayanova/src/views/inventory-widget-edit.vue +++ b/ayanova/src/views/inventory-widget-edit.vue @@ -78,6 +78,7 @@