WardrikDaemon.CLI.Clock (wardrik_daemon v0.1.0-rc.1)

Copy Markdown

Formats times and counts for the CLI, in few characters.

Summary

Functions

Returns count in few characters, as 950, 12.3k or 1.2M.

Returns how long from now until at, an ISO 8601 time, as in 45m or in 3h 10m. Returns nil for nil.

Functions

amount(count)

@spec amount(non_neg_integer()) :: String.t()

Returns count in few characters, as 950, 12.3k or 1.2M.

from_now(at, now \\ DateTime.utc_now())

@spec from_now(String.t() | nil, DateTime.t()) :: String.t() | nil

Returns how long from now until at, an ISO 8601 time, as in 45m or in 3h 10m. Returns nil for nil.

WardrikDaemon.CLI.Clock.from_now("2026-10-27T16:00:00Z", ~U[2026-10-27 12:50:00Z])
#=> "in 3h 10m"