Skip to content

Commit

Permalink
chore: set datepicker default view to minimum date (#574)
Browse files Browse the repository at this point in the history
* chore: set datepicker default view to minimum date

* refactor: set initDate only if minDate
tshuli authored Nov 9, 2020
1 parent 0ca60ad commit 47509a0
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -24,6 +24,7 @@ function dateFieldComponentController() {
yearColumns: 3,
minDate: null,
maxDate: null,
initDate: null,
}

vm.$onChanges = (changesObj) => {
@@ -55,6 +56,11 @@ function dateFieldComponentController() {
if (get(vm.field, 'dateValidation.customMaxDate')) {
vm.dateOptions.maxDate = new Date(vm.field.dateValidation.customMaxDate)
}

// If minDate is set, default view upon opening datepicker to be month of minDate
if (vm.dateOptions.minDate) {
vm.dateOptions.initDate = vm.dateOptions.minDate
}
}
}

0 comments on commit 47509a0

Please sign in to comment.