Search code examples
jquery-mobilemobiscroll

How to set up 24 hour format in MobiScroll?


I am using latest version of MobiScroll datetime plugin and i need to display date in 24h format without AM/PM, so i doing it like

$('#datetime-start, #datetime-end').mobiscroll().datetime({
    minDate: new Date(now.getFullYear(), now.getMonth(), now.getDate()),
    display: 'modal',
    animate: 'pop',
    mode: 'mixed',
    // 2013-03-15 11:26:17
    dateFormat: 'yy-mm-dd',
    timeFormat: 'HH:ii:ss',
    timeWheels: 'hhii'
});

but there still 12h format... Is there any way to set up 24 format?


Solution

  • Your timeWheels attribute is incoreect, change it to this:

    $('#datetime-start, #datetime-end').mobiscroll().datetime({
        minDate: new Date(now.getFullYear(), now.getMonth(), now.getDate()),
        display: 'modal',
        animate: 'pop',
        mode: 'mixed',
        // 2013-03-15 11:26:17
        dateFormat: 'yy-mm-dd',
        timeFormat: 'HH:ii:ss',
        timeWheels: 'HHii'
    });
    

    So change this:

    timeWheels: 'hhii'
    

    to this:

    timeWheels: 'HHii'