npm.io
1.5.6 • Published 11 months ago

@types/moment-holiday

Licence
MIT
Version
1.5.6
Deps
1
Size
7 kB
Vulns
0
Weekly
0
Stars
51.5K

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 moment = require("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: Fri, 24 Oct 2025 0441 GMT
  • Dependencies: moment

Credits

These definitions were written by Robert Winslow Dalpe.