Refactored date type to minimize duplicate code