dhmlxCalendar + compare dates

I have 2 calendars attached to the 2 input box. and I want to validate that first input box date should always come before the other text box. let say

so in any condition, this should qualify start_date<end_date.

Calendarprovides onClick event. Its handler gets object of selected date as a parameter. It can be used for validation:

calendar.attachEvent(“onClick”, function(date){

/your code here/