Add tests for updated functionality in date-selector and formatting

This commit is contained in:
leigh-mil
2019-09-24 13:08:29 -04:00
parent 32583feb99
commit e26edcd1bb
2 changed files with 41 additions and 9 deletions

View File

@@ -102,9 +102,16 @@ export default {
isYearValid: function() {
// Emit a change event
var minYear = new Date(this.mindate).getFullYear()
var maxYear = new Date(this.maxdate).getFullYear()
var valid = this.year >= minYear && this.year <= maxYear
var valid
var minYear = this.mindate ? new Date(this.mindate).getFullYear() : null
var maxYear = this.maxdate ? new Date(this.maxdate).getFullYear() : null
if (minYear && maxYear) {
valid = this.year >= minYear && this.year <= maxYear
} else {
valid = parseInt(this.year) >= 1
}
this._emitChange('year', this.year, valid)
return valid
},
@@ -138,12 +145,7 @@ export default {
},
isDateComplete: function() {
return (
!!this.day &&
!!this.month &&
!!this.year &&
this.year > 999
)
return !!this.day && !!this.month && !!this.year && this.year > 999
},
daysMaxCalculation: function() {