Added valid.dates to function env