cordova-plugin-datepicker
cordova-plugin-datepicker copied to clipboard
iOS: Date picker not showing in 24 hour format
I have set the device settings to use 24 hour time format, but the datepicker is still showing 12 hour format. Here is the way I'm setting the options for datepicker -
options = {
date: new Date(),
mode: 'datetime',
minDate: new Date() - 10000,
allowFutureDates: true,
doneButtonLabel: 'DONE',
doneButtonColor: '#000000',
cancelButtonLabel: 'CANCEL',
cancelButtonColor: '#000000',
locale: value, // locale is fetched through the device settings too
};
$cordovaDatePicker.show(options).then(function (date) { }
Device settings: Region - Mumbai, India Language - English Time-format - 24 hours iOS 8.3, iPhone 6
Can anyone please let me know what's the issue?
Any update on this? When using the time picker it is showing AM/PM, but my device is set to 24 hour format. (Android).
Yes, it's working on android as below. There's an option is24Hour
for android which can be set as required. -
globalizationService.getTimeFormat()
.then(function (timeFormat) {
options.is24Hour = timeFormat;
delete options.minDate;
});
$cordovaDatePicker.show(options)
@sparsh0611 Seems you can specify a locale that uses 24h time as a cordova-plugin-datepicker option. For example, en_GB
leads to a 24h picker, as per: http://stackoverflow.com/a/33912837
https://developer.apple.com/reference/uikit/uidatepicker#2281469