refactor date formatting