Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Tejas Shah on Oct 08, 2008 02:47
open dhtmlx forum
DHX Calendar: How to compare two dates

Hi there,
I have two calendar objects having mm/dd/yyyy format.
One is Start Date, one is End Date.
I want that Start Date should always be less than End Date.
Do we have any API for it to compare ?
Answer posted by Support on Oct 08, 2008 04:10
>>I want that Start Date should always be less than End Date.
You can use setSensitive to prevent unwated date selection

>>Do we have any API for it to compare ?
You can use getDate method of calendar , which returns data in js compatible format

var d1= calendar1.getDate();
var d2= calendar2.getDate();
if (Date.parse(d1).valueOf() > Date.parse(d2).valueOf()) alert("Start date is lesser that End date");