docs: document time formatting helpers · openclaw/openclaw@c9c8125
steipete
·
2026-06-05
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
|
| 1 | +// Duration formatting helpers produce compact, precise, and human display |
| 2 | +// strings from millisecond values. |
1 | 3 | export type FormatDurationSecondsOptions = { |
2 | 4 | decimals?: number; |
3 | 5 | unit?: "s" | "seconds"; |
|
| Original file line number | Diff line number | Diff line change |
|---|
|
| 1 | +// Covers duration, UTC/zoned timestamp, timezone, and relative time formatting. |
1 | 2 | import { afterEach, beforeEach, describe, expect, it, vi } from "vitest"; |
2 | 3 | import { formatUtcTimestamp, formatZonedTimestamp, resolveTimezone } from "./format-datetime.js"; |
3 | 4 | import { |
|
| Original file line number | Diff line number | Diff line change |
|---|
|
| 1 | +// Covers offsetless ISO datetime detection, timezone conversion, DST gaps, and |
| 2 | +// sub-second round trips. |
1 | 3 | import { describe, expect, it } from "vitest"; |
2 | 4 | import { |
3 | 5 | isOffsetlessIsoDateTime, |
|
| Original file line number | Diff line number | Diff line change |
|---|
|
| 1 | +// Offsetless zoned datetime parsing interprets local wall-clock ISO strings in |
| 2 | +// an explicit IANA time zone and rejects impossible DST times. |
1 | 3 | const OFFSETLESS_ISO_DATETIME_RE = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}(:\d{2})?(\.\d+)?$/; |
2 | 4 | const OFFSETLESS_ISO_DATETIME_PARTS_RE = |
3 | 5 | /^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2})(?::(\d{2})(?:\.(\d+))?)?$/; |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。