This commit is contained in:
2019-03-11 23:04:29 +00:00
parent 1b0becca01
commit 263426a741
5 changed files with 31 additions and 2 deletions

View File

@@ -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;
}
}
};

View File

@@ -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() {

View File

@@ -65,7 +65,8 @@ export default {
"WikiPage",
"Duplicate",
"RecordHistory",
"ErrorFieldLengthExceeded"
"ErrorFieldLengthExceeded",
"ErrorStartDateAfterEndDate"
],
decimalValidate(required) {
return { required: required, decimal: [2, this.formats.decimalSeparator] };

View File

@@ -10,6 +10,7 @@
@click:prepend="dlgdate = true"
v-model="formatDate"
v-bind:label="label"
v-bind:rules="rules"
readonly
:error="!(!error)"
></v-text-field>
@@ -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: {

View File

@@ -78,6 +78,7 @@
<v-flex xs12 sm6 lg4 xl3 px-2>
<gz-date-time-picker
:label="this.$gzlocale.get('WidgetEndDate')"
:rules="[this.$gzv.After(obj.startDate,obj.endDate)]"
v-model="obj.endDate"
name="endDate"
></gz-date-time-picker>