Hour picker - 01 am, 01 pm ain't rendered properly on android
See original GitHub issueDescribe the bug
On android + 12hour mode, when set hour value as 01 am or 01pm, the hour item rendered as 12.
When picker view is re-rendered (ex. scroll) , it is updated to proper value.
It happens when androidVariant = nativeAndroid
.
Expected behavior Hour label text should be 1
To Reproduce
const date = new Date();
date.setHours(13);
// or date.setHours(1);
return (
<DatePicker
modal
date={date}
open={true}
mode="time"
locale="ko"
/>
)
Smartphone (please complete the following information):
- OS: Android
- react-native-date-picker version 4.0.0
Issue Analytics
- State:
- Created 2 years ago
- Comments:8 (2 by maintainers)
Top Results From Across the Web
TimePickerDialog and AM or PM - Stack Overflow
TimePickerDialog and AM or PM ... I have a TimePickerDialog with is24Hour set to false since I want to present the end-user with...
Read more >How to Add TimePicker in Android to Set Time By Hour, Minute
In today's Android app tutorial, we'll see how to add time picker in Android app to allow users pick time by hour, minute,...
Read more >Untitled
Calories in 1/4 sweet potato, Freelancer discovery 4.87 map, ... Free tips on resume writing, #Micro center friday hours, Eminem mom quotes.
Read more >onTimeChanged callback is not invoked for AM/PM changes ...
Found a problem where the onTimeChanged callback is not invoked for the time picker widget. This only seems to happen on tablets. Steps...
Read more >Diff - platform/system/core.git - Google Git
Merge "init: Fix get_hardware_name() to cope with long /proc/cpuinfo output" diff --git a/adb/Android.mk b/adb/Android.mk index bc8315e..a803978 100644 ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
And I found a weird behavior and a dirty solution.
https://github.com/henninghall/react-native-date-picker/blob/79e1e7501e2910300827433eca5cebecb02849e2/android/src/main/java/com/henninghall/date_picker/wheels/Wheel.java#L94-L100
When I modify 97th line to
displayValues.add("_" + this.toDisplayValue(value));
Nothing changed. But when use
1am/pm rendered properly.
displayValues.add(this.toDisplayValue(value) + "_");
So, finally
fixed my issue, but definitely not a good solution.
displayValues.add(" " + this.toDisplayValue(value) + " ");
Is there any code like
labelText.endsWith(numberValue)
?A fix for this is released in v4.1.5