refactor Duration._toStringImpl to reduce code and object size