Creating custom datepicker to avoid code duplication