Closed aaronfg closed 3 years ago
Did you find any solution / workaround for this ?
12 PM is 24 hours?
12 AM is 12:00
The A stands before the P in the alphabet. AM comes first in the alphabet and therefore also first on a day (Morning) and PM comes last (afternoon/night). 3. PM – Passes Midday.
Or am I missing something?
12 PM is 24 hours?
Yeah, that's the bug.
As the library stands right now, if a user selects 12pm in the picker, the value returned is 24.
I don’t understand it’s correct behaviour how would you now if it’s not 12 am? If it both returns 12
Op do 30 sep. 2021 om 17:04 schreef aaronfg @.***>
12 PM is 24 hours?
Yeah, that's the bug.
As the library stands right now, if a user selects 12pm in the picker, the value returned is 24.
— You are receiving this because you commented.
Reply to this email directly, view it on GitHub https://github.com/web-ridge/react-native-paper-dates/issues/105#issuecomment-931405876, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABRRARKPXGSF6ZMHPCY4H5TUER36XANCNFSM5EAQSXVQ .
--
Richard Lindhout | Eigenaar Bel mij +31 6 43 42 45 67 <+31643424567>
[image: logo webridge]
Beatrixlaan 2, 4694EG Scherpenisse
KVK 56845367 BTW NL002365659B60 IBAN NL93 BUNQ 2038 9661 33 WEB webRidge.nl https://webridge.nl/
I don’t understand it’s correct behaviour how would you now if it’s not 12 am? If it both returns 12
I don't understand your reply.
Selecting 12:00pm in the picker should return this:
{
hours: 12,
minutes: 0,
}
But it's not.
it's returning:
{
hours: 24,
minutes: 0,
}
This is just categorically wrong.
24 hours is 12 AM. Your picker is saying that 12pm is somehow 12AM.
I don't know how else to explain this. I put the tables above to show the bug. Just look at the values. You're going from 11 to 24 to 13 in the hours as you choose 11AM, 12PM, and 1PM.
As it is now, your picker is using 24 hour time correctly for all hours except for 12pm and 12AM. Those values are reversed. That is the bug.
UPDATE with Expo example: Here's an Expo Snack where i'm just logging the hours out when you select the time:
https://snack.expo.dev/OjJhGVl_T
Select 12 PM , hit ok and look at the log. it will show hours: 24
Select 12 AM , hit ok and look at the log. it will show hours: 12
.
12pm is not the 24th hour of the day.
Ok you're right I didn't grow up with AM/PM that's why I was so confused. This is a serious bug.. Thanks for sticking with me @aaronfg and I'm so sorry for being so stubborn.
I'll try to make some time in the evening next week to fix this bug
No worries! Thanks for looking into it.
Much appreciated!
I found the problem, I'll try to make PR by the end of the week.
Pull Request submitted : Link To PR
Thanks a lot @J3j3m!
Using version 0.4.6.
There seems to be a bug with 12PM and 12AM-- selecting 12pm is returning "24 hours". and 12AM is returning "12 hours".
Using the TimePicker with all defaults, just setting the
onDismiss
andonConfirm
:Picking 12 pm somehow adds an extra 12 hrs as if it is midnight.
Expected vs Actual (buggy) results below.
Expected:
What the Bug Shows:
Is the time picker not using standard 24 hr time?
If so, the hours should match as follows:
The logic for 12AM/PM has been swapped with this time picker.