added handling for date and datetime objects