When using Moment.js to format dates, the syntax is not the same as the default one :
http://momentjs.com/docs/#/parsing/string-format/
So, parsing something like "DD/MM/YYYY HH:mm" to build the mask ends with a wrong mask that fails when testing with "isValidValue" function, resulting in replacing the value of the input field with the wrong mask that was built just before.
Currently when lazyInit and mask is set to true, caret position will be set at the end. This makes it unable to type the date unless we move the cursor back to the start.
I am not exactly sure if this is the correct place to do it but it works as expected.
Double-clicking on the "today button", which changes the value of the input to the current date and time, does not trigger a change event. Manually selecting a date or a time does trigger a change event. Proposed edit makes this behavior consistent.
Beforehand the maxDate was only allowed to be the current date (+1970/01/01) or a date in the future (e.g. +1970/01/10). You couldn't set the maxDate to yesterday (e.g. -1970/01/02) or earlier in a logical manner.
All the functionality is in there, just needed the regex opened up to check for a plus or a minus at the start of the maxDate and minDate variables and parse them if present.
Added 2 new properties, to make a period of time disabled by setting disabledMinTime and disabledMaxTime.
I needed a way, to have minTime and maxTime set, but also a specific period of time within minTime and maxTime to be disabled. This can now be set with disabledMinTime and disabledMaxTime.
Example:
minTime: 12:00
maxTime: 22:00
disabledMinTime: 13:00
disabledMaxTime: 20:00
Then the available time will be 12:00 - 13:00 and 20:00 - 22:00
When options.weeks is true, and options.className is set, the result is
that both are concatenated together without a space to separate them.
For future maintainability, I decided to split out the modifications to
the datetimepicker element into separate modifications to more cleanly
show intent.
The today (home) button show the current month. After the double click it selected the current date and closed the popup, not validating the current date against the specified minimum and maximum dates.
Now, if the current date is out of the allowed range, the popup stays visible, and the input value is not changed.