Add `datetime-span` and refactor a few lines