Install
This is the repository archive. It installs, but the folder name will carry the branch suffix and updates will not flow.
Install straight from GitHub with WP-CLI:
wp plugin install https://github.com/iamntz/wp-caldera-forms-time-picker/archive/refs/heads/master.zipWhat is this?
Caldera Forms is missing a time picker, providing instead only a date picker. This plugin can replace the existing datepicker and will add the ability to use a time picker as well. I'm using the awesome plugin flatpickr for the frontend and shamelessly stealed most of the backend config from the Caldera's built in date picker.
How to use it
By default, this is set to append a new field type:

However, you can override the built in field by adding the following line in you functions.php file:
add_filter('caldera_forms_replace_default_datepicker', '__return_true');

Other hooks
For now, there are two hooks available, which will allow you to add/edit existing datepicker styles or localization, both of them expecting an associative array (keys are used as values).
add_filter('caldera_forms_datepicker_languages', function($lang) {
$lang = [
'http://your-path-to-localization-file/en.js' => 'English',
'http://your-path-to-localization-file/fr.js' => 'French'
];
// OR
$lang[http://your-path-to-localization-file/fr.js] = 'French';
return $lang;
});
Same goes for the styles, but you'll gonna use caldera_forms_datepicker_styles filter instead.
A small note about using styles
Please note that changing a datepicker theme will affect ALL other flatpickr in the page. Yes, even if they are in a different form or even are not built with Caldera Forms!
Todo
- [ ] Add JS hooks for each field;
Contribute
You are more than welcome to submit any pull requests if you find bugs or anything to improve!