Vuepic / vue-datepicker

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

AM\PM max\min-time prop issue on time-picker #820

Closed Nick1Muse closed 4 months ago

Nick1Muse commented 5 months ago

Hi! :) if :is-24="false" time-picker input returns wrong values, for example -{ hours: 16, minutes: 0 } if I pick 4 PM on the grid. It causes bugs with max\min-time props, because if you need to disable all time options under 4 PM on the times-grid, you need to pass to min-time prop such value - { hours: 4, minutes: 0 }, which will affect AM grid too. And if you pass to the prop - { hours: 16, minutes: 0 } it will disable all available options.

Also if you pass to max-time prop something like { hours: 4, minutes: 0 } and then try to pick avalilable PM time, you will get nothing in result, probably because time-picker returns value with hours in 24-format, which means any hour on PM grid is lesser than { hours: 4, minutes: 0 }

To Reproduce

  1. Go to sandbox from your docs
  2. enter that code:
    
    <template>
    <div>
    <Datepicker
      v-model="date"
      time-picker
      :is-24="false"
      :min-time="{ hours: 4, minutes: 0 }"
    />
    </div>
    </template>


Expected result:
1. time options < 4 AM - disabled.
2.  time options for PM - all available.

Actual result:
Everything < 4 is disabled, regardless which time option has chosen AM or PM.