@types/moment-holiday
TypeScript icon, indicating that this package has built-in type declarations

1.5.5 • Public • Published

Installation

npm install --save @types/moment-holiday

Summary

This package contains type definitions for moment-holiday (https://github.com/kodie/moment-holiday).

Details

Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/moment-holiday.

index.d.ts

import * as moment from "moment";

declare module "moment" {
    interface Moment extends Object {
        holiday(
            holidays?: string[] | string,
            adjust?: boolean,
        ): Moment | false | { [holidayName: string]: Moment };

        holidays(
            holidays?: string[] | string,
            adjust?: boolean,
        ): Moment | false | { [holidayName: string]: Moment };

        isHoliday(
            holidays?: string[] | string | null,
            adjust?: boolean,
        ): boolean | string | string[];

        previousHoliday(count?: number, adjust?: boolean): Moment[] | Moment;

        previousHolidays(count?: number, adjust?: boolean): Moment[] | Moment;

        nextHoliday(count?: number, adjust?: boolean): Moment[] | Moment;

        nextHolidays(count?: number, adjust?: boolean): Moment[] | Moment;

        holidaysBetween(m: Moment, adjust?: boolean): Moment[] | false;
    }

    interface HolidayDefinition {
        date: string;
        keywords?: string[] | undefined;
        keywords_y?: string[] | undefined;
        keywords_n?: string[] | undefined;
        regions?: string[] | undefined;
        regions_n?: string[] | undefined;
    }

    interface HolidaysMapping {
        [holidayName: string]: HolidayDefinition;
    }

    interface Holidays {
        active: HolidaysMapping;
        active_last: HolidaysMapping;
    }

    interface HolidayModifier {
        set(
            holidays: HolidaysMapping | string | string[],
            specifics?: any,
        ): HolidayModifier;

        add(
            holidays: HolidaysMapping | string,
            specifics?: any,
        ): HolidayModifier;

        remove(holidays: string | string[]): HolidayModifier;

        undo(): HolidayModifier;

        load(locales: string | string[]): HolidayModifier;

        // eslint-disable-next-line @typescript-eslint/no-invalid-void-type
        extendParser(parserFunc: (m: Moment, date: string) => Moment | Moment[] | false | void): HolidayModifier;
    }

    let holidays: Holidays;
    let modifyHolidays: HolidayModifier;
}

Additional Details

  • Last updated: Wed, 22 Nov 2023 00:24:48 GMT
  • Dependencies: moment

Credits

These definitions were written by Robert Winslow Dalpe.

Readme

Keywords

none

Package Sidebar

Install

npm i @types/moment-holiday

Weekly Downloads

877

Version

1.5.5

License

MIT

Unpacked Size

6.87 kB

Total Files

5

Last publish

Collaborators

  • types