Update date component with props and functionality
This commit is contained in:
parent
c21857df9c
commit
5e291f0332
@ -60,6 +60,10 @@ export default {
|
||||
default: false,
|
||||
description: "Input readonly status"
|
||||
},
|
||||
props: {
|
||||
type: Number,
|
||||
description: "Payment period"
|
||||
},
|
||||
disabled: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
@ -150,12 +154,12 @@ export default {
|
||||
},
|
||||
|
||||
addDays(dateInput) {
|
||||
if(!default_payment_terms) return;
|
||||
if(!this.period) return;
|
||||
|
||||
const dateString = new Date(dateInput);
|
||||
const aMillisec = 86400000;
|
||||
const dateInMillisecs = dateString.getTime();
|
||||
const settingPaymentTermInMs = parseInt(default_payment_terms) * aMillisec;
|
||||
const settingPaymentTermInMs = parseInt(this.period) * aMillisec;
|
||||
const prospectedDueDate = new Date(dateInMillisecs + settingPaymentTermInMs);
|
||||
|
||||
return prospectedDueDate;
|
||||
@ -168,12 +172,10 @@ export default {
|
||||
},
|
||||
|
||||
dateConfig: function() {
|
||||
if(!default_payment_terms || this.real_model < this.dateConfig.minDate) {
|
||||
this.real_model = this.dateConfig.minDate;
|
||||
}
|
||||
|
||||
if(this.dateConfig.minDate && this.real_model > this.dateConfig.minDate ) {
|
||||
this.real_model = this.addDays(this.dateConfig.minDate);
|
||||
if(this.dateConfig.minDate) {
|
||||
if(this.real_model < this.dateConfig.minDate){
|
||||
this.real_model = this.addDays(this.dateConfig.minDate);
|
||||
}
|
||||
}
|
||||
},
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user