2

I have defined the field like this (CMB2 wordpress):

 $cmb->add_group_field( $thevar, array(
                'name' => 'timer',
                'id'   => 'expire_date',
                'type' => 'text_datetime_timestamp',
                'date_format' => 'Y/m/d',
                'time_format' => 'H:i:s',
            ) );

the problem is that the list box for choosing minute is not precise and increments by 5. for example:

0 5 10 ... 55

enter image description here


I want to list all of the minutes like this: 1 2 3 ... 59

webelizer
  • 418
  • 2
  • 11

1 Answers1

3

CMB is using jquery datepicker plugin, it accepts data- attributes. This works, in my case:

  $cmb->add_group_field( $thevar, array(
    'name' => 'timer',
    'id'   => 'expire_date',
    'type' => 'text_datetime_timestamp',
    'date_format' => 'Y/m/d',
    'time_format' => 'H:i:s',
    'attributes'=>array(
      'data-timepicker'=>json_encode(
        array(
          'timeFormat'=>'HH:mm:ss',
          'stepMinute'=>1,
        )
      ),
    ),
) );
zabatonni
  • 69
  • 5