UNPKG

@botonic/plugin-contentful

Version:

Botonic Plugin Contentful is one of the **[available](https://github.com/hubtype/botonic/tree/master/packages)** plugins for Botonic. **[Contentful](http://www.contentful.com)** is a CMS (Content Management System) which manages contents of a great variet

65 lines (64 loc) 2.18 kB
/** * Manages ranges of hour/minutes for each day of a week. * The hour/minutes refer to the specified timezone. * Use {@link addException} to add holidays (eg with empty {@link TimeRange}) or sales openings in weekends * TODO consider using everywhere Date.toLocaleTimeString() to remove moment-timezone dependency */ export declare class Schedule { static TZ_CET: string; private readonly zone; private readonly scheduleByDay; private readonly exceptions; constructor(tzName: string); createHourAndMinute(hour: number, minute?: number): HourAndMinute; addDaySchedule(weekday: WeekDay, daySchedule: DaySchedule): Schedule; /** * For the specified date, the weekly schedule will be superseded by the daySchedule specified here */ addException(date: Date, daySchedule: DaySchedule): Schedule; /** * Formats the specified date using the {@link Schedule}'s timezone. * @param locales don't confuse with timezone. This is just to format the date */ timeInThisTimezone(locales?: string | string[], date?: Date): string; contains(inDate: Date): boolean; } export declare class ScheduleAlwaysOn extends Schedule { constructor(); contains(_date: Date): boolean; } export declare class DaySchedule { readonly ranges: TimeRange[]; constructor(ranges: TimeRange[]); contains(date: Date): boolean; } export declare enum WeekDay { SUNDAY = 0, MONDAY = 1, TUESDAY = 2, WEDNESDAY = 3, THURSDAY = 4, FRIDAY = 5, SATURDAY = 6 } export declare class TimeRange { readonly from: HourAndMinute; readonly to: HourAndMinute; /** * @param from inclusive * @param to exclusive if 00:00, it will be interpreted as 24:00 */ constructor(from: HourAndMinute, to: HourAndMinute); contains(date: Date): boolean; } export declare class HourAndMinute { readonly hour: number; readonly minute: number; constructor(hour: number, minute?: number); compareToDate(date: Date): number; isMidnight(): boolean; private static compareNumber; compare(other: HourAndMinute): number; private toMinutes; toString(): string; }