Categories | Question details Back To List | ||
dhtmlxscheduler - dates by JSON Hi... I am having some problems with using dhtmlxscheduler: When attaching an onEventAdded event to a scheduler, I need a Date object that is Java-compatible. Tried using date.toJSON() for this; it almost works, but the returned date is always one day earlier. Example: JS Code :- scheduler.attachEvent("onEventAdded",function(ev_id, ev_object) { alert(ev_object.start_date + ", " + ev_object.start_date.toJSON()); } Result:- Mon Sep 07 2009 00:00:00 GMT+0800 (Malay Peninsula Standard Time), "2009-09-06T16:00:00Z This does not happen for scheduler.attachEvent("onEventChanged",...) though. Is this an error in the scheduler, Prototype, or somewhere else? Is there a better way to get Date? Many thanks in advance... Answer posted by Support on Sep 01, 2009 05:08 You can create your own formatters for the data http://dhtmlx.com/docs/products/dhtmlxScheduler/doc/dhtmlxscheduler___date_formats.html#sch_dateformat my_convert = scheduler.date.date_to_str("%m/%d/%Y %H:%i"); //or any other format string scheduler.attachEvent("onEventAdded",function(ev_id, ev_object) { alert(my_convert(ev_object.start_date)); } |