visiting-hours
Version:
An advanced, feature rich, optimised and tiny visiting-hours library.
42 lines (41 loc) • 1.98 kB
TypeScript
import { RegularHoursInterface } from './Interface/RegularHoursInterface';
import { IndexInterface } from './Interface/IndexInterface';
import { HoursDayInterface } from './Interface/HoursDayInterface';
import { SpecialIndexInterface } from './Interface/SpecialIndexInterface';
import { DateInputInterface } from './Interface/DateInputInterface';
import { LuxonShapeInterface } from './Interface/LuxonShapeInterface';
import { VisitingHour } from './VisitingHour';
export declare class Utils {
static leapYearKey: string;
static postLeapYearKey: string;
static dayNames: string[];
static isLeapYear(date: Date): boolean;
static dayNumber(name: string): number;
static dayName(index: number): string;
/**
* Create an array of times between `startAt` and `endAt` with an interval of `interval` minutes.
* Each entry in the array is a VisitingHour instance for easy manipulation.
*
* Example: minuteInterval('07:55', '09:00', 15); // ['08:00', '08:15', '08:30', '08:45', '09:00']
*
* @param startAt
* @param endAt
* @param interval
* @param {Date} [forDate] What date the range is for. Adds a timestamp to the VisitingHour.
*/
static minuteInterval(startAt: string, endAt: string, interval?: number, forZone?: string, forDate?: Date): VisitingHour[];
static fromLuxon(date: LuxonShapeInterface): DateInputInterface;
static fromDate(inputDate: Date, zone?: string): DateInputInterface;
static dateName(date?: Date): string;
static nextDay(day: number): DayNumber;
static toMilitary(hours: number, minutes: number): string;
static buildSpecialIndex(special: HoursDayInterface[]): SpecialIndexInterface;
static buildIndex(regular: RegularHoursInterface): IndexInterface;
static timeValues({ open, close }: {
open: string;
close: string;
}): number[];
private static makeDayIndex;
}
declare type DayNumber = 0 | 1 | 2 | 3 | 4 | 5 | 6;
export {};