@angular/material-luxon-adapter 21.0.0-next.8 → 21.0.0-rc.0
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.
|
@@ -3,300 +3,354 @@ import { InjectionToken, inject, Injectable, NgModule } from '@angular/core';
|
|
|
3
3
|
import { DateAdapter, MAT_DATE_LOCALE, MAT_DATE_FORMATS } from '@angular/material/core';
|
|
4
4
|
import { DateTime, Info } from 'luxon';
|
|
5
5
|
|
|
6
|
-
/** InjectionToken for LuxonDateAdapter to configure options. */
|
|
7
6
|
const MAT_LUXON_DATE_ADAPTER_OPTIONS = new InjectionToken('MAT_LUXON_DATE_ADAPTER_OPTIONS', {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
7
|
+
providedIn: 'root',
|
|
8
|
+
factory: () => ({
|
|
9
|
+
useUtc: false,
|
|
10
|
+
defaultOutputCalendar: 'gregory'
|
|
11
|
+
})
|
|
13
12
|
});
|
|
14
|
-
/** Creates an array and fills it with values. */
|
|
15
13
|
function range(length, valueFunction) {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
14
|
+
const valuesArray = Array(length);
|
|
15
|
+
for (let i = 0; i < length; i++) {
|
|
16
|
+
valuesArray[i] = valueFunction(i);
|
|
17
|
+
}
|
|
18
|
+
return valuesArray;
|
|
21
19
|
}
|
|
22
|
-
/** Adapts Luxon Dates for use with Angular Material. */
|
|
23
20
|
class LuxonDateAdapter extends DateAdapter {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
if (this.isValid(fromFormat)) {
|
|
120
|
-
return fromFormat;
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
return this.invalid();
|
|
124
|
-
}
|
|
125
|
-
else if (typeof value === 'number') {
|
|
126
|
-
return DateTime.fromMillis(value, options);
|
|
127
|
-
}
|
|
128
|
-
else if (value instanceof Date) {
|
|
129
|
-
return DateTime.fromJSDate(value, options);
|
|
130
|
-
}
|
|
131
|
-
else if (value instanceof DateTime) {
|
|
132
|
-
return DateTime.fromMillis(value.toMillis(), options);
|
|
21
|
+
_useUTC;
|
|
22
|
+
_firstDayOfWeek;
|
|
23
|
+
_defaultOutputCalendar;
|
|
24
|
+
constructor() {
|
|
25
|
+
super();
|
|
26
|
+
const dateLocale = inject(MAT_DATE_LOCALE, {
|
|
27
|
+
optional: true
|
|
28
|
+
});
|
|
29
|
+
const options = inject(MAT_LUXON_DATE_ADAPTER_OPTIONS, {
|
|
30
|
+
optional: true
|
|
31
|
+
});
|
|
32
|
+
this._useUTC = !!options?.useUtc;
|
|
33
|
+
this._firstDayOfWeek = options?.firstDayOfWeek;
|
|
34
|
+
this._defaultOutputCalendar = options?.defaultOutputCalendar || 'gregory';
|
|
35
|
+
this.setLocale(dateLocale || DateTime.local().locale);
|
|
36
|
+
}
|
|
37
|
+
getYear(date) {
|
|
38
|
+
return date.year;
|
|
39
|
+
}
|
|
40
|
+
getMonth(date) {
|
|
41
|
+
return date.month - 1;
|
|
42
|
+
}
|
|
43
|
+
getDate(date) {
|
|
44
|
+
return date.day;
|
|
45
|
+
}
|
|
46
|
+
getDayOfWeek(date) {
|
|
47
|
+
return date.weekday;
|
|
48
|
+
}
|
|
49
|
+
getMonthNames(style) {
|
|
50
|
+
return Info.months(style, {
|
|
51
|
+
locale: this.locale,
|
|
52
|
+
outputCalendar: this._defaultOutputCalendar
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
getDateNames() {
|
|
56
|
+
const dtf = new Intl.DateTimeFormat(this.locale, {
|
|
57
|
+
day: 'numeric',
|
|
58
|
+
timeZone: 'utc'
|
|
59
|
+
});
|
|
60
|
+
return range(31, i => dtf.format(DateTime.utc(2017, 1, i + 1).toJSDate()));
|
|
61
|
+
}
|
|
62
|
+
getDayOfWeekNames(style) {
|
|
63
|
+
const days = Info.weekdays(style, {
|
|
64
|
+
locale: this.locale
|
|
65
|
+
});
|
|
66
|
+
days.unshift(days.pop());
|
|
67
|
+
return days;
|
|
68
|
+
}
|
|
69
|
+
getYearName(date) {
|
|
70
|
+
return date.toFormat('yyyy', this._getOptions());
|
|
71
|
+
}
|
|
72
|
+
getFirstDayOfWeek() {
|
|
73
|
+
return this._firstDayOfWeek ?? Info.getStartOfWeek({
|
|
74
|
+
locale: this.locale
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
getNumDaysInMonth(date) {
|
|
78
|
+
return date.daysInMonth;
|
|
79
|
+
}
|
|
80
|
+
clone(date) {
|
|
81
|
+
return DateTime.fromObject(date.toObject(), this._getOptions());
|
|
82
|
+
}
|
|
83
|
+
createDate(year, month, date) {
|
|
84
|
+
const options = this._getOptions();
|
|
85
|
+
if (month < 0 || month > 11) {
|
|
86
|
+
throw Error(`Invalid month index "${month}". Month index has to be between 0 and 11.`);
|
|
87
|
+
}
|
|
88
|
+
if (date < 1) {
|
|
89
|
+
throw Error(`Invalid date "${date}". Date has to be greater than 0.`);
|
|
90
|
+
}
|
|
91
|
+
const result = this._useUTC ? DateTime.utc(year, month + 1, date, options) : DateTime.local(year, month + 1, date, options);
|
|
92
|
+
if (!this.isValid(result)) {
|
|
93
|
+
throw Error(`Invalid date "${date}". Reason: "${result.invalidReason}".`);
|
|
94
|
+
}
|
|
95
|
+
return result;
|
|
96
|
+
}
|
|
97
|
+
today() {
|
|
98
|
+
const options = this._getOptions();
|
|
99
|
+
return this._useUTC ? DateTime.utc(options) : DateTime.local(options);
|
|
100
|
+
}
|
|
101
|
+
parse(value, parseFormat) {
|
|
102
|
+
const options = this._getOptions();
|
|
103
|
+
if (typeof value == 'string' && value.length > 0) {
|
|
104
|
+
const iso8601Date = DateTime.fromISO(value, options);
|
|
105
|
+
if (this.isValid(iso8601Date)) {
|
|
106
|
+
return iso8601Date;
|
|
107
|
+
}
|
|
108
|
+
const formats = Array.isArray(parseFormat) ? parseFormat : [parseFormat];
|
|
109
|
+
if (!parseFormat.length) {
|
|
110
|
+
throw Error('Formats array must not be empty.');
|
|
111
|
+
}
|
|
112
|
+
for (const format of formats) {
|
|
113
|
+
const fromFormat = DateTime.fromFormat(value, format, options);
|
|
114
|
+
if (this.isValid(fromFormat)) {
|
|
115
|
+
return fromFormat;
|
|
133
116
|
}
|
|
117
|
+
}
|
|
118
|
+
return this.invalid();
|
|
119
|
+
} else if (typeof value === 'number') {
|
|
120
|
+
return DateTime.fromMillis(value, options);
|
|
121
|
+
} else if (value instanceof Date) {
|
|
122
|
+
return DateTime.fromJSDate(value, options);
|
|
123
|
+
} else if (value instanceof DateTime) {
|
|
124
|
+
return DateTime.fromMillis(value.toMillis(), options);
|
|
125
|
+
}
|
|
126
|
+
return null;
|
|
127
|
+
}
|
|
128
|
+
format(date, displayFormat) {
|
|
129
|
+
if (!this.isValid(date)) {
|
|
130
|
+
throw Error('LuxonDateAdapter: Cannot format invalid date.');
|
|
131
|
+
}
|
|
132
|
+
if (this._useUTC) {
|
|
133
|
+
return date.setLocale(this.locale).setZone('utc').toFormat(displayFormat);
|
|
134
|
+
} else {
|
|
135
|
+
return date.setLocale(this.locale).toFormat(displayFormat);
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
addCalendarYears(date, years) {
|
|
139
|
+
return date.reconfigure(this._getOptions()).plus({
|
|
140
|
+
years
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
addCalendarMonths(date, months) {
|
|
144
|
+
return date.reconfigure(this._getOptions()).plus({
|
|
145
|
+
months
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
addCalendarDays(date, days) {
|
|
149
|
+
return date.reconfigure(this._getOptions()).plus({
|
|
150
|
+
days
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
toIso8601(date) {
|
|
154
|
+
return date.toISO();
|
|
155
|
+
}
|
|
156
|
+
deserialize(value) {
|
|
157
|
+
const options = this._getOptions();
|
|
158
|
+
let date;
|
|
159
|
+
if (value instanceof Date) {
|
|
160
|
+
date = DateTime.fromJSDate(value, options);
|
|
161
|
+
}
|
|
162
|
+
if (typeof value === 'string') {
|
|
163
|
+
if (!value) {
|
|
134
164
|
return null;
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
return date.minute;
|
|
214
|
-
}
|
|
215
|
-
getSeconds(date) {
|
|
216
|
-
return date.second;
|
|
217
|
-
}
|
|
218
|
-
parseTime(value, parseFormat) {
|
|
219
|
-
const result = this.parse(value, parseFormat);
|
|
220
|
-
if ((!result || !this.isValid(result)) && typeof value === 'string') {
|
|
221
|
-
// It seems like Luxon doesn't work well cross-browser for strings that have
|
|
222
|
-
// additional characters around the time. Try parsing without those characters.
|
|
223
|
-
return this.parse(value.replace(/[^0-9:(AM|PM)]/gi, ''), parseFormat) || result;
|
|
224
|
-
}
|
|
225
|
-
return result;
|
|
226
|
-
}
|
|
227
|
-
addSeconds(date, amount) {
|
|
228
|
-
return date.reconfigure(this._getOptions()).plus({ seconds: amount });
|
|
229
|
-
}
|
|
230
|
-
/** Gets the options that should be used when constructing a new `DateTime` object. */
|
|
231
|
-
_getOptions() {
|
|
232
|
-
return {
|
|
233
|
-
zone: this._useUTC ? 'utc' : undefined,
|
|
234
|
-
locale: this.locale,
|
|
235
|
-
outputCalendar: this._defaultOutputCalendar,
|
|
236
|
-
};
|
|
237
|
-
}
|
|
238
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.2.0-next.2", ngImport: i0, type: LuxonDateAdapter, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
239
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.2.0-next.2", ngImport: i0, type: LuxonDateAdapter });
|
|
165
|
+
}
|
|
166
|
+
date = DateTime.fromISO(value, options);
|
|
167
|
+
}
|
|
168
|
+
if (date && this.isValid(date)) {
|
|
169
|
+
return date;
|
|
170
|
+
}
|
|
171
|
+
return super.deserialize(value);
|
|
172
|
+
}
|
|
173
|
+
isDateInstance(obj) {
|
|
174
|
+
return obj instanceof DateTime;
|
|
175
|
+
}
|
|
176
|
+
isValid(date) {
|
|
177
|
+
return date.isValid;
|
|
178
|
+
}
|
|
179
|
+
invalid() {
|
|
180
|
+
return DateTime.invalid('Invalid Luxon DateTime object.');
|
|
181
|
+
}
|
|
182
|
+
setTime(target, hours, minutes, seconds) {
|
|
183
|
+
if (typeof ngDevMode === 'undefined' || ngDevMode) {
|
|
184
|
+
if (hours < 0 || hours > 23) {
|
|
185
|
+
throw Error(`Invalid hours "${hours}". Hours value must be between 0 and 23.`);
|
|
186
|
+
}
|
|
187
|
+
if (minutes < 0 || minutes > 59) {
|
|
188
|
+
throw Error(`Invalid minutes "${minutes}". Minutes value must be between 0 and 59.`);
|
|
189
|
+
}
|
|
190
|
+
if (seconds < 0 || seconds > 59) {
|
|
191
|
+
throw Error(`Invalid seconds "${seconds}". Seconds value must be between 0 and 59.`);
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
return this.clone(target).set({
|
|
195
|
+
hour: hours,
|
|
196
|
+
minute: minutes,
|
|
197
|
+
second: seconds,
|
|
198
|
+
millisecond: 0
|
|
199
|
+
});
|
|
200
|
+
}
|
|
201
|
+
getHours(date) {
|
|
202
|
+
return date.hour;
|
|
203
|
+
}
|
|
204
|
+
getMinutes(date) {
|
|
205
|
+
return date.minute;
|
|
206
|
+
}
|
|
207
|
+
getSeconds(date) {
|
|
208
|
+
return date.second;
|
|
209
|
+
}
|
|
210
|
+
parseTime(value, parseFormat) {
|
|
211
|
+
const result = this.parse(value, parseFormat);
|
|
212
|
+
if ((!result || !this.isValid(result)) && typeof value === 'string') {
|
|
213
|
+
return this.parse(value.replace(/[^0-9:(AM|PM)]/gi, ''), parseFormat) || result;
|
|
214
|
+
}
|
|
215
|
+
return result;
|
|
216
|
+
}
|
|
217
|
+
addSeconds(date, amount) {
|
|
218
|
+
return date.reconfigure(this._getOptions()).plus({
|
|
219
|
+
seconds: amount
|
|
220
|
+
});
|
|
221
|
+
}
|
|
222
|
+
_getOptions() {
|
|
223
|
+
return {
|
|
224
|
+
zone: this._useUTC ? 'utc' : undefined,
|
|
225
|
+
locale: this.locale,
|
|
226
|
+
outputCalendar: this._defaultOutputCalendar
|
|
227
|
+
};
|
|
228
|
+
}
|
|
229
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
230
|
+
minVersion: "12.0.0",
|
|
231
|
+
version: "20.2.0-next.2",
|
|
232
|
+
ngImport: i0,
|
|
233
|
+
type: LuxonDateAdapter,
|
|
234
|
+
deps: [],
|
|
235
|
+
target: i0.ɵɵFactoryTarget.Injectable
|
|
236
|
+
});
|
|
237
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({
|
|
238
|
+
minVersion: "12.0.0",
|
|
239
|
+
version: "20.2.0-next.2",
|
|
240
|
+
ngImport: i0,
|
|
241
|
+
type: LuxonDateAdapter
|
|
242
|
+
});
|
|
240
243
|
}
|
|
241
|
-
i0.ɵɵngDeclareClassMetadata({
|
|
242
|
-
|
|
243
|
-
|
|
244
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
245
|
+
minVersion: "12.0.0",
|
|
246
|
+
version: "20.2.0-next.2",
|
|
247
|
+
ngImport: i0,
|
|
248
|
+
type: LuxonDateAdapter,
|
|
249
|
+
decorators: [{
|
|
250
|
+
type: Injectable
|
|
251
|
+
}],
|
|
252
|
+
ctorParameters: () => []
|
|
253
|
+
});
|
|
244
254
|
|
|
245
255
|
const MAT_LUXON_DATE_FORMATS = {
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
256
|
+
parse: {
|
|
257
|
+
dateInput: 'D',
|
|
258
|
+
timeInput: 't'
|
|
259
|
+
},
|
|
260
|
+
display: {
|
|
261
|
+
dateInput: 'D',
|
|
262
|
+
timeInput: 't',
|
|
263
|
+
monthYearLabel: 'LLL yyyy',
|
|
264
|
+
dateA11yLabel: 'DD',
|
|
265
|
+
monthYearA11yLabel: 'LLLL yyyy',
|
|
266
|
+
timeOptionLabel: 't'
|
|
267
|
+
}
|
|
258
268
|
};
|
|
259
269
|
|
|
260
270
|
class LuxonDateModule {
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
271
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
272
|
+
minVersion: "12.0.0",
|
|
273
|
+
version: "20.2.0-next.2",
|
|
274
|
+
ngImport: i0,
|
|
275
|
+
type: LuxonDateModule,
|
|
276
|
+
deps: [],
|
|
277
|
+
target: i0.ɵɵFactoryTarget.NgModule
|
|
278
|
+
});
|
|
279
|
+
static ɵmod = i0.ɵɵngDeclareNgModule({
|
|
280
|
+
minVersion: "14.0.0",
|
|
281
|
+
version: "20.2.0-next.2",
|
|
282
|
+
ngImport: i0,
|
|
283
|
+
type: LuxonDateModule
|
|
284
|
+
});
|
|
285
|
+
static ɵinj = i0.ɵɵngDeclareInjector({
|
|
286
|
+
minVersion: "12.0.0",
|
|
287
|
+
version: "20.2.0-next.2",
|
|
288
|
+
ngImport: i0,
|
|
289
|
+
type: LuxonDateModule,
|
|
290
|
+
providers: [{
|
|
291
|
+
provide: DateAdapter,
|
|
292
|
+
useClass: LuxonDateAdapter
|
|
293
|
+
}]
|
|
294
|
+
});
|
|
269
295
|
}
|
|
270
|
-
i0.ɵɵngDeclareClassMetadata({
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
296
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
297
|
+
minVersion: "12.0.0",
|
|
298
|
+
version: "20.2.0-next.2",
|
|
299
|
+
ngImport: i0,
|
|
300
|
+
type: LuxonDateModule,
|
|
301
|
+
decorators: [{
|
|
302
|
+
type: NgModule,
|
|
303
|
+
args: [{
|
|
304
|
+
providers: [{
|
|
305
|
+
provide: DateAdapter,
|
|
306
|
+
useClass: LuxonDateAdapter
|
|
307
|
+
}]
|
|
308
|
+
}]
|
|
309
|
+
}]
|
|
310
|
+
});
|
|
281
311
|
class MatLuxonDateModule {
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
312
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
313
|
+
minVersion: "12.0.0",
|
|
314
|
+
version: "20.2.0-next.2",
|
|
315
|
+
ngImport: i0,
|
|
316
|
+
type: MatLuxonDateModule,
|
|
317
|
+
deps: [],
|
|
318
|
+
target: i0.ɵɵFactoryTarget.NgModule
|
|
319
|
+
});
|
|
320
|
+
static ɵmod = i0.ɵɵngDeclareNgModule({
|
|
321
|
+
minVersion: "14.0.0",
|
|
322
|
+
version: "20.2.0-next.2",
|
|
323
|
+
ngImport: i0,
|
|
324
|
+
type: MatLuxonDateModule
|
|
325
|
+
});
|
|
326
|
+
static ɵinj = i0.ɵɵngDeclareInjector({
|
|
327
|
+
minVersion: "12.0.0",
|
|
328
|
+
version: "20.2.0-next.2",
|
|
329
|
+
ngImport: i0,
|
|
330
|
+
type: MatLuxonDateModule,
|
|
331
|
+
providers: [provideLuxonDateAdapter()]
|
|
332
|
+
});
|
|
285
333
|
}
|
|
286
|
-
i0.ɵɵngDeclareClassMetadata({
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
334
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
335
|
+
minVersion: "12.0.0",
|
|
336
|
+
version: "20.2.0-next.2",
|
|
337
|
+
ngImport: i0,
|
|
338
|
+
type: MatLuxonDateModule,
|
|
339
|
+
decorators: [{
|
|
340
|
+
type: NgModule,
|
|
341
|
+
args: [{
|
|
342
|
+
providers: [provideLuxonDateAdapter()]
|
|
343
|
+
}]
|
|
344
|
+
}]
|
|
345
|
+
});
|
|
292
346
|
function provideLuxonDateAdapter(formats = MAT_LUXON_DATE_FORMATS) {
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
347
|
+
return [{
|
|
348
|
+
provide: DateAdapter,
|
|
349
|
+
useClass: LuxonDateAdapter
|
|
350
|
+
}, {
|
|
351
|
+
provide: MAT_DATE_FORMATS,
|
|
352
|
+
useValue: formats
|
|
353
|
+
}];
|
|
300
354
|
}
|
|
301
355
|
|
|
302
356
|
export { LuxonDateAdapter, LuxonDateModule, MAT_LUXON_DATE_ADAPTER_OPTIONS, MAT_LUXON_DATE_FORMATS, MatLuxonDateModule, provideLuxonDateAdapter };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"material-luxon-adapter.mjs","sources":["../../../../../darwin_arm64-fastbuild-ST-199a4f3c4e20/bin/src/material-luxon-adapter/adapter/luxon-date-adapter.ts","../../../../../darwin_arm64-fastbuild-ST-199a4f3c4e20/bin/src/material-luxon-adapter/adapter/luxon-date-formats.ts","../../../../../darwin_arm64-fastbuild-ST-199a4f3c4e20/bin/src/material-luxon-adapter/adapter/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, InjectionToken, inject} from '@angular/core';\nimport {DateAdapter, MAT_DATE_LOCALE} from '@angular/material/core';\nimport {\n DateTime as LuxonDateTime,\n Info as LuxonInfo,\n DateTimeOptions as LuxonDateTimeOptions,\n CalendarSystem as LuxonCalendarSystem,\n} from 'luxon';\n\n/** Configurable options for the `LuxonDateAdapter`. */\nexport interface MatLuxonDateAdapterOptions {\n /**\n * Turns the use of utc dates on or off.\n * Changing this will change how Angular Material components like DatePicker output dates.\n */\n useUtc: boolean;\n\n /**\n * Sets the first day of week.\n * Changing this will change how Angular Material components like DatePicker shows start of week.\n */\n firstDayOfWeek?: number;\n\n /**\n * Sets the output Calendar.\n * Changing this will change how Angular Material components like DatePicker output dates.\n */\n defaultOutputCalendar: LuxonCalendarSystem;\n}\n\n/** InjectionToken for LuxonDateAdapter to configure options. */\nexport const MAT_LUXON_DATE_ADAPTER_OPTIONS = new InjectionToken<MatLuxonDateAdapterOptions>(\n 'MAT_LUXON_DATE_ADAPTER_OPTIONS',\n {\n providedIn: 'root',\n factory: () => ({\n useUtc: false,\n defaultOutputCalendar: 'gregory',\n }),\n },\n);\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/** Adapts Luxon Dates for use with Angular Material. */\n@Injectable()\nexport class LuxonDateAdapter extends DateAdapter<LuxonDateTime> {\n private _useUTC: boolean;\n private _firstDayOfWeek: number | undefined;\n private _defaultOutputCalendar: LuxonCalendarSystem;\n\n constructor(...args: unknown[]);\n\n constructor() {\n super();\n\n const dateLocale = inject(MAT_DATE_LOCALE, {optional: true});\n const options = inject<MatLuxonDateAdapterOptions>(MAT_LUXON_DATE_ADAPTER_OPTIONS, {\n optional: true,\n });\n\n this._useUTC = !!options?.useUtc;\n this._firstDayOfWeek = options?.firstDayOfWeek;\n this._defaultOutputCalendar = options?.defaultOutputCalendar || 'gregory';\n this.setLocale(dateLocale || LuxonDateTime.local().locale);\n }\n\n getYear(date: LuxonDateTime): number {\n return date.year;\n }\n\n getMonth(date: LuxonDateTime): number {\n // Luxon works with 1-indexed months whereas our code expects 0-indexed.\n return date.month - 1;\n }\n\n getDate(date: LuxonDateTime): number {\n return date.day;\n }\n\n getDayOfWeek(date: LuxonDateTime): number {\n return date.weekday;\n }\n\n getMonthNames(style: 'long' | 'short' | 'narrow'): string[] {\n // Adding outputCalendar option, because LuxonInfo doesn't get effected by LuxonSettings\n return LuxonInfo.months(style, {\n locale: this.locale,\n outputCalendar: this._defaultOutputCalendar,\n });\n }\n\n getDateNames(): string[] {\n // At the time of writing, Luxon doesn't offer similar\n // functionality so we have to fall back to the Intl API.\n const dtf = new Intl.DateTimeFormat(this.locale, {day: 'numeric', timeZone: 'utc'});\n\n // Format a UTC date in order to avoid DST issues.\n return range(31, i => dtf.format(LuxonDateTime.utc(2017, 1, i + 1).toJSDate()));\n }\n\n getDayOfWeekNames(style: 'long' | 'short' | 'narrow'): string[] {\n // Note that we shift the array once, because Luxon returns Monday as the\n // first day of the week, whereas our logic assumes that it's Sunday. See:\n // https://moment.github.io/luxon/api-docs/index.html#infoweekdays\n const days = LuxonInfo.weekdays(style, {locale: this.locale});\n days.unshift(days.pop()!);\n return days;\n }\n\n getYearName(date: LuxonDateTime): string {\n return date.toFormat('yyyy', this._getOptions());\n }\n\n getFirstDayOfWeek(): number {\n return this._firstDayOfWeek ?? LuxonInfo.getStartOfWeek({locale: this.locale});\n }\n\n getNumDaysInMonth(date: LuxonDateTime): number {\n return date.daysInMonth!;\n }\n\n clone(date: LuxonDateTime): LuxonDateTime {\n return LuxonDateTime.fromObject(date.toObject(), this._getOptions());\n }\n\n createDate(year: number, month: number, date: number): LuxonDateTime {\n const options = this._getOptions();\n\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 // Luxon uses 1-indexed months so we need to add one to the month.\n const result = this._useUTC\n ? LuxonDateTime.utc(year, month + 1, date, options)\n : LuxonDateTime.local(year, month + 1, date, options);\n\n if (!this.isValid(result)) {\n throw Error(`Invalid date \"${date}\". Reason: \"${result.invalidReason}\".`);\n }\n\n return result;\n }\n\n today(): LuxonDateTime {\n const options = this._getOptions();\n\n return this._useUTC ? LuxonDateTime.utc(options) : LuxonDateTime.local(options);\n }\n\n parse(value: unknown, parseFormat: string | string[]): LuxonDateTime | null {\n const options: LuxonDateTimeOptions = this._getOptions();\n\n if (typeof value == 'string' && value.length > 0) {\n const iso8601Date = LuxonDateTime.fromISO(value, options);\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 format of formats) {\n const fromFormat = LuxonDateTime.fromFormat(value, format, options);\n\n if (this.isValid(fromFormat)) {\n return fromFormat;\n }\n }\n\n return this.invalid();\n } else if (typeof value === 'number') {\n return LuxonDateTime.fromMillis(value, options);\n } else if (value instanceof Date) {\n return LuxonDateTime.fromJSDate(value, options);\n } else if (value instanceof LuxonDateTime) {\n return LuxonDateTime.fromMillis(value.toMillis(), options);\n }\n\n return null;\n }\n\n format(date: LuxonDateTime, displayFormat: string): string {\n if (!this.isValid(date)) {\n throw Error('LuxonDateAdapter: Cannot format invalid date.');\n }\n if (this._useUTC) {\n return date.setLocale(this.locale).setZone('utc').toFormat(displayFormat);\n } else {\n return date.setLocale(this.locale).toFormat(displayFormat);\n }\n }\n\n addCalendarYears(date: LuxonDateTime, years: number): LuxonDateTime {\n return date.reconfigure(this._getOptions()).plus({years});\n }\n\n addCalendarMonths(date: LuxonDateTime, months: number): LuxonDateTime {\n return date.reconfigure(this._getOptions()).plus({months});\n }\n\n addCalendarDays(date: LuxonDateTime, days: number): LuxonDateTime {\n return date.reconfigure(this._getOptions()).plus({days});\n }\n\n toIso8601(date: LuxonDateTime): string {\n return date.toISO()!;\n }\n\n /**\n * Returns the given value if given a valid Luxon or null. Deserializes valid ISO 8601 strings\n * (https://www.ietf.org/rfc/rfc3339.txt) and valid Date objects into valid DateTime and empty\n * string into null. Returns an invalid date for all other values.\n */\n override deserialize(value: unknown): LuxonDateTime | null {\n const options = this._getOptions();\n let date: LuxonDateTime | undefined;\n if (value instanceof Date) {\n date = LuxonDateTime.fromJSDate(value, options);\n }\n if (typeof value === 'string') {\n if (!value) {\n return null;\n }\n date = LuxonDateTime.fromISO(value, options);\n }\n if (date && this.isValid(date)) {\n return date;\n }\n return super.deserialize(value);\n }\n\n isDateInstance(obj: unknown): obj is LuxonDateTime {\n return obj instanceof LuxonDateTime;\n }\n\n isValid(date: LuxonDateTime): boolean {\n return date.isValid;\n }\n\n invalid(): LuxonDateTime {\n return LuxonDateTime.invalid('Invalid Luxon DateTime object.');\n }\n\n override setTime(\n target: LuxonDateTime,\n hours: number,\n minutes: number,\n seconds: number,\n ): LuxonDateTime {\n if (typeof ngDevMode === 'undefined' || ngDevMode) {\n if (hours < 0 || hours > 23) {\n throw Error(`Invalid hours \"${hours}\". Hours value must be between 0 and 23.`);\n }\n\n if (minutes < 0 || minutes > 59) {\n throw Error(`Invalid minutes \"${minutes}\". Minutes value must be between 0 and 59.`);\n }\n\n if (seconds < 0 || seconds > 59) {\n throw Error(`Invalid seconds \"${seconds}\". Seconds value must be between 0 and 59.`);\n }\n }\n\n return this.clone(target).set({\n hour: hours,\n minute: minutes,\n second: seconds,\n millisecond: 0,\n });\n }\n\n override getHours(date: LuxonDateTime): number {\n return date.hour;\n }\n\n override getMinutes(date: LuxonDateTime): number {\n return date.minute;\n }\n\n override getSeconds(date: LuxonDateTime): number {\n return date.second;\n }\n\n override parseTime(value: unknown, parseFormat: string | string[]): LuxonDateTime | null {\n const result = this.parse(value, parseFormat);\n\n if ((!result || !this.isValid(result)) && typeof value === 'string') {\n // It seems like Luxon doesn't work well cross-browser for strings that have\n // additional characters around the time. Try parsing without those characters.\n return this.parse(value.replace(/[^0-9:(AM|PM)]/gi, ''), parseFormat) || result;\n }\n\n return result;\n }\n\n override addSeconds(date: LuxonDateTime, amount: number): LuxonDateTime {\n return date.reconfigure(this._getOptions()).plus({seconds: amount});\n }\n\n /** Gets the options that should be used when constructing a new `DateTime` object. */\n private _getOptions(): LuxonDateTimeOptions {\n return {\n zone: this._useUTC ? 'utc' : undefined,\n locale: this.locale,\n outputCalendar: this._defaultOutputCalendar,\n };\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_LUXON_DATE_FORMATS: MatDateFormats = {\n parse: {\n dateInput: 'D',\n timeInput: 't',\n },\n display: {\n dateInput: 'D',\n timeInput: 't',\n monthYearLabel: 'LLL yyyy',\n dateA11yLabel: 'DD',\n monthYearA11yLabel: 'LLLL yyyy',\n timeOptionLabel: 't',\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 {DateAdapter, MAT_DATE_FORMATS, MatDateFormats} from '@angular/material/core';\nimport {LuxonDateAdapter} from './luxon-date-adapter';\nimport {MAT_LUXON_DATE_FORMATS} from './luxon-date-formats';\n\nexport * from './luxon-date-adapter';\nexport * from './luxon-date-formats';\n\n@NgModule({\n providers: [\n {\n provide: DateAdapter,\n useClass: LuxonDateAdapter,\n },\n ],\n})\nexport class LuxonDateModule {}\n\n@NgModule({\n providers: [provideLuxonDateAdapter()],\n})\nexport class MatLuxonDateModule {}\n\nexport function provideLuxonDateAdapter(\n formats: MatDateFormats = MAT_LUXON_DATE_FORMATS,\n): Provider[] {\n return [\n {\n provide: DateAdapter,\n useClass: LuxonDateAdapter,\n },\n {provide: MAT_DATE_FORMATS, useValue: formats},\n ];\n}\n"],"names":["LuxonDateTime","LuxonInfo"],"mappings":";;;;;AAsCA;MACa,8BAA8B,GAAG,IAAI,cAAc,CAC9D,gCAAgC,EAChC;AACE,IAAA,UAAU,EAAE,MAAM;AAClB,IAAA,OAAO,EAAE,OAAO;AACd,QAAA,MAAM,EAAE,KAAK;AACb,QAAA,qBAAqB,EAAE,SAAS;KACjC,CAAC;AACH,CAAA;AAGH;AACA,SAAS,KAAK,CAAI,MAAc,EAAE,aAAmC,EAAA;AACnE,IAAA,MAAM,WAAW,GAAG,KAAK,CAAC,MAAM,CAAC;AACjC,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;;AAEnC,IAAA,OAAO,WAAW;AACpB;AAEA;AAEM,MAAO,gBAAiB,SAAQ,WAA0B,CAAA;AACtD,IAAA,OAAO;AACP,IAAA,eAAe;AACf,IAAA,sBAAsB;AAI9B,IAAA,WAAA,GAAA;AACE,QAAA,KAAK,EAAE;AAEP,QAAA,MAAM,UAAU,GAAG,MAAM,CAAC,eAAe,EAAE,EAAC,QAA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U,eAAe,EAAA,UAAA,EAAA,CAAA;kBAR3B,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;AACR,oBAAA,SAAS,EAAE;AACT,wBAAA;AACE,4BAAA,OAAO,EAAE,WAAW;AACpB,4BAAA,QAAQ,EAAE,gBAAgB;AAC3B,yBAAA;AACF,qBAAA;AACF,iBAAA;;MAMY,kBAAkB,CAAA;8GAAlB,kBAAkB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,QAAA,EAAA,CAAA;+GAAlB,kBAAkB,EAAA,CAAA;AAAlB,IAAA,OAAA,IAAA,GAAA,EAAA,CAAA,mBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,eAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,kBAAkB,EAFlB,SAAA,EAAA,CAAC,uBAAuB,EAAE,CAAC,EAAA,CAAA;;kGAE3B,kBAAkB,EAAA,UAAA,EAAA,CAAA;kBAH9B,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;AACR,oBAAA,SAAS,EAAE,CAAC,uBAAuB,EAAE,CAAC;AACvC,iBAAA;;AAGe,SAAA,uBAAuB,CACrC,OAAA,GAA0B,sBAAsB,EAAA;IAEhD,OAAO;AACL,QAAA;AACE,YAAA,OAAO,EAAE,WAAW;AACpB,YAAA,QAAQ,EAAE,gBAAgB;AAC3B,SAAA;AACD,QAAA,EAAC,OAAO,EAAE,gBAAgB,EAAE,QAAQ,EAAE,OAAO,EAAC;KAC/C;AACH;;;;"}
|
|
1
|
+
{"version":3,"file":"material-luxon-adapter.mjs","sources":["../../../../../darwin_arm64-fastbuild-ST-199a4f3c4e20/bin/src/material-luxon-adapter/adapter/luxon-date-adapter.ts","../../../../../darwin_arm64-fastbuild-ST-199a4f3c4e20/bin/src/material-luxon-adapter/adapter/luxon-date-formats.ts","../../../../../darwin_arm64-fastbuild-ST-199a4f3c4e20/bin/src/material-luxon-adapter/adapter/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, InjectionToken, inject} from '@angular/core';\nimport {DateAdapter, MAT_DATE_LOCALE} from '@angular/material/core';\nimport {\n DateTime as LuxonDateTime,\n Info as LuxonInfo,\n DateTimeOptions as LuxonDateTimeOptions,\n CalendarSystem as LuxonCalendarSystem,\n} from 'luxon';\n\n/** Configurable options for the `LuxonDateAdapter`. */\nexport interface MatLuxonDateAdapterOptions {\n /**\n * Turns the use of utc dates on or off.\n * Changing this will change how Angular Material components like DatePicker output dates.\n */\n useUtc: boolean;\n\n /**\n * Sets the first day of week.\n * Changing this will change how Angular Material components like DatePicker shows start of week.\n */\n firstDayOfWeek?: number;\n\n /**\n * Sets the output Calendar.\n * Changing this will change how Angular Material components like DatePicker output dates.\n */\n defaultOutputCalendar: LuxonCalendarSystem;\n}\n\n/** InjectionToken for LuxonDateAdapter to configure options. */\nexport const MAT_LUXON_DATE_ADAPTER_OPTIONS = new InjectionToken<MatLuxonDateAdapterOptions>(\n 'MAT_LUXON_DATE_ADAPTER_OPTIONS',\n {\n providedIn: 'root',\n factory: () => ({\n useUtc: false,\n defaultOutputCalendar: 'gregory',\n }),\n },\n);\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/** Adapts Luxon Dates for use with Angular Material. */\n@Injectable()\nexport class LuxonDateAdapter extends DateAdapter<LuxonDateTime> {\n private _useUTC: boolean;\n private _firstDayOfWeek: number | undefined;\n private _defaultOutputCalendar: LuxonCalendarSystem;\n\n constructor(...args: unknown[]);\n\n constructor() {\n super();\n\n const dateLocale = inject(MAT_DATE_LOCALE, {optional: true});\n const options = inject<MatLuxonDateAdapterOptions>(MAT_LUXON_DATE_ADAPTER_OPTIONS, {\n optional: true,\n });\n\n this._useUTC = !!options?.useUtc;\n this._firstDayOfWeek = options?.firstDayOfWeek;\n this._defaultOutputCalendar = options?.defaultOutputCalendar || 'gregory';\n this.setLocale(dateLocale || LuxonDateTime.local().locale);\n }\n\n getYear(date: LuxonDateTime): number {\n return date.year;\n }\n\n getMonth(date: LuxonDateTime): number {\n // Luxon works with 1-indexed months whereas our code expects 0-indexed.\n return date.month - 1;\n }\n\n getDate(date: LuxonDateTime): number {\n return date.day;\n }\n\n getDayOfWeek(date: LuxonDateTime): number {\n return date.weekday;\n }\n\n getMonthNames(style: 'long' | 'short' | 'narrow'): string[] {\n // Adding outputCalendar option, because LuxonInfo doesn't get effected by LuxonSettings\n return LuxonInfo.months(style, {\n locale: this.locale,\n outputCalendar: this._defaultOutputCalendar,\n });\n }\n\n getDateNames(): string[] {\n // At the time of writing, Luxon doesn't offer similar\n // functionality so we have to fall back to the Intl API.\n const dtf = new Intl.DateTimeFormat(this.locale, {day: 'numeric', timeZone: 'utc'});\n\n // Format a UTC date in order to avoid DST issues.\n return range(31, i => dtf.format(LuxonDateTime.utc(2017, 1, i + 1).toJSDate()));\n }\n\n getDayOfWeekNames(style: 'long' | 'short' | 'narrow'): string[] {\n // Note that we shift the array once, because Luxon returns Monday as the\n // first day of the week, whereas our logic assumes that it's Sunday. See:\n // https://moment.github.io/luxon/api-docs/index.html#infoweekdays\n const days = LuxonInfo.weekdays(style, {locale: this.locale});\n days.unshift(days.pop()!);\n return days;\n }\n\n getYearName(date: LuxonDateTime): string {\n return date.toFormat('yyyy', this._getOptions());\n }\n\n getFirstDayOfWeek(): number {\n return this._firstDayOfWeek ?? LuxonInfo.getStartOfWeek({locale: this.locale});\n }\n\n getNumDaysInMonth(date: LuxonDateTime): number {\n return date.daysInMonth!;\n }\n\n clone(date: LuxonDateTime): LuxonDateTime {\n return LuxonDateTime.fromObject(date.toObject(), this._getOptions());\n }\n\n createDate(year: number, month: number, date: number): LuxonDateTime {\n const options = this._getOptions();\n\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 // Luxon uses 1-indexed months so we need to add one to the month.\n const result = this._useUTC\n ? LuxonDateTime.utc(year, month + 1, date, options)\n : LuxonDateTime.local(year, month + 1, date, options);\n\n if (!this.isValid(result)) {\n throw Error(`Invalid date \"${date}\". Reason: \"${result.invalidReason}\".`);\n }\n\n return result;\n }\n\n today(): LuxonDateTime {\n const options = this._getOptions();\n\n return this._useUTC ? LuxonDateTime.utc(options) : LuxonDateTime.local(options);\n }\n\n parse(value: unknown, parseFormat: string | string[]): LuxonDateTime | null {\n const options: LuxonDateTimeOptions = this._getOptions();\n\n if (typeof value == 'string' && value.length > 0) {\n const iso8601Date = LuxonDateTime.fromISO(value, options);\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 format of formats) {\n const fromFormat = LuxonDateTime.fromFormat(value, format, options);\n\n if (this.isValid(fromFormat)) {\n return fromFormat;\n }\n }\n\n return this.invalid();\n } else if (typeof value === 'number') {\n return LuxonDateTime.fromMillis(value, options);\n } else if (value instanceof Date) {\n return LuxonDateTime.fromJSDate(value, options);\n } else if (value instanceof LuxonDateTime) {\n return LuxonDateTime.fromMillis(value.toMillis(), options);\n }\n\n return null;\n }\n\n format(date: LuxonDateTime, displayFormat: string): string {\n if (!this.isValid(date)) {\n throw Error('LuxonDateAdapter: Cannot format invalid date.');\n }\n if (this._useUTC) {\n return date.setLocale(this.locale).setZone('utc').toFormat(displayFormat);\n } else {\n return date.setLocale(this.locale).toFormat(displayFormat);\n }\n }\n\n addCalendarYears(date: LuxonDateTime, years: number): LuxonDateTime {\n return date.reconfigure(this._getOptions()).plus({years});\n }\n\n addCalendarMonths(date: LuxonDateTime, months: number): LuxonDateTime {\n return date.reconfigure(this._getOptions()).plus({months});\n }\n\n addCalendarDays(date: LuxonDateTime, days: number): LuxonDateTime {\n return date.reconfigure(this._getOptions()).plus({days});\n }\n\n toIso8601(date: LuxonDateTime): string {\n return date.toISO()!;\n }\n\n /**\n * Returns the given value if given a valid Luxon or null. Deserializes valid ISO 8601 strings\n * (https://www.ietf.org/rfc/rfc3339.txt) and valid Date objects into valid DateTime and empty\n * string into null. Returns an invalid date for all other values.\n */\n override deserialize(value: unknown): LuxonDateTime | null {\n const options = this._getOptions();\n let date: LuxonDateTime | undefined;\n if (value instanceof Date) {\n date = LuxonDateTime.fromJSDate(value, options);\n }\n if (typeof value === 'string') {\n if (!value) {\n return null;\n }\n date = LuxonDateTime.fromISO(value, options);\n }\n if (date && this.isValid(date)) {\n return date;\n }\n return super.deserialize(value);\n }\n\n isDateInstance(obj: unknown): obj is LuxonDateTime {\n return obj instanceof LuxonDateTime;\n }\n\n isValid(date: LuxonDateTime): boolean {\n return date.isValid;\n }\n\n invalid(): LuxonDateTime {\n return LuxonDateTime.invalid('Invalid Luxon DateTime object.');\n }\n\n override setTime(\n target: LuxonDateTime,\n hours: number,\n minutes: number,\n seconds: number,\n ): LuxonDateTime {\n if (typeof ngDevMode === 'undefined' || ngDevMode) {\n if (hours < 0 || hours > 23) {\n throw Error(`Invalid hours \"${hours}\". Hours value must be between 0 and 23.`);\n }\n\n if (minutes < 0 || minutes > 59) {\n throw Error(`Invalid minutes \"${minutes}\". Minutes value must be between 0 and 59.`);\n }\n\n if (seconds < 0 || seconds > 59) {\n throw Error(`Invalid seconds \"${seconds}\". Seconds value must be between 0 and 59.`);\n }\n }\n\n return this.clone(target).set({\n hour: hours,\n minute: minutes,\n second: seconds,\n millisecond: 0,\n });\n }\n\n override getHours(date: LuxonDateTime): number {\n return date.hour;\n }\n\n override getMinutes(date: LuxonDateTime): number {\n return date.minute;\n }\n\n override getSeconds(date: LuxonDateTime): number {\n return date.second;\n }\n\n override parseTime(value: unknown, parseFormat: string | string[]): LuxonDateTime | null {\n const result = this.parse(value, parseFormat);\n\n if ((!result || !this.isValid(result)) && typeof value === 'string') {\n // It seems like Luxon doesn't work well cross-browser for strings that have\n // additional characters around the time. Try parsing without those characters.\n return this.parse(value.replace(/[^0-9:(AM|PM)]/gi, ''), parseFormat) || result;\n }\n\n return result;\n }\n\n override addSeconds(date: LuxonDateTime, amount: number): LuxonDateTime {\n return date.reconfigure(this._getOptions()).plus({seconds: amount});\n }\n\n /** Gets the options that should be used when constructing a new `DateTime` object. */\n private _getOptions(): LuxonDateTimeOptions {\n return {\n zone: this._useUTC ? 'utc' : undefined,\n locale: this.locale,\n outputCalendar: this._defaultOutputCalendar,\n };\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_LUXON_DATE_FORMATS: MatDateFormats = {\n parse: {\n dateInput: 'D',\n timeInput: 't',\n },\n display: {\n dateInput: 'D',\n timeInput: 't',\n monthYearLabel: 'LLL yyyy',\n dateA11yLabel: 'DD',\n monthYearA11yLabel: 'LLLL yyyy',\n timeOptionLabel: 't',\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 {DateAdapter, MAT_DATE_FORMATS, MatDateFormats} from '@angular/material/core';\nimport {LuxonDateAdapter} from './luxon-date-adapter';\nimport {MAT_LUXON_DATE_FORMATS} from './luxon-date-formats';\n\nexport * from './luxon-date-adapter';\nexport * from './luxon-date-formats';\n\n@NgModule({\n providers: [\n {\n provide: DateAdapter,\n useClass: LuxonDateAdapter,\n },\n ],\n})\nexport class LuxonDateModule {}\n\n@NgModule({\n providers: [provideLuxonDateAdapter()],\n})\nexport class MatLuxonDateModule {}\n\nexport function provideLuxonDateAdapter(\n formats: MatDateFormats = MAT_LUXON_DATE_FORMATS,\n): Provider[] {\n return [\n {\n provide: DateAdapter,\n useClass: LuxonDateAdapter,\n },\n {provide: MAT_DATE_FORMATS, useValue: formats},\n ];\n}\n"],"names":["providedIn","factory","useUtc","defaultOutputCalendar","range","length","valueFunction","valuesArray","Array","i","DateAdapter","constructor","options","inject","MAT_LUXON_DATE_ADAPTER_OPTIONS","optional","_useUTC","_defaultOutputCalendar","setLocale","dateLocale","LuxonDateTime","local","locale","date","year","getMonth","month","getDate","day","getDayOfWeek","getMonthNames","style","LuxonInfo","months","Intl","DateTimeFormat","timeZone","dtf","format","utc","toJSDate","getDayOfWeekNames","days","weekdays","unshift","pop","getYearName","toFormat","_getOptions","getFirstDayOfWeek","_firstDayOfWeek","getStartOfWeek","getNumDaysInMonth","daysInMonth","fromObject","toObject","Error","result","isValid","invalidReason","value","iso8601Date","fromISO","isArray","parseFormat","formats","fromFormat","invalid","fromMillis","Date","toMillis","setZone","displayFormat","addCalendarYears","years","reconfigure","plus","addCalendarMonths","toISO","deserialize","MAT_LUXON_DATE_FORMATS","dateInput","timeInput","monthYearLabel","dateA11yLabel","monthYearA11yLabel","ɵmod","i0","ɵɵngDeclareNgModule","minVersion","version","ngImport","type","LuxonDateModule","ɵinj","ɵɵngDeclareInjector","providers","provide","useClass","LuxonDateAdapter","decorators","MatLuxonDateModule","deps","target","ɵɵFactoryTarget","NgModule","provideLuxonDateAdapter"],"mappings":";;;;;;EA0CIA,UAAA,EAAA,MAAA;EAEEC,OAAA,EAAAA,OAAa;AACbC,IAAAA,MAAA,EAAA,KAAA;IACAC,qBAEL,EAAA;;;SAyCCC,KAAAA,CAAAC,MAAA,EAAAC,aAAA,EAAA;AAEA,EAAA,MAAAC,WAA2B,GAAAC,KAAA,CAAAH,MAAA,CAAA;YAClB,GAAA,CAAA,EAAAI,CAAI,GAAAJ,MAAA,EAAAI,CAAA,EAAA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IAAAA,IAAA,EAAAS,kBAAA;AAAAL,IAAAA,SAAA,GAAAU,uBAAA,EAAA;AAAA,GAAA,CAAA;;AAEE,EAAA,CAAA,wBAAA,CAAA;EAAAjB,UAAA,EAAA,QAAA;EAAAC,OAAA,EAAA,eAAA;AAAAC,EAAAA,QAAA,EAAAJ,EAAA;AAAAK,EAAAA,IAAA,EAAAS,kBAAA;EAAAD,UAAA,EAAA,CAAA;;;;;;;;;AAGL,IAAA,OAAA,EAAA1F,WAAA;;;;;AAMY,GAAA,CAAA;;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@angular/material-luxon-adapter",
|
|
3
|
-
"version": "21.0.0-
|
|
3
|
+
"version": "21.0.0-rc.0",
|
|
4
4
|
"description": "Angular Material Luxon 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": "21.0.0-
|
|
15
|
+
"@angular/material": "21.0.0-rc.0",
|
|
16
16
|
"@angular/core": "^21.0.0-0 || ^21.1.0-0 || ^21.2.0-0 || ^21.3.0-0 || ^22.0.0-0",
|
|
17
|
-
"luxon": "^3.
|
|
17
|
+
"luxon": "^3.7.2"
|
|
18
18
|
},
|
|
19
19
|
"devDependencies": {
|
|
20
20
|
"@angular/material": "workspace:*"
|