Skip to content

Commit

Permalink
Fix compatibility with latest versions of DateTimePicker not showing
Browse files Browse the repository at this point in the history
time panel

- Closes #2983
  It seems the `format` prop is required to have `HH:mm` to display the
timepanel…for some reason

- Note: The `first-day-of-week` seems unused, it should probably
  override the setting in `lang`
- Remove obsolete props `not-before` and `not-after` which are replaced
  by a `disabled-date` function prop in vue2-datepicker 3.0.0

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
  • Loading branch information
tcitworld committed Apr 16, 2021
1 parent e79296b commit dacb7e3
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/components/Shared/DatePicker.vue
Expand Up @@ -24,13 +24,13 @@
<DatetimePicker
:lang="lang"
:first-day-of-week="firstDay"
:format="'YYYY-MM-DD HH:mm'"
:formatter="formatter"
:value="date"
:type="type"
:clearable="false"
:minute-step="5"
:not-before="minimumDate"
:not-after="maximumDate"
:disabled-date="disabledDate"
:show-second="false"
:show-time-panel="showTimePanel"
:show-week-number="showWeekNumbers"
Expand Down Expand Up @@ -397,6 +397,16 @@ export default {
return moment(dateMatches[1] + ' ' + timeMatches[1], 'L LT', this.locale).toDate()
}
},
/**
* Whether or not the date is acceptable
*
* @param {Date} date The date to compare to
* @returns {Boolean}
*/
disabledDate(date) {
const now = new Date()
return now < this.minimumDate || now > this.maximumDate
},
},
}
</script>

0 comments on commit dacb7e3

Please sign in to comment.