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 | */
|
---|
8 | import { Platform } from '@angular/cdk/platform';
|
---|
9 | import { DateAdapter } from './date-adapter';
|
---|
10 | /** Adapts the native JS Date for use with cdk-based components that work with dates. */
|
---|
11 | import * as ɵngcc0 from '@angular/core';
|
---|
12 | export declare class NativeDateAdapter extends DateAdapter<Date> {
|
---|
13 | /** Whether to clamp the date between 1 and 9999 to avoid IE and Edge errors. */
|
---|
14 | private readonly _clampDate;
|
---|
15 | /**
|
---|
16 | * Whether to use `timeZone: 'utc'` with `Intl.DateTimeFormat` when formatting dates.
|
---|
17 | * Without this `Intl.DateTimeFormat` sometimes chooses the wrong timeZone, which can throw off
|
---|
18 | * the result. (e.g. in the en-US locale `new Date(1800, 7, 14).toLocaleDateString()`
|
---|
19 | * will produce `'8/13/1800'`.
|
---|
20 | *
|
---|
21 | * TODO(mmalerba): drop this variable. It's not being used in the code right now. We're now
|
---|
22 | * getting the string representation of a Date object from its utc representation. We're keeping
|
---|
23 | * it here for sometime, just for precaution, in case we decide to revert some of these changes
|
---|
24 | * though.
|
---|
25 | */
|
---|
26 | useUtcForDisplay: boolean;
|
---|
27 | constructor(matDateLocale: string, platform: Platform);
|
---|
28 | getYear(date: Date): number;
|
---|
29 | getMonth(date: Date): number;
|
---|
30 | getDate(date: Date): number;
|
---|
31 | getDayOfWeek(date: Date): number;
|
---|
32 | getMonthNames(style: 'long' | 'short' | 'narrow'): string[];
|
---|
33 | getDateNames(): string[];
|
---|
34 | getDayOfWeekNames(style: 'long' | 'short' | 'narrow'): string[];
|
---|
35 | getYearName(date: Date): string;
|
---|
36 | getFirstDayOfWeek(): number;
|
---|
37 | getNumDaysInMonth(date: Date): number;
|
---|
38 | clone(date: Date): Date;
|
---|
39 | createDate(year: number, month: number, date: number): Date;
|
---|
40 | today(): Date;
|
---|
41 | parse(value: any): Date | null;
|
---|
42 | format(date: Date, displayFormat: Object): string;
|
---|
43 | addCalendarYears(date: Date, years: number): Date;
|
---|
44 | addCalendarMonths(date: Date, months: number): Date;
|
---|
45 | addCalendarDays(date: Date, days: number): Date;
|
---|
46 | toIso8601(date: Date): string;
|
---|
47 | /**
|
---|
48 | * Returns the given value if given a valid Date or null. Deserializes valid ISO 8601 strings
|
---|
49 | * (https://www.ietf.org/rfc/rfc3339.txt) into valid Dates and empty string into null. Returns an
|
---|
50 | * invalid date for all other values.
|
---|
51 | */
|
---|
52 | deserialize(value: any): Date | null;
|
---|
53 | isDateInstance(obj: any): boolean;
|
---|
54 | isValid(date: Date): boolean;
|
---|
55 | invalid(): Date;
|
---|
56 | /** Creates a date but allows the month and date to overflow. */
|
---|
57 | private _createDateWithOverflow;
|
---|
58 | /**
|
---|
59 | * Pads a number to make it two digits.
|
---|
60 | * @param n The number to pad.
|
---|
61 | * @returns The padded number.
|
---|
62 | */
|
---|
63 | private _2digit;
|
---|
64 | /**
|
---|
65 | * Strip out unicode LTR and RTL characters. Edge and IE insert these into formatted dates while
|
---|
66 | * other browsers do not. We remove them to make output consistent and because they interfere with
|
---|
67 | * date parsing.
|
---|
68 | * @param str The string to strip direction characters from.
|
---|
69 | * @returns The stripped string.
|
---|
70 | */
|
---|
71 | private _stripDirectionalityCharacters;
|
---|
72 | /**
|
---|
73 | * When converting Date object to string, javascript built-in functions may return wrong
|
---|
74 | * results because it applies its internal DST rules. The DST rules around the world change
|
---|
75 | * very frequently, and the current valid rule is not always valid in previous years though.
|
---|
76 | * We work around this problem building a new Date object which has its internal UTC
|
---|
77 | * representation with the local date and time.
|
---|
78 | * @param dtf Intl.DateTimeFormat object, containg the desired string format. It must have
|
---|
79 | * timeZone set to 'utc' to work fine.
|
---|
80 | * @param date Date from which we want to get the string representation according to dtf
|
---|
81 | * @returns A Date object with its UTC representation based on the passed in date info
|
---|
82 | */
|
---|
83 | private _format;
|
---|
84 | static ɵfac: ɵngcc0.ɵɵFactoryDeclaration<NativeDateAdapter, [{ optional: true; }, null]>;
|
---|
85 | static ɵprov: ɵngcc0.ɵɵInjectableDeclaration<NativeDateAdapter>;
|
---|
86 | }
|
---|
87 |
|
---|
88 | //# sourceMappingURL=native-date-adapter.d.ts.map |
---|