Title: Time picker problem
Last modified: December 30, 2018

---

# Time picker problem

 *  Resolved [TStone](https://wordpress.org/support/users/tstone/)
 * (@tstone)
 * [7 years, 5 months ago](https://wordpress.org/support/topic/time-picker-problem/)
 * This plugin seems awesome in many ways! 🙂
    But I find it quite difficult to 
   navigate the documentation. Some things are impossible to find any information
   on.
 * For example, the time picker field can only be used in intervals of 5 minutes,
   and despite spending a few hours trying to find out how to change it, I still
   haven’t got a clue.
 * I’ve made a custom post type to document theatrical performance pieces, and need
   to have a field where the time length of each performance piece is entered.
    
   Some pieces are only 3 minutes, but when trying to enter “3” it is immediately
   changed to Zero. Entering “5” (or 10, 15, 20, 25…) is possible, but entering 
   the wrong time lengths sort of defeats the whole thing.
 * This is what I’m trying to use:
    ´ $cmb_time->add_field( array( ‘name’ => esc_html__(‘
   Minutes’, ‘ticketbox’ ), ‘desc’ => esc_html__( ‘Length in minutes’, ‘ticketbox’),‘
   id’ => $prefix . ‘minutes’, ‘type’ => ‘text_time’, ‘time_format’ => ‘i’, // Set
   to minutes format ) ); ´
 * Is there a better way to solve it?

Viewing 5 replies - 1 through 5 (of 5 total)

 *  Thread Starter [TStone](https://wordpress.org/support/users/tstone/)
 * (@tstone)
 * [7 years, 5 months ago](https://wordpress.org/support/topic/time-picker-problem/#post-11038952)
 * Changed it to a standard textfield instead.
 *  Plugin Contributor [Michael Beckwith](https://wordpress.org/support/users/tw2113/)
 * (@tw2113)
 * The BenchPresser
 * [7 years, 5 months ago](https://wordpress.org/support/topic/time-picker-problem/#post-11044618)
 * As I recall, the default minute increment is 5 which explains the behavior you
   were seeing with that, however, we have a filter in place that would allow you
   to change that.
 * It’s found in the CMB2_JS.php file and the `localize` method around line 179 
   for version 2.5.1.
 * Something like the following should change that value to 1, but I haven’t formally
   tested it. Just eyeballing the code.
 *     ```
       function tstone_minute_incrementer( $l10n ) {
       	$l10n['defaults']['time_picker']['stepMinute'] = 1;
   
       	return $l10n;
       }
       add_filter( 'cmb2_localized_data', 'tstone_minute_incrementer' );
       ```
   
 *  Plugin Author [Justin Sternberg](https://wordpress.org/support/users/jtsternberg/)
 * (@jtsternberg)
 * [7 years, 5 months ago](https://wordpress.org/support/topic/time-picker-problem/#post-11044695)
 * The filter is there as a last resort. If you filter that, you’ll override all
   the settings for all fields (even ones part of other 3rd party plugins or themes),
   so it’s best to use the field-config attributes parameter to override. I have
   updated the text_time field documentation to demonstrate how this can be done:
   [https://github.com/CMB2/CMB2/wiki/Field-Types#text_time](https://github.com/CMB2/CMB2/wiki/Field-Types#text_time)
 *  Plugin Contributor [Michael Beckwith](https://wordpress.org/support/users/tw2113/)
 * (@tw2113)
 * The BenchPresser
 * [7 years, 5 months ago](https://wordpress.org/support/topic/time-picker-problem/#post-11044771)
 * What Justin said. I kind of had a hunch that that was maybe possible, but went
   with the way I was more confident about. 😀
 *  Thread Starter [TStone](https://wordpress.org/support/users/tstone/)
 * (@tstone)
 * [7 years, 5 months ago](https://wordpress.org/support/topic/time-picker-problem/#post-11046873)
 * Thank you!

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘Time picker problem’ is closed to new replies.

 * ![](https://ps.w.org/cmb2/assets/icon.svg?rev=2866672)
 * [CMB2](https://wordpress.org/plugins/cmb2/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/cmb2/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/cmb2/)
 * [Active Topics](https://wordpress.org/support/plugin/cmb2/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/cmb2/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/cmb2/reviews/)

 * 5 replies
 * 3 participants
 * Last reply from: [TStone](https://wordpress.org/support/users/tstone/)
 * Last activity: [7 years, 5 months ago](https://wordpress.org/support/topic/time-picker-problem/#post-11046873)
 * Status: resolved