diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 0000000..1d085ca --- /dev/null +++ b/.prettierignore @@ -0,0 +1 @@ +** diff --git a/src/js/tempusdominus-bootstrap-4.js b/src/js/tempusdominus-bootstrap-4.js index bce758e..6ab4f4b 100644 --- a/src/js/tempusdominus-bootstrap-4.js +++ b/src/js/tempusdominus-bootstrap-4.js @@ -340,7 +340,8 @@ const TempusDominusBootstrap4 = ($ => { // eslint-disable-line no-unused-vars _updateMonths() { const monthsView = this.widget.find('.datepicker-months'), monthsViewHeader = monthsView.find('th'), - months = monthsView.find('tbody').find('span'), self = this; + months = monthsView.find('tbody').find('span'), self = this, + lastPickedDate = this._getLastPickedDate(); monthsViewHeader.eq(0).find('span').attr('title', this._options.tooltips.prevYear); monthsViewHeader.eq(1).attr('title', this._options.tooltips.selectYear); @@ -359,7 +360,7 @@ const TempusDominusBootstrap4 = ($ => { // eslint-disable-line no-unused-vars } months.removeClass('active'); - if (this._getLastPickedDate().isSame(this._viewDate, 'y') && !this.unset) { + if (lastPickedDate && lastPickedDate.isSame(this._viewDate, 'y') && !this.unset) { months.eq(this._getLastPickedDate().month()).addClass('active'); }