Reformated datepicker code