Check against the contract dates instead of the current maxStart and minEnd values to calculate the new maxStart and minEnds
This commit is contained in:
parent
b7677018c2
commit
a5d34f9bb2
@ -20,13 +20,13 @@ describe('PopDateRange Test', () => {
|
||||
const component = new Vue(PopDateRange)
|
||||
|
||||
it('should calculate the max start date', () => {
|
||||
component.maxStartDate = new Date('2020-01-01')
|
||||
component.contractEnd = new Date('2020-01-01')
|
||||
const date = new Date('2019-12-31')
|
||||
expect(component.calcMaxStartDate(date)).toEqual(date)
|
||||
})
|
||||
|
||||
it('should calculate the min end date', () => {
|
||||
component.minEndDate = new Date('2020-01-01')
|
||||
component.contractStart = new Date('2020-01-01')
|
||||
const date = new Date('2020-02-02')
|
||||
expect(component.calcMinEndDate(date)).toEqual(date)
|
||||
})
|
||||
|
@ -45,6 +45,8 @@ export default {
|
||||
return {
|
||||
maxStartDate: maxStartDate,
|
||||
minEndDate: minEndDate,
|
||||
contractStart: contractStart,
|
||||
contractEnd: contractEnd,
|
||||
}
|
||||
},
|
||||
|
||||
@ -60,7 +62,7 @@ export default {
|
||||
},
|
||||
|
||||
calcMaxStartDate: function(date) {
|
||||
if (!!date && date < this.maxStartDate) {
|
||||
if (!!date && date < this.contractEnd) {
|
||||
return date
|
||||
} else {
|
||||
return this.maxStartDate
|
||||
@ -68,7 +70,7 @@ export default {
|
||||
},
|
||||
|
||||
calcMinEndDate: function(date) {
|
||||
if (!!date && date > this.minEndDate) {
|
||||
if (!!date && date > this.contractStart) {
|
||||
return date
|
||||
} else {
|
||||
return this.minEndDate
|
||||
|
Loading…
x
Reference in New Issue
Block a user