Fix issue with rendering epoch date

This address the issue with formatting the epoch timestamp, `0`, and also refactors the code so that it's more organized and DRY.