Skip to content
EliteChart

timeBounds

Documentation


Documentation / @elitechart/core / timeBounds

code
function timeBounds(bars, range): MinMax | null;

Defined in: math/bounds.ts:61

Compute the time range [from, to] over the given bar sub-range.

Parameters

bars

readonly Bar[]

range

BarRange

Returns

MinMax | null

null when the sub-range is empty.

Example

code
import { timeBounds } from '@elitechart/core';
const t = timeBounds(bars, { start: 0, end: bars.length });
if (t !== null) console.log(new Date(t.min), new Date(t.max));