cordova-plugin-datepicker icon indicating copy to clipboard operation
cordova-plugin-datepicker copied to clipboard

iOS: Date picker not showing in 24 hour format

Open sparsh0611 opened this issue 9 years ago • 3 comments

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?

sparsh0611 avatar Aug 05 '15 15:08 sparsh0611

Any update on this? When using the time picker it is showing AM/PM, but my device is set to 24 hour format. (Android).

paulb2011 avatar Sep 06 '16 08:09 paulb2011

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 avatar Sep 08 '16 15:09 sparsh0611

@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

tomsun avatar Apr 08 '17 16:04 tomsun