add validation function for date