Dates as Milliseconds Since January 1, 1970

Is it possible to load events into the scheduler (JSON format) with the start_date and end_date represented as number of milliseconds since January 1, 1970?

[

{
	"id": "1358460161745",
	"start_date": "1359610200000",
	"end_date": "253402243200000",
	"text": "Mikey",
	"event_pid": "",
	"event_length": 3600,
	"rec_type": "month_1___#no",
	"eventType": "snapshot",
	"retention_policy_other_num": "",
	"retention_policy_other_units": "day",
	"retention_policy": "20160",
	"volumeId": "Fantasy Baseball"
}

]

Normally it is not possible, as scheduler will not be able to parse such dates, but with some custom coding it can be done

//add this before scheduler.init
scheduler.templates.xml_date = function(value){ return new Date(value/1000); } 

Cool.

But why divide by 1000? Doesn’t the Date constructor take milliseconds?

Yep, you are right, there is no need for divide operation

scheduler.templates.xml_date = function(value){ return new Date(value); } 

I was confused by numbers in your sample, you are having there 253402243200000, which is quite huge if count it as milliseconds :slight_smile: