format durations on web pages by automatically choosing an appropriate time unit