Move metadata formatting to helpers

Move document metadata formatting into helper methods and remove the complexity from the view.
Move time formatting to i18n