Back to Community

Troubleshooting Common Meta Box Time and Date Picker Issues

15 threads Sep 10, 2025 PluginMeta box

Content

Meta Box is a powerful plugin for creating custom fields in WordPress, but users often encounter issues with its time and datetime picker fields. Based on community reports, this guide covers the most common problems and their solutions.

1. Time Format Not Applying (e.g., AM/PM not showing)

Users frequently report that time format options like 'hh:mm tt' do not work as expected. The time may display in a 24-hour format regardless of the setting.

Solution: Ensure you are using the correct combination of parameters. To enable a 12-hour format with AM/PM, you must set the 'ampm' argument to true in addition to the correct 'timeFormat'.

'timeFormat' => 'hh:mm TT',
'ampm' => true,

2. Outdated Timepicker Library Causing Bugs

Many issues, such as the inability to select certain times (e.g., 23:59), stem from an outdated version of the jQuery UI Timepicker addon bundled with older versions of Meta Box.

Solution: The first and most important step is to update the Meta Box plugin to the latest version. The Meta Box team has addressed this by updating the library in version 4.4.2 and later. If you are on the latest version and the issue persists, check for conflicts with other plugins.

3. Time or Date Picker Not Appearing (No JavaScript Errors)

Sometimes, the picker interface does not appear when clicking the input field, and there are no obvious errors in the browser console.

Solution: This is often caused by a JavaScript conflict with another plugin or theme.

  • Conflict Test: Deactivate all other plugins and switch to a default WordPress theme (like Twenty Twenty-One). If the picker works, reactivate your plugins one by one to identify the culprit. Common conflicts arise with other plugins that create custom post types or meta boxes.
  • Check Code: Ensure your field configuration code is correct. A missing comma or a syntax error can prevent the JavaScript from initializing. Compare your code to the official demo examples.
  • Frontend Usage: The necessary JavaScript and CSS files for the pickers are typically only loaded in the WordPress admin. If you are using a datetime field on the frontend, you must manually enqueue these scripts.

4. Incorrect Class Preventing Time Field Initialization

In older versions of Meta Box, a bug prevented time-only fields from working unless a datetime field was also present on the same page. This was due to the time field incorrectly using the rwmb-datetime CSS class.

Solution: This specific bug was fixed in a plugin update. If you are experiencing this issue, update Meta Box to the latest version. You can verify the fix by checking that your time field input has the class rwmb-time.

5. Understanding and Setting the Correct Format Parameters

Users sometimes struggle to get the desired date or time format because the correct format strings are not used.

Solution: Use the correct format patterns for the jQuery UI Timepicker library, not standard PHP date formats.

  • For a 24-hour time format with minutes and seconds, use: 'H:mm:ss'
  • For minutes, use mm, not i.
  • Refer to the jQuery UI Timepicker documentation for all available options.

6. Saving and Displaying Values in a Different Format

The picker may save a value in one format (e.g., Y-m-d H:i:s), but you need to display it on the frontend in another (e.g., d-m-Y H:i).

Solution: You should not change the saved value's format. Instead, save it in the default format and then convert it when displaying the value to the user. You can use PHP's DateTime class for this.

$evdate = rwmb_meta( 'your_field_id' );
$formatted_date = new DateTime( $evdate );
echo $formatted_date->format( 'd-m-Y H:i' );

By following these troubleshooting steps, most common issues with the Meta Box time and datetime pickers can be resolved. Always ensure your plugin is updated to benefit from the latest bug fixes and improvements.