juxt 2022-12-06

Hello! Is there any way to do this?

87 seconds -> 00:01:27
I found
(tick/new-duration 87 :seconds)
But whats next? 😃

This feels a bit hacky, but works:

(t/format (t/formatter "HH:mm:ss") (t/+ (t/midnight) (t/new-duration 87 :seconds)))
;; => "00:01:27"
Otherwise I think you'd have to do it manually:
(let [duration (t/new-duration 87 :seconds)
      hours (t/hours duration)
      minutes (rem (t/minutes duration) 60)
      seconds (rem (t/seconds duration) 60)]
  (format "%02d:%02d:%02d" hours minutes seconds))
;; => "00:01:27"