@angular/material-date-fns-adapter 19.0.0-next.4 → 19.0.0-next.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import {
|
|
2
|
+
import { inject, Injectable, NgModule } from '@angular/core';
|
|
3
3
|
import { DateAdapter, MAT_DATE_LOCALE, MAT_DATE_FORMATS } from '@angular/material/core';
|
|
4
4
|
import { getYear, getMonth, getDate, getDay, getDaysInMonth, parseISO, parse, format, addYears, addMonths, addDays, formatISO, isDate, isValid } from 'date-fns';
|
|
5
5
|
|
|
@@ -25,8 +25,9 @@ const DAY_OF_WEEK_FORMATS = {
|
|
|
25
25
|
};
|
|
26
26
|
/** Adds date-fns support to Angular Material. */
|
|
27
27
|
class DateFnsAdapter extends DateAdapter {
|
|
28
|
-
constructor(
|
|
28
|
+
constructor() {
|
|
29
29
|
super();
|
|
30
|
+
const matDateLocale = inject(MAT_DATE_LOCALE, { optional: true });
|
|
30
31
|
this.setLocale(matDateLocale);
|
|
31
32
|
}
|
|
32
33
|
getYear(date) {
|
|
@@ -175,17 +176,12 @@ class DateFnsAdapter extends DateAdapter {
|
|
|
175
176
|
invalid() {
|
|
176
177
|
return new Date(NaN);
|
|
177
178
|
}
|
|
178
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.0-next.3", ngImport: i0, type: DateFnsAdapter, deps: [
|
|
179
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.0-next.3", ngImport: i0, type: DateFnsAdapter, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
179
180
|
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.0-next.3", ngImport: i0, type: DateFnsAdapter }); }
|
|
180
181
|
}
|
|
181
182
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.0-next.3", ngImport: i0, type: DateFnsAdapter, decorators: [{
|
|
182
183
|
type: Injectable
|
|
183
|
-
}], ctorParameters: () => [
|
|
184
|
-
type: Optional
|
|
185
|
-
}, {
|
|
186
|
-
type: Inject,
|
|
187
|
-
args: [MAT_DATE_LOCALE]
|
|
188
|
-
}] }] });
|
|
184
|
+
}], ctorParameters: () => [] });
|
|
189
185
|
|
|
190
186
|
const MAT_DATE_FNS_FORMATS = {
|
|
191
187
|
parse: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"material-date-fns-adapter.mjs","sources":["../../../../../../src/material-date-fns-adapter/adapter/date-fns-adapter.ts","../../../../../../src/material-date-fns-adapter/adapter/date-fns-formats.ts","../../../../../../src/material-date-fns-adapter/adapter/index.ts","../../../../../../src/material-date-fns-adapter/material-date-fns-adapter_public_index.ts"],"sourcesContent":["/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\nimport {Inject, Injectable, Optional} from '@angular/core';\nimport {DateAdapter, MAT_DATE_LOCALE} from '@angular/material/core';\nimport {\n Locale,\n getMonth,\n getYear,\n getDate,\n getDay,\n getDaysInMonth,\n formatISO,\n addYears,\n addMonths,\n addDays,\n isValid,\n isDate,\n format,\n parseISO,\n parse,\n} from 'date-fns';\n\n/** Creates an array and fills it with values. */\nfunction range<T>(length: number, valueFunction: (index: number) => T): T[] {\n const valuesArray = Array(length);\n for (let i = 0; i < length; i++) {\n valuesArray[i] = valueFunction(i);\n }\n return valuesArray;\n}\n\n// date-fns doesn't have a way to read/print month names or days of the week directly,\n// so we get them by formatting a date with a format that produces the desired month/day.\nconst MONTH_FORMATS = {\n long: 'LLLL',\n short: 'LLL',\n narrow: 'LLLLL',\n};\n\nconst DAY_OF_WEEK_FORMATS = {\n long: 'EEEE',\n short: 'EEE',\n narrow: 'EEEEE',\n};\n\n/** Adds date-fns support to Angular Material. */\n@Injectable()\nexport class DateFnsAdapter extends DateAdapter<Date, Locale> {\n constructor(@Optional() @Inject(MAT_DATE_LOCALE) matDateLocale: {}) {\n super();\n this.setLocale(matDateLocale as Locale);\n }\n\n getYear(date: Date): number {\n return getYear(date);\n }\n\n getMonth(date: Date): number {\n return getMonth(date);\n }\n\n getDate(date: Date): number {\n return getDate(date);\n }\n\n getDayOfWeek(date: Date): number {\n return getDay(date);\n }\n\n getMonthNames(style: 'long' | 'short' | 'narrow'): string[] {\n const pattern = MONTH_FORMATS[style];\n return range(12, i => this.format(new Date(2017, i, 1), pattern));\n }\n\n getDateNames(): string[] {\n const dtf =\n typeof Intl !== 'undefined'\n ? new Intl.DateTimeFormat(this.locale.code, {\n day: 'numeric',\n timeZone: 'utc',\n })\n : null;\n\n return range(31, i => {\n if (dtf) {\n // date-fns doesn't appear to support this functionality.\n // Fall back to `Intl` on supported browsers.\n const date = new Date();\n date.setUTCFullYear(2017, 0, i + 1);\n date.setUTCHours(0, 0, 0, 0);\n return dtf.format(date).replace(/[\\u200e\\u200f]/g, '');\n }\n\n return i + '';\n });\n }\n\n getDayOfWeekNames(style: 'long' | 'short' | 'narrow'): string[] {\n const pattern = DAY_OF_WEEK_FORMATS[style];\n return range(7, i => this.format(new Date(2017, 0, i + 1), pattern));\n }\n\n getYearName(date: Date): string {\n return this.format(date, 'y');\n }\n\n getFirstDayOfWeek(): number {\n return this.locale.options?.weekStartsOn ?? 0;\n }\n\n getNumDaysInMonth(date: Date): number {\n return getDaysInMonth(date);\n }\n\n clone(date: Date): Date {\n return new Date(date.getTime());\n }\n\n createDate(year: number, month: number, date: number): Date {\n if (typeof ngDevMode === 'undefined' || ngDevMode) {\n // Check for invalid month and date (except upper bound on date which we have to check after\n // creating the Date).\n if (month < 0 || month > 11) {\n throw Error(`Invalid month index \"${month}\". Month index has to be between 0 and 11.`);\n }\n\n if (date < 1) {\n throw Error(`Invalid date \"${date}\". Date has to be greater than 0.`);\n }\n }\n\n // Passing the year to the constructor causes year numbers <100 to be converted to 19xx.\n // To work around this we use `setFullYear` and `setHours` instead.\n const result = new Date();\n result.setFullYear(year, month, date);\n result.setHours(0, 0, 0, 0);\n\n // Check that the date wasn't above the upper bound for the month, causing the month to overflow\n if (result.getMonth() != month && (typeof ngDevMode === 'undefined' || ngDevMode)) {\n throw Error(`Invalid date \"${date}\" for month with index \"${month}\".`);\n }\n\n return result;\n }\n\n today(): Date {\n return new Date();\n }\n\n parse(value: any, parseFormat: string | string[]): Date | null {\n if (typeof value == 'string' && value.length > 0) {\n const iso8601Date = parseISO(value);\n\n if (this.isValid(iso8601Date)) {\n return iso8601Date;\n }\n\n const formats = Array.isArray(parseFormat) ? parseFormat : [parseFormat];\n\n if (!parseFormat.length) {\n throw Error('Formats array must not be empty.');\n }\n\n for (const currentFormat of formats) {\n const fromFormat = parse(value, currentFormat, new Date(), {locale: this.locale});\n\n if (this.isValid(fromFormat)) {\n return fromFormat;\n }\n }\n\n return this.invalid();\n } else if (typeof value === 'number') {\n return new Date(value);\n } else if (value instanceof Date) {\n return this.clone(value);\n }\n\n return null;\n }\n\n format(date: Date, displayFormat: string): string {\n if (!this.isValid(date)) {\n throw Error('DateFnsAdapter: Cannot format invalid date.');\n }\n\n return format(date, displayFormat, {locale: this.locale});\n }\n\n addCalendarYears(date: Date, years: number): Date {\n return addYears(date, years);\n }\n\n addCalendarMonths(date: Date, months: number): Date {\n return addMonths(date, months);\n }\n\n addCalendarDays(date: Date, days: number): Date {\n return addDays(date, days);\n }\n\n toIso8601(date: Date): string {\n return formatISO(date, {representation: 'date'});\n }\n\n /**\n * Returns the given value if given a valid Date or null. Deserializes valid ISO 8601 strings\n * (https://www.ietf.org/rfc/rfc3339.txt) into valid Dates and empty string into null. Returns an\n * invalid date for all other values.\n */\n override deserialize(value: any): Date | null {\n if (typeof value === 'string') {\n if (!value) {\n return null;\n }\n const date = parseISO(value);\n if (this.isValid(date)) {\n return date;\n }\n }\n return super.deserialize(value);\n }\n\n isDateInstance(obj: any): boolean {\n return isDate(obj);\n }\n\n isValid(date: Date): boolean {\n return isValid(date);\n }\n\n invalid(): Date {\n return new Date(NaN);\n }\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\nimport {MatDateFormats} from '@angular/material/core';\n\nexport const MAT_DATE_FNS_FORMATS: MatDateFormats = {\n parse: {\n dateInput: 'P',\n },\n display: {\n dateInput: 'P',\n monthYearLabel: 'LLL uuuu',\n dateA11yLabel: 'PP',\n monthYearA11yLabel: 'LLLL uuuu',\n },\n};\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\nimport {NgModule, Provider} from '@angular/core';\nimport {\n DateAdapter,\n MAT_DATE_FORMATS,\n MAT_DATE_LOCALE,\n MatDateFormats,\n} from '@angular/material/core';\nimport {DateFnsAdapter} from './date-fns-adapter';\nimport {MAT_DATE_FNS_FORMATS} from './date-fns-formats';\n\nexport * from './date-fns-adapter';\nexport * from './date-fns-formats';\n\n@NgModule({\n providers: [\n {\n provide: DateAdapter,\n useClass: DateFnsAdapter,\n deps: [MAT_DATE_LOCALE],\n },\n ],\n})\nexport class DateFnsModule {}\n\n@NgModule({\n providers: [provideDateFnsAdapter()],\n})\nexport class MatDateFnsModule {}\n\nexport function provideDateFnsAdapter(formats: MatDateFormats = MAT_DATE_FNS_FORMATS): Provider[] {\n return [\n {\n provide: DateAdapter,\n useClass: DateFnsAdapter,\n deps: [MAT_DATE_LOCALE],\n },\n {provide: MAT_DATE_FORMATS, useValue: formats},\n ];\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;AA4BA;AACA,SAAS,KAAK,CAAI,MAAc,EAAE,aAAmC,EAAA;AACnE,IAAA,MAAM,WAAW,GAAG,KAAK,CAAC,MAAM,CAAC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AO,EAAE,WAAW;AACpB,4BAAA,QAAQ,EAAE,cAAc;4BACxB,IAAI,EAAE,CAAC,eAAe,CAAC;AACxB,yBAAA;AACF,qBAAA;AACF,iBAAA,CAAA;;MAMY,gBAAgB,CAAA;qHAAhB,gBAAgB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,QAAA,EAAA,CAAA,CAAA,EAAA;sHAAhB,gBAAgB,EAAA,CAAA,CAAA,EAAA;AAAhB,IAAA,SAAA,IAAA,CAAA,IAAA,GAAA,EAAA,CAAA,mBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,eAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,gBAAgB,EAFhB,SAAA,EAAA,CAAC,qBAAqB,EAAE,CAAC,EAAA,CAAA,CAAA,EAAA;;kGAEzB,gBAAgB,EAAA,UAAA,EAAA,CAAA;kBAH5B,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;AACR,oBAAA,SAAS,EAAE,CAAC,qBAAqB,EAAE,CAAC;AACrC,iBAAA,CAAA;;AAGe,SAAA,qBAAqB,CAAC,OAAA,GAA0B,oBAAoB,EAAA;IAClF,OAAO;AACL,QAAA;AACE,YAAA,OAAO,EAAE,WAAW;AACpB,YAAA,QAAQ,EAAE,cAAc;YACxB,IAAI,EAAE,CAAC,eAAe,CAAC;AACxB,SAAA;AACD,QAAA,EAAC,OAAO,EAAE,gBAAgB,EAAE,QAAQ,EAAE,OAAO,EAAC;KAC/C,CAAC;AACJ;;AC9CA;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"material-date-fns-adapter.mjs","sources":["../../../../../../src/material-date-fns-adapter/adapter/date-fns-adapter.ts","../../../../../../src/material-date-fns-adapter/adapter/date-fns-formats.ts","../../../../../../src/material-date-fns-adapter/adapter/index.ts","../../../../../../src/material-date-fns-adapter/material-date-fns-adapter_public_index.ts"],"sourcesContent":["/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport {Injectable, inject} from '@angular/core';\nimport {DateAdapter, MAT_DATE_LOCALE} from '@angular/material/core';\nimport {\n Locale,\n getMonth,\n getYear,\n getDate,\n getDay,\n getDaysInMonth,\n formatISO,\n addYears,\n addMonths,\n addDays,\n isValid,\n isDate,\n format,\n parseISO,\n parse,\n} from 'date-fns';\n\n/** Creates an array and fills it with values. */\nfunction range<T>(length: number, valueFunction: (index: number) => T): T[] {\n const valuesArray = Array(length);\n for (let i = 0; i < length; i++) {\n valuesArray[i] = valueFunction(i);\n }\n return valuesArray;\n}\n\n// date-fns doesn't have a way to read/print month names or days of the week directly,\n// so we get them by formatting a date with a format that produces the desired month/day.\nconst MONTH_FORMATS = {\n long: 'LLLL',\n short: 'LLL',\n narrow: 'LLLLL',\n};\n\nconst DAY_OF_WEEK_FORMATS = {\n long: 'EEEE',\n short: 'EEE',\n narrow: 'EEEEE',\n};\n\n/** Adds date-fns support to Angular Material. */\n@Injectable()\nexport class DateFnsAdapter extends DateAdapter<Date, Locale> {\n constructor(...args: unknown[]);\n\n constructor() {\n super();\n const matDateLocale = inject(MAT_DATE_LOCALE, {optional: true});\n this.setLocale(matDateLocale as Locale);\n }\n\n getYear(date: Date): number {\n return getYear(date);\n }\n\n getMonth(date: Date): number {\n return getMonth(date);\n }\n\n getDate(date: Date): number {\n return getDate(date);\n }\n\n getDayOfWeek(date: Date): number {\n return getDay(date);\n }\n\n getMonthNames(style: 'long' | 'short' | 'narrow'): string[] {\n const pattern = MONTH_FORMATS[style];\n return range(12, i => this.format(new Date(2017, i, 1), pattern));\n }\n\n getDateNames(): string[] {\n const dtf =\n typeof Intl !== 'undefined'\n ? new Intl.DateTimeFormat(this.locale.code, {\n day: 'numeric',\n timeZone: 'utc',\n })\n : null;\n\n return range(31, i => {\n if (dtf) {\n // date-fns doesn't appear to support this functionality.\n // Fall back to `Intl` on supported browsers.\n const date = new Date();\n date.setUTCFullYear(2017, 0, i + 1);\n date.setUTCHours(0, 0, 0, 0);\n return dtf.format(date).replace(/[\\u200e\\u200f]/g, '');\n }\n\n return i + '';\n });\n }\n\n getDayOfWeekNames(style: 'long' | 'short' | 'narrow'): string[] {\n const pattern = DAY_OF_WEEK_FORMATS[style];\n return range(7, i => this.format(new Date(2017, 0, i + 1), pattern));\n }\n\n getYearName(date: Date): string {\n return this.format(date, 'y');\n }\n\n getFirstDayOfWeek(): number {\n return this.locale.options?.weekStartsOn ?? 0;\n }\n\n getNumDaysInMonth(date: Date): number {\n return getDaysInMonth(date);\n }\n\n clone(date: Date): Date {\n return new Date(date.getTime());\n }\n\n createDate(year: number, month: number, date: number): Date {\n if (typeof ngDevMode === 'undefined' || ngDevMode) {\n // Check for invalid month and date (except upper bound on date which we have to check after\n // creating the Date).\n if (month < 0 || month > 11) {\n throw Error(`Invalid month index \"${month}\". Month index has to be between 0 and 11.`);\n }\n\n if (date < 1) {\n throw Error(`Invalid date \"${date}\". Date has to be greater than 0.`);\n }\n }\n\n // Passing the year to the constructor causes year numbers <100 to be converted to 19xx.\n // To work around this we use `setFullYear` and `setHours` instead.\n const result = new Date();\n result.setFullYear(year, month, date);\n result.setHours(0, 0, 0, 0);\n\n // Check that the date wasn't above the upper bound for the month, causing the month to overflow\n if (result.getMonth() != month && (typeof ngDevMode === 'undefined' || ngDevMode)) {\n throw Error(`Invalid date \"${date}\" for month with index \"${month}\".`);\n }\n\n return result;\n }\n\n today(): Date {\n return new Date();\n }\n\n parse(value: any, parseFormat: string | string[]): Date | null {\n if (typeof value == 'string' && value.length > 0) {\n const iso8601Date = parseISO(value);\n\n if (this.isValid(iso8601Date)) {\n return iso8601Date;\n }\n\n const formats = Array.isArray(parseFormat) ? parseFormat : [parseFormat];\n\n if (!parseFormat.length) {\n throw Error('Formats array must not be empty.');\n }\n\n for (const currentFormat of formats) {\n const fromFormat = parse(value, currentFormat, new Date(), {locale: this.locale});\n\n if (this.isValid(fromFormat)) {\n return fromFormat;\n }\n }\n\n return this.invalid();\n } else if (typeof value === 'number') {\n return new Date(value);\n } else if (value instanceof Date) {\n return this.clone(value);\n }\n\n return null;\n }\n\n format(date: Date, displayFormat: string): string {\n if (!this.isValid(date)) {\n throw Error('DateFnsAdapter: Cannot format invalid date.');\n }\n\n return format(date, displayFormat, {locale: this.locale});\n }\n\n addCalendarYears(date: Date, years: number): Date {\n return addYears(date, years);\n }\n\n addCalendarMonths(date: Date, months: number): Date {\n return addMonths(date, months);\n }\n\n addCalendarDays(date: Date, days: number): Date {\n return addDays(date, days);\n }\n\n toIso8601(date: Date): string {\n return formatISO(date, {representation: 'date'});\n }\n\n /**\n * Returns the given value if given a valid Date or null. Deserializes valid ISO 8601 strings\n * (https://www.ietf.org/rfc/rfc3339.txt) into valid Dates and empty string into null. Returns an\n * invalid date for all other values.\n */\n override deserialize(value: any): Date | null {\n if (typeof value === 'string') {\n if (!value) {\n return null;\n }\n const date = parseISO(value);\n if (this.isValid(date)) {\n return date;\n }\n }\n return super.deserialize(value);\n }\n\n isDateInstance(obj: any): boolean {\n return isDate(obj);\n }\n\n isValid(date: Date): boolean {\n return isValid(date);\n }\n\n invalid(): Date {\n return new Date(NaN);\n }\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport {MatDateFormats} from '@angular/material/core';\n\nexport const MAT_DATE_FNS_FORMATS: MatDateFormats = {\n parse: {\n dateInput: 'P',\n },\n display: {\n dateInput: 'P',\n monthYearLabel: 'LLL uuuu',\n dateA11yLabel: 'PP',\n monthYearA11yLabel: 'LLLL uuuu',\n },\n};\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport {NgModule, Provider} from '@angular/core';\nimport {\n DateAdapter,\n MAT_DATE_FORMATS,\n MAT_DATE_LOCALE,\n MatDateFormats,\n} from '@angular/material/core';\nimport {DateFnsAdapter} from './date-fns-adapter';\nimport {MAT_DATE_FNS_FORMATS} from './date-fns-formats';\n\nexport * from './date-fns-adapter';\nexport * from './date-fns-formats';\n\n@NgModule({\n providers: [\n {\n provide: DateAdapter,\n useClass: DateFnsAdapter,\n deps: [MAT_DATE_LOCALE],\n },\n ],\n})\nexport class DateFnsModule {}\n\n@NgModule({\n providers: [provideDateFnsAdapter()],\n})\nexport class MatDateFnsModule {}\n\nexport function provideDateFnsAdapter(formats: MatDateFormats = MAT_DATE_FNS_FORMATS): Provider[] {\n return [\n {\n provide: DateAdapter,\n useClass: DateFnsAdapter,\n deps: [MAT_DATE_LOCALE],\n },\n {provide: MAT_DATE_FORMATS, useValue: formats},\n ];\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;AA4BA;AACA,SAAS,KAAK,CAAI,MAAc,EAAE,aAAmC,EAAA;AACnE,IAAA,MAAM,WAAW,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC;AAClC,IAAA,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,MAAM,EAAE,CAAC,EAAE,EAAE;QAC/B,WAAW,CAAC,CAAC,CAAC,GAAG,aAAa,CAAC,CAAC,CAAC,CAAC;KACnC;AACD,IAAA,OAAO,WAAW,CAAC;AACrB,CAAC;AAED;AACA;AACA,MAAM,aAAa,GAAG;AACpB,IAAA,IAAI,EAAE,MAAM;AACZ,IAAA,KAAK,EAAE,KAAK;AACZ,IAAA,MAAM,EAAE,OAAO;CAChB,CAAC;AAEF,MAAM,mBAAmB,GAAG;AAC1B,IAAA,IAAI,EAAE,MAAM;AACZ,IAAA,KAAK,EAAE,KAAK;AACZ,IAAA,MAAM,EAAE,OAAO;CAChB,CAAC;AAEF;AAEM,MAAO,cAAe,SAAQ,WAAyB,CAAA;AAG3D,IAAA,WAAA,GAAA;AACE,QAAA,KAA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e,SAAA,qBAAqB,CAAC,OAAA,GAA0B,oBAAoB,EAAA;IAClF,OAAO;AACL,QAAA;AACE,YAAA,OAAO,EAAE,WAAW;AACpB,YAAA,QAAQ,EAAE,cAAc;YACxB,IAAI,EAAE,CAAC,eAAe,CAAC;AACxB,SAAA;AACD,QAAA,EAAC,OAAO,EAAE,gBAAgB,EAAE,QAAQ,EAAE,OAAO,EAAC;KAC/C,CAAC;AACJ;;AC9CA;;AAEG;;;;"}
|
package/index.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ import { Provider } from '@angular/core';
|
|
|
6
6
|
|
|
7
7
|
/** Adds date-fns support to Angular Material. */
|
|
8
8
|
export declare class DateFnsAdapter extends DateAdapter<Date, Locale> {
|
|
9
|
-
constructor(
|
|
9
|
+
constructor(...args: unknown[]);
|
|
10
10
|
getYear(date: Date): number;
|
|
11
11
|
getMonth(date: Date): number;
|
|
12
12
|
getDate(date: Date): number;
|
|
@@ -35,7 +35,7 @@ export declare class DateFnsAdapter extends DateAdapter<Date, Locale> {
|
|
|
35
35
|
isDateInstance(obj: any): boolean;
|
|
36
36
|
isValid(date: Date): boolean;
|
|
37
37
|
invalid(): Date;
|
|
38
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<DateFnsAdapter,
|
|
38
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<DateFnsAdapter, never>;
|
|
39
39
|
static ɵprov: i0.ɵɵInjectableDeclaration<DateFnsAdapter>;
|
|
40
40
|
}
|
|
41
41
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@angular/material-date-fns-adapter",
|
|
3
|
-
"version": "19.0.0-next.
|
|
3
|
+
"version": "19.0.0-next.6",
|
|
4
4
|
"description": "Angular Material date-fns Adapter",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -12,9 +12,9 @@
|
|
|
12
12
|
},
|
|
13
13
|
"homepage": "https://github.com/angular/components#readme",
|
|
14
14
|
"peerDependencies": {
|
|
15
|
-
"@angular/material": "19.0.0-next.
|
|
15
|
+
"@angular/material": "19.0.0-next.6",
|
|
16
16
|
"@angular/core": "^19.0.0-0 || ^19.1.0-0 || ^19.2.0-0 || ^19.3.0-0 || ^20.0.0-0",
|
|
17
|
-
"date-fns": ">2.20.0 <
|
|
17
|
+
"date-fns": ">2.20.0 <5.0"
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
20
|
"tslib": "^2.3.0"
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Copyright Google LLC All Rights Reserved.
|
|
4
4
|
*
|
|
5
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.
|
|
6
|
+
* found in the LICENSE file at https://angular.dev/license
|
|
7
7
|
*/
|
|
8
8
|
import { Rule } from '@angular-devkit/schematics';
|
|
9
9
|
export default function (): Rule;
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Copyright Google LLC All Rights Reserved.
|
|
5
5
|
*
|
|
6
6
|
* Use of this source code is governed by an MIT-style license that can be
|
|
7
|
-
* found in the LICENSE file at https://angular.
|
|
7
|
+
* found in the LICENSE file at https://angular.dev/license
|
|
8
8
|
*/
|
|
9
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
10
|
exports.default = default_1;
|
|
@@ -13,4 +13,4 @@ function default_1() {
|
|
|
13
13
|
// Also allows us to add more functionality in the future.
|
|
14
14
|
return () => { };
|
|
15
15
|
}
|
|
16
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
16
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi8uLi8uLi9zcmMvbWF0ZXJpYWwtZGF0ZS1mbnMtYWRhcHRlci9zY2hlbWF0aWNzL25nLWFkZC9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBQUE7Ozs7OztHQU1HOztBQUlILDRCQUlDO0FBSkQ7SUFDRSxpRkFBaUY7SUFDakYsMERBQTBEO0lBQzFELE9BQU8sR0FBRyxFQUFFLEdBQUUsQ0FBQyxDQUFDO0FBQ2xCLENBQUMiLCJzb3VyY2VzQ29udGVudCI6WyIvKipcbiAqIEBsaWNlbnNlXG4gKiBDb3B5cmlnaHQgR29vZ2xlIExMQyBBbGwgUmlnaHRzIFJlc2VydmVkLlxuICpcbiAqIFVzZSBvZiB0aGlzIHNvdXJjZSBjb2RlIGlzIGdvdmVybmVkIGJ5IGFuIE1JVC1zdHlsZSBsaWNlbnNlIHRoYXQgY2FuIGJlXG4gKiBmb3VuZCBpbiB0aGUgTElDRU5TRSBmaWxlIGF0IGh0dHBzOi8vYW5ndWxhci5kZXYvbGljZW5zZVxuICovXG5cbmltcG9ydCB7UnVsZX0gZnJvbSAnQGFuZ3VsYXItZGV2a2l0L3NjaGVtYXRpY3MnO1xuXG5leHBvcnQgZGVmYXVsdCBmdW5jdGlvbiAoKTogUnVsZSB7XG4gIC8vIE5vb3Agc2NoZW1hdGljIHNvIHRoZSBDTEkgZG9lc24ndCB0aHJvdyBpZiB1c2VycyB0cnkgdG8gYG5nIGFkZGAgdGhpcyBwYWNrYWdlLlxuICAvLyBBbHNvIGFsbG93cyB1cyB0byBhZGQgbW9yZSBmdW5jdGlvbmFsaXR5IGluIHRoZSBmdXR1cmUuXG4gIHJldHVybiAoKSA9PiB7fTtcbn1cbiJdfQ==
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Copyright Google LLC All Rights Reserved.
|
|
5
5
|
*
|
|
6
6
|
* Use of this source code is governed by an MIT-style license that can be
|
|
7
|
-
* found in the LICENSE file at https://angular.
|
|
7
|
+
* found in the LICENSE file at https://angular.dev/license
|
|
8
8
|
*/
|
|
9
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
10
|
exports.default = default_1;
|
|
@@ -13,4 +13,4 @@ function default_1() {
|
|
|
13
13
|
// Also allows us to add more functionality in the future.
|
|
14
14
|
return () => { };
|
|
15
15
|
}
|
|
16
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
16
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi8uLi8uLi9zcmMvbWF0ZXJpYWwtZGF0ZS1mbnMtYWRhcHRlci9zY2hlbWF0aWNzL25nLWFkZC9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBQUE7Ozs7OztHQU1HOztBQUlILDRCQUlDO0FBSkQ7SUFDRSxpRkFBaUY7SUFDakYsMERBQTBEO0lBQzFELE9BQU8sR0FBRyxFQUFFLEdBQUUsQ0FBQyxDQUFDO0FBQ2xCLENBQUMiLCJzb3VyY2VzQ29udGVudCI6WyIvKipcbiAqIEBsaWNlbnNlXG4gKiBDb3B5cmlnaHQgR29vZ2xlIExMQyBBbGwgUmlnaHRzIFJlc2VydmVkLlxuICpcbiAqIFVzZSBvZiB0aGlzIHNvdXJjZSBjb2RlIGlzIGdvdmVybmVkIGJ5IGFuIE1JVC1zdHlsZSBsaWNlbnNlIHRoYXQgY2FuIGJlXG4gKiBmb3VuZCBpbiB0aGUgTElDRU5TRSBmaWxlIGF0IGh0dHBzOi8vYW5ndWxhci5kZXYvbGljZW5zZVxuICovXG5cbmltcG9ydCB7UnVsZX0gZnJvbSAnQGFuZ3VsYXItZGV2a2l0L3NjaGVtYXRpY3MnO1xuXG5leHBvcnQgZGVmYXVsdCBmdW5jdGlvbiAoKTogUnVsZSB7XG4gIC8vIE5vb3Agc2NoZW1hdGljIHNvIHRoZSBDTEkgZG9lc24ndCB0aHJvdyBpZiB1c2VycyB0cnkgdG8gYG5nIGFkZGAgdGhpcyBwYWNrYWdlLlxuICAvLyBBbHNvIGFsbG93cy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