UNPKG

@skolacode/calendar-js

Version:

Simple JavaScript calendar generator

36 lines (35 loc) 1.23 kB
export declare type TWeekdays = 'Sunday' | 'Monday' | 'Tuesday' | 'Wednesday' | 'Thursday' | 'Friday' | 'Saturday'; export declare type TNextMonth = { nextMonth: number; nextYear: number; }; export declare type TPreviousMonth = { previousMonth: number; previousYear: number; }; export declare const daysInMonth: (month: number, year: number) => number; export declare type TDate = { date: Date; day: number; isCurrentMonth: boolean; weekday: TWeekdays; }; export interface ICalendar { calendar: TDate[][]; month: number; year: number; next: { month: number; year: number; }; previous: { month: number; year: number; }; } export declare type TStartingDay = 0 | 'SUNDAY' | 'Sunday' | 'sunday' | 1 | 'MONDAY' | 'Monday' | 'monday' | 2 | 'TUESDAY' | 'Tuesday' | 'tuesday' | 3 | 'WEDNESDAY' | 'Wednesday' | 'wednesday' | 4 | 'THURSDAY' | 'Thursday' | 'thursday' | 5 | 'FRIDAY' | 'Friday' | 'friday' | 6 | 'SATURDAY' | 'Saturday' | 'saturday'; export interface IOptions { startingDay?: TStartingDay | number; extraWeek?: boolean; } export declare const getCalendar: (month: number, year: number, options?: IOptions | number) => ICalendar;