@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.
24 lines • 1.5 kB
TypeScript
import { YearMonth } from "./nonIsoArithmetic.js";
/**
* Months in every year of `calendarId`, read from the runtime, or undefined for a calendar with
* leap months. Measuring it asks the polyfill about a modern year only.
*/
export declare function fixedMonthsPerYearOf(calendarId: string): number | undefined;
/** True when an amount of months is large enough for the year jumps. */
export declare function isLargeMonthSpan(months: number): boolean;
/** True when two calendar years are far enough apart for the year jumps. */
export declare function isLargeYearSpan(fromYear: number, toYear: number): boolean;
type AddMonths = (start: YearMonth, months: number) => YearMonth | null;
type MonthsBetween = (from: YearMonth, to: YearMonth) => number;
/**
* `BalanceNonISODate(start.year, start.month + months, 1)` for a large `months`: step to the next
* (or previous) year start, jump whole years, and let `addSmall` finish the few years left.
* `null` when the result lies outside the range.
*/
export declare function addManyMonths(calendarId: string, start: YearMonth, months: number, addSmall: AddMonths, betweenSmall: MonthsBetween): YearMonth | null;
/**
* The signed month count from `from` to `to` (both month starts in range) when they are years
* apart: the months to the first whole year, the whole years, and the months after the last.
*/
export declare function countManyMonths(calendarId: string, from: YearMonth, to: YearMonth, betweenSmall: MonthsBetween): number;
export {};