Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Stephen on May 16, 2009 01:59
open dhtmlx forum
dhtmlxCalendarand time?

[Not sure if this will append to existing Topic dhtmlxCalendarand time?]

Problem with dhtmlxCalendar + time
1. Calendar *header* displays 2009 as 1909 ie May,1909 - see below
2. Time is always 12:00:00

1. On start with blank boxes, left click in box brings up calendar with
a) current date eg
b) time = 12:00:00 always this ie not current time : how to fix this?

2. Select current date and boxes populated
05/16/09
12/00/00

3. left click in box brings up calendar with
a) date = 16 May,1909 not 2009!
b) time = 12:00:00

4. Select the given date/time and boxes populated correctly
05/16/09
12/00/00
ie its only calendar display header and the time thats a problem

Answer posted by Alex (support) on May 18, 2009 06:18

Hello, 

We forgot to set the date format in the provided sample.

Try to include the following line, possibly it will resolve the problem:

cal.setDateFormat("%m/%d/%y");

Answer posted by Stephen on May 18, 2009 10:35
Thanks I did manage to work the setDateFormat call after I posted.

I am also trying to pre-populated the date+time boxes with the
current date+time.
Problem is that when you click on a date/time box for the first time
the calendar pops up with
1) the correct date ie todays
2) the incorrect time ie 12:00:00 and not current time.
The correct time is picked up but only after a date/time is first selected on the calender.
Answer posted by Alex (support) on May 18, 2009 22:59

You can try to call setTime(val) method as follows:

...
cal.enableTime (true);
cal.tp.setTime(new Date());

.

Answer posted by Stephen on May 19, 2009 09:30
Thanks thats brilliant, it works a treat.

I also added: tp.setTime(new Date()); into dhtmlxcalendar.js
under < if (this.options.headerButtons.indexOf('T')>=0) >
so when the T today button is clicked it updates both date and time.

Answer posted by Alex (support) on May 20, 2009 06:58
Yes,
this is a great solution. Thank you for it. We'll include it into the next release.