Add computed properties for Date object for dates used in functions
This commit is contained in:
parent
a8635e8c8b
commit
1912a9127f
@ -102,8 +102,8 @@ export default {
|
|||||||
isYearValid: function() {
|
isYearValid: function() {
|
||||||
// Emit a change event
|
// Emit a change event
|
||||||
let valid
|
let valid
|
||||||
let minYear = this.mindate ? new Date(this.mindate).getFullYear() : null
|
let minYear = this.mindate ? this.minDateParsed.getFullYear() : null
|
||||||
let maxYear = this.maxdate ? new Date(this.maxdate).getFullYear() : null
|
let maxYear = this.maxdate ? this.maxDateParsed.getFullYear() : null
|
||||||
|
|
||||||
if (minYear && maxYear) {
|
if (minYear && maxYear) {
|
||||||
valid = this.year >= minYear && this.year <= maxYear
|
valid = this.year >= minYear && this.year <= maxYear
|
||||||
@ -172,7 +172,7 @@ export default {
|
|||||||
|
|
||||||
minError: function() {
|
minError: function() {
|
||||||
if (this.isDateComplete) {
|
if (this.isDateComplete) {
|
||||||
return new Date(this.mindate) > new Date(this.formattedDate)
|
return this.minDateParsed > this.dateParsed
|
||||||
}
|
}
|
||||||
|
|
||||||
return false
|
return false
|
||||||
@ -180,11 +180,23 @@ export default {
|
|||||||
|
|
||||||
maxError: function() {
|
maxError: function() {
|
||||||
if (this.isDateComplete) {
|
if (this.isDateComplete) {
|
||||||
return new Date(this.maxdate) < new Date(this.formattedDate)
|
return this.maxDateParsed < this.dateParsed
|
||||||
}
|
}
|
||||||
|
|
||||||
return false
|
return false
|
||||||
},
|
},
|
||||||
|
|
||||||
|
maxDateParsed: function() {
|
||||||
|
return new Date(this.maxdate)
|
||||||
|
},
|
||||||
|
|
||||||
|
minDateParsed: function() {
|
||||||
|
return new Date(this.mindate)
|
||||||
|
},
|
||||||
|
|
||||||
|
dateParsed: function() {
|
||||||
|
return new Date(this.formattedDate)
|
||||||
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user