1 | import { NgbDate } from './ngb-date';
|
2 | export declare function fromJSDate(jsDate: Date): NgbDate;
|
3 | export declare function toJSDate(date: NgbDate): Date;
|
4 | export declare type NgbPeriod = 'y' | 'm' | 'd';
|
5 | export declare function NGB_DATEPICKER_CALENDAR_FACTORY(): NgbCalendarGregorian;
|
6 | /**
|
7 | * A service that represents the calendar used by the datepicker.
|
8 | *
|
9 | * The default implementation uses the Gregorian calendar. You can inject it in your own
|
10 | * implementations if necessary to simplify `NgbDate` calculations.
|
11 | */
|
12 | export declare abstract class NgbCalendar {
|
13 | /**
|
14 | * Returns the number of days per week.
|
15 | */
|
16 | abstract getDaysPerWeek(): number;
|
17 | /**
|
18 | * Returns an array of months per year.
|
19 | *
|
20 | * With default calendar we use ISO 8601 and return [1, 2, ..., 12];
|
21 | */
|
22 | abstract getMonths(year?: number): number[];
|
23 | /**
|
24 | * Returns the number of weeks per month.
|
25 | */
|
26 | abstract getWeeksPerMonth(): number;
|
27 | /**
|
28 | * Returns the weekday number for a given day.
|
29 | *
|
30 | * With the default calendar we use ISO 8601: 'weekday' is 1=Mon ... 7=Sun
|
31 | */
|
32 | abstract getWeekday(date: NgbDate): number;
|
33 | /**
|
34 | * Adds a number of years, months or days to a given date.
|
35 | *
|
36 | * * `period` can be `y`, `m` or `d` and defaults to day.
|
37 | * * `number` defaults to 1.
|
38 | *
|
39 | * Always returns a new date.
|
40 | */
|
41 | abstract getNext(date: NgbDate, period?: NgbPeriod, number?: number): NgbDate;
|
42 | /**
|
43 | * Subtracts a number of years, months or days from a given date.
|
44 | *
|
45 | * * `period` can be `y`, `m` or `d` and defaults to day.
|
46 | * * `number` defaults to 1.
|
47 | *
|
48 | * Always returns a new date.
|
49 | */
|
50 | abstract getPrev(date: NgbDate, period?: NgbPeriod, number?: number): NgbDate;
|
51 | /**
|
52 | * Returns the week number for a given week.
|
53 | */
|
54 | abstract getWeekNumber(week: readonly NgbDate[], firstDayOfWeek: number): number;
|
55 | /**
|
56 | * Returns the today's date.
|
57 | */
|
58 | abstract getToday(): NgbDate;
|
59 | /**
|
60 | * Checks if a date is valid in the current calendar.
|
61 | */
|
62 | abstract isValid(date?: NgbDate | null): boolean;
|
63 | }
|
64 | export declare class NgbCalendarGregorian extends NgbCalendar {
|
65 | getDaysPerWeek(): number;
|
66 | getMonths(): number[];
|
67 | getWeeksPerMonth(): number;
|
68 | getNext(date: NgbDate, period?: NgbPeriod, number?: number): NgbDate;
|
69 | getPrev(date: NgbDate, period?: NgbPeriod, number?: number): NgbDate;
|
70 | getWeekday(date: NgbDate): number;
|
71 | getWeekNumber(week: readonly NgbDate[], firstDayOfWeek: number): number;
|
72 | getToday(): NgbDate;
|
73 | isValid(date?: NgbDate | null): boolean;
|
74 | }
|