Smarter date handling