minor refactoring for date handling