Fixed calendar datetimepicker

@omkarvijay5 Define the variables with `var` else they become global and would lead to hard to locate bugs.