UNPKG

datezone

Version:

A lightweight and comprehensive date and timeZone utility library for JavaScript.

65 lines 3.16 kB
import type { TimeZone } from "./timezone.pub.js"; export declare enum WeekStartsOn { SUNDAY = 0, MONDAY = 1, SATURDAY = 6 } export declare function week(timestamp: number, timeZone: TimeZone | null): number; export declare function weekBase(year: number, month: number, day: number): number; export declare function getISOWeekYear(timestamp: number, timeZone: TimeZone | null): number; export declare function getISOWeekYearBase(year: number, month: number, day: number): number; export declare function startOfWeek(timestamp: number, timeZone: TimeZone | null, weekStartsOn?: WeekStartsOn): number; /** * Start of week base. * * @param year - The year. * @param month - The month (1-12). * @param day - The day (1-31). * @param weekStartsOn - The day of the week to start the week on. * @param timeZone - The timezone. * @returns The timestamp for the start of the week. * @see https://datezone.dev/docs/reference/week#startofweekbase */ export declare function startOfWeekBase(year: number, month: number, day: number, weekStartsOn: WeekStartsOn, timeZone: TimeZone): number; export declare function endOfWeek(timestamp: number, timeZone: TimeZone | null, weekStartsOn?: WeekStartsOn): number; /** * End of week base. * * @param year - The year. * @param month - The month (1-12). * @param day - The day (1-31). * @param weekStartsOn - The day of the week to start the week on. * @param timeZone - The timezone. * @returns The timestamp for the end of the week. * @see https://datezone.dev/docs/reference/week#endofweekbase */ export declare function endOfWeekBase(year: number, month: number, day: number, weekStartsOn: WeekStartsOn, timeZone: TimeZone): number; export declare function addWeeks(timestamp: number, amount: number, timeZone: TimeZone | null): number; /** * Add weeks base. * * @param year - The year. * @param month - The month (1-12). * @param day - The day (1-31). * @param amount - The number of weeks to add. * @param timeZone: - The timezone. * @returns The timestamp for the given date plus the given number of weeks. * @see https://datezone.dev/docs/reference/week#addweeksbase */ export declare function addWeeksBase(year: number, month: number, day: number, amount: number, timeZone: TimeZone): number; export declare function subWeeks(timestamp: number, amount: number, timeZone: TimeZone | null): number; export declare function startOfISOWeek(timestamp: number, timeZone: TimeZone | null): number; export declare function endOfISOWeek(timestamp: number, timeZone: TimeZone | null): number; export declare function weeksInMonth(timestamp: number, timeZone: TimeZone | null, weekStartsOn?: WeekStartsOn): number; /** * Weeks in month base. * * @param year - The year. * @param month - The month (1-12). * @param weekStartsOn - The day of the week to start the week on. * @param tz - The timezone. * @returns The number of weeks in the month. * @see https://datezone.dev/docs/reference/week#weeksinmonthbase */ export declare function weeksInMonthBase(year: number, month: number, weekStartsOn: WeekStartsOn, timeZone: TimeZone | null): number; //# sourceMappingURL=week.pub.d.ts.map