WP Tempus Dominus Auto

Usually when I blog about programming, it’s Perl stuff, but here’s something that’s mostly Javascript (with a little PHP to act as a shim for WordPress). It’s a script to use Tempus Dominus as a date/time picker for HTML 5 date and time form inputs on Bootstrap/jQuery-based sites.

It lets you do stuff like this:

Which will look like this:

It automatically detects any input elements with type=date, type=time, or type=datetime. (Alternatively the classes tempus-dominus-date, tempus-dominus-time, or tempus-dominus may be used.)

It supports the following custom attributes:

The format the value should be submitted in. Format codes.
Overlays a “friendly” format on top of the form control. Format codes.
The locale for month names, day names, etc. Supported locales.
The name of the icon to use for the field. Icons list.
If this attribute is present, then clicking anywhere on the form control pops up the date/time picker. If it is absent, then only clicking on the button will open the picker and clicking on the rest of the field will focus it for typing the date or time.
data-tempus-dominus-linked="#startdate" on your end date picker will allow two pickers to be linked, so the end date cannot be before the start date.

So yeah, hopefully useful.

The script can be found on Github at: