add check for date validity