Liking cljdoc? Tell your friends :D

dk.simongray.podcast.util.time

Dates and durations as they appear in feeds, parsed leniently and formatted canonically, from arithmetic and regular expressions alone so that the JVM and JavaScript agree.

Instants are inst values, java.util.Date or js/Date. Durations and timestamps within media are seconds: a long when whole, and a double otherwise.

Dates and durations as they appear in feeds, parsed leniently and
formatted canonically, from arithmetic and regular expressions alone so
that the JVM and JavaScript agree.

Instants are inst values, java.util.Date or js/Date. Durations and
timestamps within media are seconds: a long when whole, and a double
otherwise.
raw docstring

->instclj/s

(->inst ms)

The instant ms milliseconds after the epoch.

The instant `ms` milliseconds after the epoch.
sourceraw docstring

dateclj/s

(date inst)

The instant inst, of any kind that inst? takes, as the instant of the platform: java.util.Date on the JVM, and js/Date in JavaScript.

A java.time.Instant, which EDN can't print, comes out as one that EDN writes as an inst.

The instant `inst`, of any kind that inst? takes, as the instant of the
platform: java.util.Date on the JVM, and js/Date in JavaScript.

A java.time.Instant, which EDN can't print, comes out as one that EDN
writes as an inst.
sourceraw docstring

earliestclj/s

(earliest & instants)

The earliest of the instants, with nils left out, or nil when none is left, e.g. a due time brought forward to the longest wait of an app.

The earliest of the `instants`, with nils left out, or nil when none is
left, e.g. a due time brought forward to the longest wait of an app.
sourceraw docstring

finite?clj/s

(finite? x)

Whether x is a number that's neither infinite nor NaN.

Whether `x` is a number that's neither infinite nor NaN.
sourceraw docstring

floor-secondsclj/s

(floor-seconds inst)

The instant inst with its milliseconds dropped, the precision an RFC 2822 date can carry.

The instant `inst` with its milliseconds dropped, the precision an RFC
2822 date can carry.
sourceraw docstring

format-clockclj/s

(format-clock seconds)

The seconds as "H:MM:SS", or "M:SS" under an hour, without any fraction of a second and with a minus sign when negative. It's nil when seconds isn't a number, or is beyond max-whole.

The `seconds` as "H:MM:SS", or "M:SS" under an hour, without any
fraction of a second and with a minus sign when negative. It's nil when
`seconds` isn't a number, or is beyond max-whole.
sourceraw docstring

format-iso8601clj/s

(format-iso8601 inst)

The instant inst as ISO 8601 in UTC, e.g. "2026-09-25T16:42:40Z", with milliseconds only when they aren't zero.

The instant `inst` as ISO 8601 in UTC, e.g. "2026-09-25T16:42:40Z", with
milliseconds only when they aren't zero.
sourceraw docstring

format-rfc2822clj/s

(format-rfc2822 inst)

The instant inst as an RFC 2822 date in GMT, e.g. "Fri, 25 Sep 2026 16:42:40 GMT".

The instant `inst` as an RFC 2822 date in GMT, e.g.
"Fri, 25 Sep 2026 16:42:40 GMT".
sourceraw docstring

format-timestampclj/s

(format-timestamp seconds)
(format-timestamp seconds separator)

The seconds as the "HH:MM:SS.mmm" timestamp of WebVTT and Podlove Simple Chapters, or of SRT with "," as separator.

A negative time, which those formats lack, is zero. It's nil when seconds isn't a number, or is beyond max-whole.

The `seconds` as the "HH:MM:SS.mmm" timestamp of WebVTT and Podlove
Simple Chapters, or of SRT with "," as `separator`.

A negative time, which those formats lack, is zero. It's nil when
`seconds` isn't a number, or is beyond max-whole.
sourceraw docstring

laterclj/s

(later at seconds)

The instant seconds after the instant at.

The instant `seconds` after the instant `at`.
sourceraw docstring

latestclj/s

(latest & instants)

The latest of the instants, with nils left out, or nil when none is left, e.g. a due time held back by the not-before of a server.

The latest of the `instants`, with nils left out, or nil when none is
left, e.g. a due time held back by the not-before of a server.
sourceraw docstring

nowclj/s

(now)

The instant now, by the clock of the platform.

The instant now, by the clock of the platform.
sourceraw docstring

parse-clockclj/s

(parse-clock s)

The seconds of the clock-style timestamp s, such as "1:02:03", "02:03", "00:00:02.760" or the SRT-style "00:00:02,760", or nil when s isn't one. Without hours, the minutes can pass 59, e.g. "103:12".

The seconds of the clock-style timestamp `s`, such as "1:02:03",
"02:03", "00:00:02.760" or the SRT-style "00:00:02,760", or nil when
`s` isn't one. Without hours, the minutes can pass 59, e.g. "103:12".
sourceraw docstring

parse-dateclj/s

(parse-date s)

The instant of s as an RFC 2822 date, or else as ISO 8601, or nil when it's neither.

The instant of `s` as an RFC 2822 date, or else as ISO 8601, or nil when
it's neither.
sourceraw docstring

parse-durationclj/s

(parse-duration s)

The seconds of the duration s, as itunes:duration writes it, or nil when it doesn't read. It's plain seconds, e.g. "3793" or "3793.5", or a clock, e.g. "1:03:13" or "63:13".

The seconds of the duration `s`, as itunes:duration writes it, or nil
when it doesn't read. It's plain seconds, e.g. "3793" or "3793.5", or
a clock, e.g. "1:03:13" or "63:13".
sourceraw docstring

parse-iso8601clj/s

(parse-iso8601 s)

The instant of the ISO 8601 date or date-time s, or nil, as for a day or a time that doesn't exist. A missing zone reads as UTC.

The instant of the ISO 8601 date or date-time `s`, or nil, as for a day
or a time that doesn't exist. A missing zone reads as UTC.
sourceraw docstring

parse-rfc2822clj/s

(parse-rfc2822 s)

The instant of the RFC 2822 date s, or nil when it isn't a date at all, or names a day or a time that doesn't exist, such as 31 February.

It forgives the deviations that feeds are known for:

  • a missing weekday
  • full month names
  • two-digit years
  • zone names
  • missing seconds
  • a missing or unknown zone, which reads as UTC
The instant of the RFC 2822 date `s`, or nil when it isn't a date at
all, or names a day or a time that doesn't exist, such as 31 February.

It forgives the deviations that feeds are known for:

- a missing weekday
- full month names
- two-digit years
- zone names
- missing seconds
- a missing or unknown zone, which reads as UTC
sourceraw docstring

rfc2822-strict?clj/s

(rfc2822-strict? s)

Whether s is a date that RFC 2822 permits, written the way that RSS feeds are expected to write it, on a day and at a time that exist.

Whether `s` is a date that RFC 2822 permits, written the way that RSS
feeds are expected to write it, on a day and at a time that exist.
sourceraw docstring

secondsclj/s

(seconds x)

The number of seconds that x denotes: a number as it is, or a numeric or clock string as itunes:duration writes it, and nil for anything else.

The number of seconds that `x` denotes: a number as it is, or a numeric
or clock string as itunes:duration writes it, and nil for anything
else.
sourceraw docstring

unix-secondsclj/s

(unix-seconds inst)

The whole seconds from the epoch to the instant inst, as Unix time counts them.

The whole seconds from the epoch to the instant `inst`, as Unix time
counts them.
sourceraw docstring

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
←Move to previous article
→Move to next article
Ctrl+/Jump to the search field
× close