capacitor-community / capacitor-community/date-picker
is24h flag didnt worked on Android
- Dominant language
- Swift
- Stars
- 94
- Forks
- 30
- PR merge metrics
- No merged PRs in 30d
Description
**Describe the bug**
At android platform, i set option is24h: true but always app shows 12h time picker.
**To Reproduce**
Steps to reproduce the behavior:
1. Create an app
2. Provide options:
const locale = window.navigator.language;
DatePicker.present({
mode: pickerType,
locale,
date: this.date ? moment(this.date + ' ' + this.time).toISOString() : undefined,
ios: {
style: 'wheels',
is24h: true,
},
android: {
is24h: true,
},
}).then((date) => this.changeDateAndTime(date.value));
3. Run app and open time picker
**Expected behavior**
App should open 24h time picker.
**Smartphone (please complete the following information):**
- Device: Nexus 4
- OS: API 33
- Browser chrome
- Version of date picker "@capacitor-community/date-picker": "^4.0.0",
**Additional context**
When I opened Android Studio and find for TimePickerDialog and edit flag options.is24h for static true value. This feature worked, but I can't use that solution beacon I want to set conditional to is24H.
final TimePickerDialog timePicker = new TimePickerDialog(context, theme, (TimePickerDialog.OnTimeSetListener) (view, hourOfDay, minute) -> {
calendar.set(calendar.get(Calendar.YEAR), calendar.get(Calendar.MONTH), calendar.get(Calendar.DAY_OF_MONTH), hourOfDay, minute);
callback.resolve(Parse.dateToString(calendar.getTime(), options.format));
}, calendar.get(Calendar.HOUR), calendar.get(Calendar.MINUTE), options.is24h);
Contributor guide
Research direction
Start by locating the Android code that creates the TimePickerDialog shown in the issue and trace how options.is24h reaches it. Reproduce the time-picker behavior with is24h: true, then verify that the conditional option controls the displayed format on Android API 33.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- android, java
- Domain
- mobile-dev
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100