In addition to the Jake Query javascript framework and the bootstrap UI framework we can also add other
client side code libraries that give us added functionality.
For example when adding or editing an article in the published at date and time field even though it's
a date time local input type in this browser we don't get any help.
We have to specify it in the far months expected by the database year month day separated by hyphens
and our minutes second separated by Colon's.
This isn't very user friendly.
You'll get many results.
If you search for javascript date time pickers for example.
Let's try this one.
The files aren't available on a CDMA at the moment so to use this plug in.
First we need to download it.
Open the zip file and then in the build folder in here extract the minimized javascript file to our
J s folder and the C Ss file to our SS folder.
Then in the header.
Include will add a reference to this SS file.
And in the footer include a reference to the gess file.
In the article form the published at input is a date time local type.
In some browsers this gives you a date time picker but it's not supported in all browsers as were now
going to use a date time plug in instead.
Will remove this type to avoid conflicts with the plugin.
The field already has an idea.
So in our javascript file we can get the field using J query.
And Karl the date time.
Pick a method on it which is a new method that we made available when we added the plugins javascript
file to our code.
Now when we view the article from when I click on the publish stat field we get a selector where we
can select the date and time instead of having to type them in.
However when I submit the form we get a message from the server side validation saying the date and
time is invalid.
That's because this isn't quite the format we need.
It has slushes instead of hyphens.
One of the plugins many options is the date and time format.
So when we call the date time pick a method on the input we can pass in the farm that we want which
is the one expected on the server.
So now when I click on the field and select a date and time there in the correct format and when I submit
the form the server side validation passes.
The plugin has many options for displaying the date and time in different formats.
Hiding certain dates and so on.
So I encourage you to explore them in the plugins documentation here.