Added duration formatting function and unit tests for extensions