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
(duration x)Converts a numeric or string value into a duration in milliseconds.
Accepts:
Supported units:
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.
(ex-invalid! x & [e])Throws an ex-info exception indicating an invalid duration input.
Throws an ex-info exception indicating an invalid duration input.
(to-ms unit x)Converts a value to milliseconds based on the given time unit. Parameters:
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.
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |