Function rollingQueryDateRange

  • Get a query range appropriate for a given aggregate level.

    Returns an object with start and end Date properties, using the given endDate parameter as the basis for calculating the start as an offset backwards in time based on the given aggregate level.

    The aggregateTimeCount will be treated as a "next higher" aggregate level from aggregate, like this:

    • < Hour: numHours
    • Hour : numDays
    • Day : numMonths
    • Month : numYears

    For example, you might like to render a chart using TenMinute aggregate data for the last 24 hours. You'd call this function like this:

    const range = rollingQueryDateRange(Aggregates.TenMinute, 24);

    // or, passing a DateRangeConfiguration
    const range = rollingQueryDateRange(Aggregates.TenMinute, {numHours:24});

    Parameters

    • aggregate: Aggregation

      the aggregate level to get a query range for

    • aggregateTimeCount: number | DateRangeConfiguration

      the number of aggregate time units to use

    • Optional endDate: Date

      the ending date; if not provided the current date will be used

    Returns DateRange

    the calculated date range

Generated using TypeDoc