Move duration formatting out to lib