Vuepic / vue-datepicker

Datepicker component for Vue 3
https://vue3datepicker.com
MIT License
1.48k stars 147 forks source link

Possible to "bypass" max-time prop by decrementing minutes past zero #727

Closed halvtomat closed 8 months ago

halvtomat commented 9 months ago

Describe the bug If I set the max-time prop I can still navigate to a time past the max value by decrementing the minute input below zero.

To Reproduce Steps to reproduce the behavior:

  1. Go to your own max-time example where the max-time prop is set to {hours: 11, minutes: 30}
  2. Open the timepicker and set hour to 11 and minutes to 00 (which is a valid time and within max).
  3. Click the downwards pointing arrow below the minute input to decrement the minutes past zero.
  4. The time is now 11:59 which is past the set max-time and you can no longer either increment or decrement the minute input.

Expected behavior I see at least two possible solutions,

  1. preventing the user from decrementing the minutes past zero if it would set the time past max-time
  2. decrementing the hours when the minutes loop back to 59 value (in the example it would become 10:59 instead of 11:59) and in this case I would expect the same behavior when incrementing past 59

Desktop & mobile (please complete the following information):

halvtomat commented 9 months ago

@Jasenkoo You are lightning fast my man!