/** Calendar code extracted from https://github.com/phensley/cldr-engine/ Copyright 2018-present Patrick Hensley Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ import { ZoneInfo } from '@phensley/timezone'; export type CalendarFromUnixEpoch = (epoch: number, zoneId: string, firstDay: number, minDays: number) => T; /** * Base class for dates in supported calendars. * * @alpha */ export declare abstract class CalendarDate { protected readonly _firstDay: number; protected readonly _minDays: number; protected _fields: number[]; protected _zoneInfo: ZoneInfo; /** * Minimal fields required to construct any calendar date. */ protected constructor(_firstDay: number, _minDays: number); /** * Unix epoch with no timezone offset. */ unixEpoch(): number; firstDayOfWeek(): number; minDaysInFirstWeek(): number; /** * Returns a floating point number representing the real Julian Day, UTC. */ julianDay(): number; /** * CLDR's modified Julian day used as the basis for all date calculations. */ modifiedJulianDay(): number; era(): number; extendedYear(): number; year(): number; relatedYear(): number; yearOfWeekOfYear(): number; weekOfYear(): number; yearOfWeekOfYearISO(): number; weekOfYearISO(): number; /** * Ordinal month, one-based, e.g. Gregorian JANUARY = 1. */ month(): number; /** * Returns the week of the month computed using the locale's 'first day * of week' and 'minimal days in first week' where applicable. * * For example, for the United States, weeks start on Sunday. * Saturday 9/1/2018 would be in week 1, and Sunday 9/2/2018 would * begin week 2. * * September * Su Mo Tu We Th Fr Sa * 1 * 2 3 4 5 6 7 8 * 9 10 11 12 13 14 15 * 16 17 18 19 20 21 22 * 23 24 25 26 27 28 29 * 30 */ weekOfMonth(): number; dayOfYear(): number; /** * Day of the week. 1 = SUNDAY, 2 = MONDAY, ..., 7 = SATURDAY */ dayOfWeek(): number; /** * Ordinal day of the week. 1 if this is the 1st day of the week, * 2 if the 2nd, etc. Depends on the local starting day of the week. */ ordinalDayOfWeek(): number; /** * Ordinal number indicating the day of the week in the current month. * The result of this method can be used to format messages like * "2nd Sunday in August". */ dayOfWeekInMonth(): number; dayOfMonth(): number; isAM(): boolean; /** * Indicates the hour of the morning or afternoon, used for the 12-hour * clock (0 - 11). Noon and midnight are 0, not 12. */ hour(): number; /** * Indicates the hour of the day, used for the 24-hour clock (0 - 23). * Noon is 12 and midnight is 0. */ hourOfDay(): number; /** * Indicates the minute of the hour (0 - 59). */ minute(): number; /** * Indicates the second of the minute (0 - 59). */ second(): number; milliseconds(): number; millisecondsInDay(): number; timeZoneId(): string; timeZoneAbbr(): string; timeZoneOffset(): number; isLeapYear(): boolean; isDaylightSavings(): boolean; abstract withZone(zoneId: string): CalendarDate; protected abstract initFields(f: number[]): void; protected abstract monthCount(): number; protected abstract daysInMonth(y: number, m: number): number; protected abstract daysInYear(y: number): number; protected abstract monthStart(eyear: number, month: number, useMonth: boolean): number; protected initFromUnixEpoch(ms: number, zoneId: string): void; protected initFromJD(jd: number, msDay: number, zoneId: string): void; /** * Compute WEEK_OF_YEAR and YEAR_WOY on demand. */ protected computeWeekFields(): void; protected _computeWeekFields(woyfield: number, ywoyfield: number, firstDay: number, minDays: number, dow: number, _dom: number, doy: number): void; protected yearLength(y: number): number; protected weekNumber(firstDay: number, minDays: number, desiredDay: number, dayOfPeriod: number, dayOfWeek: number): number; protected utcfields(): number[]; }