Refactoring date/time canonicalization functions.