UNPKG

1.68 kBTypeScriptView Raw
1import { NgbDateStruct } from './ngb-date-struct';
2/**
3 * A simple class that represents a date that datepicker also uses internally.
4 *
5 * It is the implementation of the `NgbDateStruct` interface that adds some convenience methods,
6 * like `.equals()`, `.before()`, etc.
7 *
8 * All datepicker APIs consume `NgbDateStruct`, but return `NgbDate`.
9 *
10 * In many cases it is simpler to manipulate these objects together with
11 * [`NgbCalendar`](#/components/datepicker/api#NgbCalendar) than native JS Dates.
12 *
13 * See the [date format overview](#/components/datepicker/overview#date-model) for more details.
14 *
15 * @since 3.0.0
16 */
17export declare class NgbDate implements NgbDateStruct {
18 /**
19 * The year, for example 2016
20 */
21 year: number;
22 /**
23 * The month, for example 1=Jan ... 12=Dec as in ISO 8601
24 */
25 month: number;
26 /**
27 * The day of month, starting with 1
28 */
29 day: number;
30 /**
31 * A **static method** that creates a new date object from the `NgbDateStruct`,
32 *
33 * ex. `NgbDate.from({year: 2000, month: 5, day: 1})`.
34 *
35 * If the `date` is already of `NgbDate` type, the method will return the same object.
36 */
37 static from(date?: NgbDateStruct | null): NgbDate | null;
38 constructor(year: number, month: number, day: number);
39 /**
40 * Checks if the current date is equal to another date.
41 */
42 equals(other?: NgbDateStruct | null): boolean;
43 /**
44 * Checks if the current date is before another date.
45 */
46 before(other?: NgbDateStruct | null): boolean;
47 /**
48 * Checks if the current date is after another date.
49 */
50 after(other?: NgbDateStruct | null): boolean;
51}