search envelope-o feed check
Home Unanswered Active Tags New Question
user comment-o

timeline assign date

Asked by Otto
5 years ago.

Hello,
I would like to have 2 comboboxes to select the start date.
I tried to resolve the task with the session object.
But I can’t find out how I can assigne the selected date to timeline.
loadTimeline( DayPilot.Date.today() );
Can someone please help me.
I tried to build a string like this:
var $date = '2019-05-04 12:00:00'
but I do not find out how to convert this tor loadTimeLine( $date )
Thanks in advance
Otto

Comment posted by Anonymous
5 years ago.

Hello,
I think I found a solution.
var plustage = 180;

loadTimeline( DayPilot.Date.today().addDays( plustage ) );

Regards
Otto

Comment posted by Anonymous
5 years ago.

Now I can change the start day from 2 comboboxes.
<script>
var cMonat =(<?php echo $select1; ?>);
var cJahr = (<?php echo $select; ?>);
var d = new Date( cJahr +"-" + cMonat + "-01");
var dd = new Date();
var g = d - dd ;
var plusdays = Math.floor( g / (24*60*60*1000));
...
loadTimeline( DayPilot.Date.today().addDays( plusdays ) );
...
</script>
Best regards
Otto

Answer posted by Dan Letecky [DayPilot]
5 years ago.

Hi Otto,

You can create DayPilot.Date object from an ISO string using a constructor:

var date = new DayPilot.Date("2019-05-04T12:00:00");  // "2019-05-04 12:00:00" works as well

See also:
https://api.daypilot.org/daypilot-date-constructor/

Another helpful method:
https://api.daypilot.org/daypilot-date-fromyearmonthday/

This question is more than 1 months old and has been closed. Please create a new question if you have anything to add.