add the addEvent function with datepicker