UNPKG

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