web-ridge / react-native-paper-dates

Smooth and fast cross platform Material Design date and time picker for React Native Paper
https://www.reactnativepaperdates.com
MIT License
657 stars 170 forks source link

Unable to select any hours before noon when TimePickerModal is in 24-hour clock mode #132

Closed gbarany closed 2 years ago

gbarany commented 2 years ago

I'm unable to select any hour before noon when TimePickerModal is in 24-hour clock mode (e.g. locale is de). Only hours after 12 noon can be selected. Issue can be reproduced by changing the locale prop to "de" in the Time picker sample code:

<TimePickerModal
   visible={visible}
   onDismiss={onDismiss}
   onConfirm={onConfirm}
   hours={12} // default: current hours
   minutes={14} // default: current minutes
   label="Select time" // optional, default 'Select time'
   uppercase={false} // optional, default is true
   cancelLabel="Cancel" // optional, default: 'Cancel'
   confirmLabel="Ok" // optional, default: 'Ok'
   animationType="fade" // optional, default is 'none'
   locale="de"
/>

I've tested this with release 0.8.4 on iOS and web.

Simulator Screen Recording - iPhone 11 - 2022-01-13 at 15 53 06

RichardLindhout commented 2 years ago

@J3j3m could this be related to: https://github.com/web-ridge/react-native-paper-dates/pull/110?

RichardLindhout commented 2 years ago

So 23 does not work too or only 00?

gbarany commented 2 years ago

So 23 does not work too or only 00?

I can't pick any hour from the outer circle of the dial (i.e. 1,2,...11) because the selection automatically jumps on the inner circle. For example when I try to pick 7h it jumps to 19h automatically, when I pick 8h it jumps to 20h etc.

J3j3m commented 2 years ago

Weird, i'll try to check that this week-end

RichardLindhout commented 2 years ago

@J3j3m thank you, really nice!

gbarany commented 2 years ago

I've tested this behaviour with different different versions. v0.4.6 is the last version where TimePickerModal works as expected in 24-hour clock mode. For versions v0.5.0+ only afternoon hours can be picked.

gbarany commented 2 years ago

I came up with this patch to fix the issue temporarily

J3j3m commented 2 years ago

Thanks, i didn't have time this w-e checking this, i'll do that this week.

J3j3m commented 2 years ago

I got the point, i'm working on a fix that will not break Am/Pm mode

J3j3m commented 2 years ago

PR Submitted, have a good week-end 🙌