UNPKG

3.54 kBTypeScriptView Raw
1import { DateAdapter } from '@angular/material/core';
2import * as i0 from '@angular/core';
3import { InjectionToken } from '@angular/core';
4import { MatDateFormats } from '@angular/material/core';
5import { Moment } from 'moment';
6
7/** InjectionToken for moment date adapter to configure options. */
8export declare const MAT_MOMENT_DATE_ADAPTER_OPTIONS: InjectionToken<MatMomentDateAdapterOptions>;
9
10/** @docs-private */
11export declare function MAT_MOMENT_DATE_ADAPTER_OPTIONS_FACTORY(): MatMomentDateAdapterOptions;
12
13export declare const MAT_MOMENT_DATE_FORMATS: MatDateFormats;
14
15/** Configurable options for {@see MomentDateAdapter}. */
16export declare interface MatMomentDateAdapterOptions {
17 /**
18 * When enabled, the dates have to match the format exactly.
19 * See https://momentjs.com/guides/#/parsing/strict-mode/.
20 */
21 strict?: boolean;
22 /**
23 * Turns the use of utc dates on or off.
24 * Changing this will change how Angular Material components like DatePicker output dates.
25 * {@default false}
26 */
27 useUtc?: boolean;
28}
29
30export declare class MatMomentDateModule {
31 static ɵfac: i0.ɵɵFactoryDeclaration<MatMomentDateModule, never>;
32 static ɵmod: i0.ɵɵNgModuleDeclaration<MatMomentDateModule, never, [typeof MomentDateModule], never>;
33 static ɵinj: i0.ɵɵInjectorDeclaration<MatMomentDateModule>;
34}
35
36/** Adapts Moment.js Dates for use with Angular Material. */
37export declare class MomentDateAdapter extends DateAdapter<Moment> {
38 private _options?;
39 private _localeData;
40 constructor(dateLocale: string, _options?: MatMomentDateAdapterOptions | undefined);
41 setLocale(locale: string): void;
42 getYear(date: Moment): number;
43 getMonth(date: Moment): number;
44 getDate(date: Moment): number;
45 getDayOfWeek(date: Moment): number;
46 getMonthNames(style: 'long' | 'short' | 'narrow'): string[];
47 getDateNames(): string[];
48 getDayOfWeekNames(style: 'long' | 'short' | 'narrow'): string[];
49 getYearName(date: Moment): string;
50 getFirstDayOfWeek(): number;
51 getNumDaysInMonth(date: Moment): number;
52 clone(date: Moment): Moment;
53 createDate(year: number, month: number, date: number): Moment;
54 today(): Moment;
55 parse(value: any, parseFormat: string | string[]): Moment | null;
56 format(date: Moment, displayFormat: string): string;
57 addCalendarYears(date: Moment, years: number): Moment;
58 addCalendarMonths(date: Moment, months: number): Moment;
59 addCalendarDays(date: Moment, days: number): Moment;
60 toIso8601(date: Moment): string;
61 /**
62 * Returns the given value if given a valid Moment or null. Deserializes valid ISO 8601 strings
63 * (https://www.ietf.org/rfc/rfc3339.txt) and valid Date objects into valid Moments and empty
64 * string into null. Returns an invalid date for all other values.
65 */
66 deserialize(value: any): Moment | null;
67 isDateInstance(obj: any): boolean;
68 isValid(date: Moment): boolean;
69 invalid(): Moment;
70 /** Creates a Moment instance while respecting the current UTC settings. */
71 private _createMoment;
72 static ɵfac: i0.ɵɵFactoryDeclaration<MomentDateAdapter, [{ optional: true; }, { optional: true; }]>;
73 static ɵprov: i0.ɵɵInjectableDeclaration<MomentDateAdapter>;
74}
75
76export declare class MomentDateModule {
77 static ɵfac: i0.ɵɵFactoryDeclaration<MomentDateModule, never>;
78 static ɵmod: i0.ɵɵNgModuleDeclaration<MomentDateModule, never, never, never>;
79 static ɵinj: i0.ɵɵInjectorDeclaration<MomentDateModule>;
80}
81
82export { }
83
\No newline at end of file