@northguild/gmt
Version:
Date and time library for JavaScript and TypeScript, built on TC39 Temporal: time zones, DST, business days, ISO 8601 strings in and out. Never throws.
19 lines • 1.38 kB
TypeScript
import { Temporal } from "./temporal.js";
import { ZoneBucketUnit } from "../types/zone-bucket-unit.js";
import "../types/index.js";
/**
* True when `[start, end)` certainly touches more than `max` buckets of `unit`, decided from the span
* instead of stepping bucket by bucket (which costs milliseconds a step in some zones).
*
* Over a prefix of the range, the local wall clock runs continuously between offset transitions.
* Those stretches cover at least the prefix's length less every backward offset change, in at most
* one stretch more than there are transitions, and each stretch of wall clock holds at least
* `floor(length / LONGEST_UNIT_NANOSECONDS)` distinct unit starts, each the start of its own
* bucket before `end`. The count subtracts two per stretch for the partial units at its ends.
* The bound also holds for a count of distinct local dates, which the free-time walk keeps by
* folding a day that re-enters an earlier date: a date can re-enter only at an offset transition,
* where the two units dropped per stretch already sit, and the starts counted inside one stretch
* fall on strictly increasing dates.
* `false` means "not certain": the walk decides, exactly as before.
*/
export declare function certainlyTouchesMoreBuckets(startZoned: Temporal.ZonedDateTime, endZoned: Temporal.ZonedDateTime, unit: ZoneBucketUnit, max: number): boolean;