capacitor-community / date-picker

Native DateTime Picker Plugin for Capacitor Apps
MIT License
87 stars 29 forks source link

is24h flag didnt worked on Android #76

Open daxter44 opened 1 year ago

daxter44 commented 1 year ago

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):

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);