@somnia-chain/markets-sdk


@somnia-chain/markets-sdk / index / formatIntervalLabel

Function: formatIntervalLabel()

formatIntervalLabel(sec): string | null

Defined in: packages/sdk/src/interval.ts:76

Compact human label for a cadence in SECONDS, in the largest unit up to hours that divides it cleanly: 600 → "10m", 900 → "15m", 3600 → "1h", 14400 → "4h", 86400 → "24h", 172800 → "48h", 90 → "90s". Returns null on non-finite/non-positive input (callers pick their own placeholder). Does NOT snap — pass a snapped value, or use marketIntervalLabel, to first shed off-by-one-second noise.

Parameters

sec

number

Returns

string | null