UNPKG

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