const picker = new tempusdominus
.TempusDominus(document.getElementById('datetimepicker1'));
picker.viewDate
returns the pickers current view date.
picker.viewDate = DateTime
will set the view date, update the options and ask the view to refresh.
There are a number of function here that allow for retrieving the selected dates or adding to them.
These functions are used as picker.dates.add(...)
for example.
Adds a new DateTime to selected dates array. Use this function with caution. It will not automatically refresh the widget or do any validation.
Sets the select date index (or the first, if not provided) to the provided DateTime object.
Formats a DateTime object to a string. Used when setting the input value. It is possible to overwrite this to provide more complex formatting with moment/dayjs or by hand.
Parse the value into a DateTime object. This can be overwritten to supply your own parsing.
Tries to convert the provided value to a DateTime object. If value is null|undefined then clear the value of the provided index (or 0). It is possible to overwrite this to provide more complex formatting with moment/dayjs or by hand.
Returns true if the target date is part of the selected dates array. If unit is provided then a granularity to that unit will be used.
Returns the index at which target date is in the array. This is used for updating or removing a date when multi-date is used. If unit is provided then a granularity to that unit will be used.