Magento2: Calendar. Time format 24h

Created on 22 Mar 2016  路  4Comments  路  Source: magento/magento2

Steps to reproduce

  1. Install Magento from develop or master branch.
  2. Create custom extension and try to use calendar.
  3. https://www.dropbox.com/s/xxzjp3vn2z6jskg/Screenshot%202016-03-22%2010.10.06.png
$("#datatime").calendar({
       timeFormat: "HH:mm:ss",
});

Expected result

  1. We want to see 24h format, like 21:34:45 (does not 9:34:45 PM).

    Actual result

  2. We have AM/PM fromat

    Reason

File /lib/web/mage/calendar.js
Lines 396-400

time: {
      'a': 'tt',
      'HH': 'hh',
      'H': 'h'
}

This mask change string format

  • from 'HH:mm:ss' to 'hh:mm:ss'
  • from 'H:mm:ss' to 'h:mm:ss'

Why do we need this transformations?

bug report

All 4 comments

Why do we need this transformations?

Because main producer for date-time configuration is Backend (Php app with ICU datetime format).

Ok, but can I set 24h time format in calendar?

Currently there is fix for issue MAGETWO-52178 waiting to be merged in mainline.

Fix was deivered to mainline (develop branch).

Was this page helpful?
0 / 5 - 0 ratings