Update ShippingStepComponenet.vue. fixing datepicker validation month logic

This commit is contained in:
ayen
2019-04-16 03:12:41 +00:00
parent b1d927b0c7
commit ac4cae37ca
@@ -140,10 +140,10 @@
</div>
</modal-component>
<confirm-modal-component v-if="arrangementExist"
title="Arrived To Port"
:message="'Are you sure this order has arrived to port?'"
type="shippingComplete"
v-on:confirm="completeShipping()"></confirm-modal-component>
title="Arrived To Port"
:message="'Are you sure this order has arrived to port?'"
type="shippingComplete"
v-on:confirm="completeShipping()"></confirm-modal-component>
</div>
</template>
@@ -179,6 +179,7 @@
}
},
mounted: function() {
this.validateMethod();
this.dataValidation();
},
created(){
@@ -189,6 +190,11 @@
}
},
methods: {
validateMethod() {
$.validator.addMethod("minDate", function(value, element, params) {
return (moment(value, "DD-MM-YYYY") > moment(params, "DD-MM-YYYY"))
});
},
dataValidation() {
$(this.$el).find('.shippingForm').validate({
rules: {
@@ -199,7 +205,7 @@
},
messages: {
ETA: {
min : 'ETA must be greater than ETD'
minDate : 'ETA must be greater than ETD'
}
},
errorPlacement: function ( error, element ) {
@@ -227,7 +233,7 @@
},
messages: {
ETA: {
min : 'ETA must be greater than ETD'
minDate : 'ETA must be greater than ETD'
}
},
errorPlacement: function ( error, element ) {
@@ -252,7 +258,7 @@
$(this.$el).find('.shippingForm').valid();
this.shippingArrangement.schedule.ETD = date;
$(this.$el).find('.shippingForm .ETA').rules("add", {
min: moment(this.shippingArrangement.schedule.ETD, "DD-MM-YYYY").add(1, 'days').format('DD-MM-YYYY')
minDate: moment(this.shippingArrangement.schedule.ETD, "DD-MM-YYYY").add(1, 'days').format('DD-MM-YYYY')
})
}
@@ -269,7 +275,7 @@
$(this.$el).find('.rescheduleShipping').valid();
this.reschedule.ETD = date;
$(this.$el).find('.rescheduleShipping .ETA').rules("add", {
min: moment(this.reschedule.ETD, "DD-MM-YYYY").add(1, 'days').format('DD-MM-YYYY')
minDate: moment(this.reschedule.ETD, "DD-MM-YYYY").add(1, 'days').format('DD-MM-YYYY')
})
}