Liking cljdoc? Tell your friends :D

s-exp.duration

Utilities for parsing and converting durations from strings or numbers to milliseconds. Supports parsing multiple time units (e.g., "2h30m") and throws when inputs are invalid

Utilities for parsing and converting durations from strings or numbers to milliseconds.
Supports parsing multiple time units (e.g., "2h30m") and throws when inputs
are invalid
raw docstring

day-msclj/s


durationclj/s

(duration x)

Converts a numeric or string value into a duration in milliseconds.

Accepts:

  • Strings such as: "1ms", "2h30m", etc. (composing multiple values)
  • Numeric param value is interpreted as milliseconds directly.

Supported units:

  • ms: milliseconds
  • s: seconds
  • m: minutes
  • h: hours
  • d: days
  • w: weeks
  • M: months (30 days)
  • Y: years (12*30 days)

Throws if the input is invalid.

Converts a numeric or string value into a duration in milliseconds.

Accepts:
- Strings such as: "1ms", "2h30m", etc. (composing multiple values)
- Numeric param value is interpreted as milliseconds directly.

Supported units:
- ms: milliseconds
- s: seconds
- m: minutes
- h: hours
- d: days
- w: weeks
- M: months (30 days)
- Y: years (12*30 days)

Throws if the input is invalid.
raw docstring

ex-invalid!clj/s

(ex-invalid! x & [e])

Throws an ex-info exception indicating an invalid duration input.

Throws an ex-info exception indicating an invalid duration input.
raw docstring

hour-msclj/s


minute-msclj/s


month-msclj/s


second-msclj/s


to-msclj/s

(to-ms unit x)

Converts a value to milliseconds based on the given time unit. Parameters:

  • unit: a string, one of "ms", "s", "m", "h", "d", "w", "M", "Y".
  • x: numeric value for the unit. Returns the corresponding number of milliseconds.
Converts a value to milliseconds based on the given time unit.
Parameters:
- unit: a string, one of "ms", "s", "m", "h", "d", "w", "M", "Y".
- x: numeric value for the unit.
Returns the corresponding number of milliseconds.
raw docstring

week-msclj/s


year-msclj/s

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