Convert AM/PM to lowercase in datepicker.js?

In pickadatejs, is it possible to get lowercase format (am/pm) instead of uppercase format (AM/PM), with minimum configuration as possible?

Answers 1

  • From the docs:

    The formatLabel option is unique. It can contain HTML and it can also be a function if you want to create the label during run-time:

    $('.timepicker').pickatime({
      // Escape any ?rule? characters with an exclamation mark (!).
      format: 'T!ime selected: h:i a',
      formatLabel: '<b>h</b>:i <!i>a</!i>',
      formatSubmit: 'HH:i',
      hiddenPrefix: 'prefix__',
      hiddenSuffix: '__suffix'
    })
    

    In formatLabel, you can simply use .toLowerCase(), since it accepts a function.


Related Articles