Friday, 9 May 2014

Some thoughts on DateTimePicker (xdsoft.net)

We've decided to use this DateTimePicker as it seems to play nicely with older browsers but we've also had to do a fair bit of exploration in order to get it to do what we want. On the whole the documentation is brilliant but there's the odd issue where I got confused so in order to save someone else some time I'll document them here:

  • Format

    It uses PHPs date/time format - which is cool as I love PHP almost as much as I love JavaScript but you should still be aware!

  • minDate & maxDate

    These need to be in the "YYYY/MM/D" format (Moment.js format)! Generally speaking, once the format has been set in the picker initialization it's smart enough to clock that if you give it a value then it should parse it in the format it's already been given... except when it comes to minDate & maxDate where you need to use its default formatting - this took me a couple of hours to clock so I hope it helps someone.

  • Adding to the options

    It's possible to add to the methods of an already initialized picker by simple calling .datetimepicker() with the new option/s.

On the whole it's a lovely UI widget, I just hope these pointers help someone else when they use it.