Spec-Zone.ru › htmx

htmx.parseInterval()

Parses time intervals to milliseconds

The htmx.parseInterval() function parses time interval strings into milliseconds.

Syntax

htmx.parseInterval(str)

Parameters

  • str - Time interval as number or string (e.g., “2s”, “500ms”, “1m”)

Supported Units

  • ms - milliseconds (default if no unit specified)
  • s - seconds
  • m - minutes

Example

htmx.parseInterval(1000)      // 1000 (already in ms)
htmx.parseInterval("2s")      // 2000
htmx.parseInterval("500ms")   // 500
htmx.parseInterval("1.5m")    // 90000

Return Value

Returns the interval in milliseconds, or undefined if parsing fails.

Licensed under the Zero-Clause BSD License.
https://four.htmx.org/reference/methods/htmx-parseInterval/

Spec-Zone.ru

Настройки Оффлайн Что нового Помощь О нас
Spec-Zone .ru
спецификации, руководства, описания, API