What I am trying to do is set the month and year from an event calendar to Tempus Dominus datepicker. So on the main page is a big calendar, the user may change the month from November to December, and the create a new event in December.
Once the user clicks the button to enter a new event, I want to set the datepicker to that month. Per the docs on the page I access the functions with:
$('#datetimepicker').datetimepicker(FUNCTION)
To set the viewDate
I need to put the date in ()
viewDate('11/21/2018')
putting it together (I have tried a few different ways it should look something like:
$('#datetimepicker').datetimepicker(viewDate('11/21/2018'))
I have put viewDate
in single quotes, tried viewDate:
and a few others, with no luck. I currently have it wired to a button and hard coded the date like above for testing.
What is it that I am not understanding or doing wrong.
I think that the right way of calling
viewDate
function is:where
<value>
is a string (compliant withformat
option), moment or Date value.Anyway, I fear that the current version (
5.1.2
) of Tempus Dominus datetimepicker has a bug/issue and theviewDate
is not notified to the component view.If you need you can use
date
instead ofviewDate
to change component's value.Here a live sample: