@markuplint/types 3.12.0 → 4.0.0-alpha.10
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.
- package/LICENSE +1 -1
- package/lib/check-multi-types.d.ts +2 -5
- package/lib/check-multi-types.js +9 -14
- package/lib/check.d.ts +1 -1
- package/lib/check.js +20 -30
- package/lib/css-syntax.d.ts +1 -1
- package/lib/css-syntax.js +33 -33
- package/lib/debug.js +2 -6
- package/lib/defs.d.ts +2 -1
- package/lib/defs.js +188 -138
- package/lib/enum.d.ts +2 -2
- package/lib/enum.js +7 -12
- package/lib/get-candidate.d.ts +1 -4
- package/lib/get-candidate.js +5 -10
- package/lib/index.d.ts +3 -3
- package/lib/index.js +3 -6
- package/lib/keyword-type.d.ts +2 -2
- package/lib/keyword-type.js +20 -25
- package/lib/list.d.ts +2 -2
- package/lib/list.js +9 -14
- package/lib/match-result.d.ts +8 -21
- package/lib/match-result.js +6 -13
- package/lib/number.d.ts +3 -3
- package/lib/number.js +13 -17
- package/lib/primitive/index.d.ts +7 -7
- package/lib/primitive/index.js +7 -17
- package/lib/primitive/is-float.js +2 -6
- package/lib/primitive/is-int.js +2 -6
- package/lib/primitive/is-non-zero-uint.js +2 -6
- package/lib/primitive/is-quantity.d.ts +1 -5
- package/lib/primitive/is-quantity.js +9 -13
- package/lib/primitive/is-uint.d.ts +3 -6
- package/lib/primitive/is-uint.js +4 -8
- package/lib/primitive/range.js +3 -7
- package/lib/primitive/split-unit.d.ts +2 -2
- package/lib/primitive/split-unit.js +4 -8
- package/lib/rfc/is-bcp-47.d.ts +1 -1
- package/lib/rfc/is-bcp-47.js +3 -7
- package/lib/token/index.d.ts +2 -2
- package/lib/token/index.js +2 -7
- package/lib/token/token-collection.d.ts +58 -70
- package/lib/token/token-collection.js +47 -56
- package/lib/token/token.d.ts +54 -59
- package/lib/token/token.js +14 -20
- package/lib/token/types.js +1 -2
- package/lib/types.d.ts +58 -82
- package/lib/types.js +1 -2
- package/lib/types.schema.d.ts +31 -1087
- package/lib/types.schema.js +1 -2
- package/lib/w3c/check-serialized-permissions-policy.d.ts +1 -1
- package/lib/w3c/check-serialized-permissions-policy.js +21 -25
- package/lib/whatwg/check-autocomplete.d.ts +1 -1
- package/lib/whatwg/check-autocomplete.js +34 -41
- package/lib/whatwg/check-datetime/date-string.d.ts +1 -1
- package/lib/whatwg/check-datetime/date-string.js +12 -16
- package/lib/whatwg/check-datetime/datetime-tokens.d.ts +2 -22
- package/lib/whatwg/check-datetime/datetime-tokens.js +58 -64
- package/lib/whatwg/check-datetime/duration-string.d.ts +1 -1
- package/lib/whatwg/check-datetime/duration-string.js +64 -69
- package/lib/whatwg/check-datetime/global-date-and-time-string.d.ts +1 -1
- package/lib/whatwg/check-datetime/global-date-and-time-string.js +24 -28
- package/lib/whatwg/check-datetime/index.d.ts +1 -1
- package/lib/whatwg/check-datetime/index.js +25 -29
- package/lib/whatwg/check-datetime/local-date-and-time-string.d.ts +1 -1
- package/lib/whatwg/check-datetime/local-date-and-time-string.js +37 -41
- package/lib/whatwg/check-datetime/month-string.d.ts +1 -1
- package/lib/whatwg/check-datetime/month-string.js +9 -13
- package/lib/whatwg/check-datetime/time-string.d.ts +1 -1
- package/lib/whatwg/check-datetime/time-string.js +13 -17
- package/lib/whatwg/check-datetime/time-zone-offset-string.d.ts +3 -3
- package/lib/whatwg/check-datetime/time-zone-offset-string.js +22 -28
- package/lib/whatwg/check-datetime/week-string.d.ts +1 -1
- package/lib/whatwg/check-datetime/week-string.js +11 -15
- package/lib/whatwg/check-datetime/year-string.d.ts +1 -1
- package/lib/whatwg/check-datetime/year-string.js +9 -13
- package/lib/whatwg/check-datetime/yearless-date-string.d.ts +1 -1
- package/lib/whatwg/check-datetime/yearless-date-string.js +11 -15
- package/lib/whatwg/check-mime-type.d.ts +5 -5
- package/lib/whatwg/check-mime-type.js +11 -17
- package/lib/whatwg/is-abs-url.d.ts +1 -1
- package/lib/whatwg/is-abs-url.js +8 -12
- package/lib/whatwg/is-browser-context-name.d.ts +1 -1
- package/lib/whatwg/is-browser-context-name.js +1 -5
- package/lib/whatwg/is-custom-element-name.d.ts +10 -5
- package/lib/whatwg/is-custom-element-name.js +22 -38
- package/lib/whatwg/is-itemprop-name.d.ts +1 -1
- package/lib/whatwg/is-itemprop-name.js +1 -5
- package/lib/whatwg/is-navigable-target-name.d.ts +1 -1
- package/lib/whatwg/is-navigable-target-name.js +1 -5
- package/package.json +17 -9
- package/test/check.spec.js +0 -89
- package/test/css-syntax.spec.js +0 -170
- package/test/list.spec.js +0 -133
- package/test/primitive/index.spec.js +0 -65
- package/test/rfc/is-bcp-47.spec.js +0 -23
- package/test/token/token-collection.spec.js +0 -146
- package/test/w3c/check-serialized-permissions-policy.spec.js +0 -36
- package/test/whatwg/check-autocomplete.spec.js +0 -387
- package/test/whatwg/check-datetime/index.spec.js +0 -336
- package/test/whatwg/check-mime-type.spec.js +0 -59
- package/test/whatwg/is-abs-url.spec.js +0 -8
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const debug_1 = require("../../debug");
|
|
5
|
-
const match_result_1 = require("../../match-result");
|
|
6
|
-
exports.datetimeTokenCheck = {
|
|
1
|
+
import { log } from '../../debug.js';
|
|
2
|
+
import { matched, unmatched } from '../../match-result.js';
|
|
3
|
+
export const datetimeTokenCheck = {
|
|
7
4
|
/**
|
|
8
5
|
* Temporary year state
|
|
9
6
|
*/
|
|
@@ -16,15 +13,15 @@ exports.datetimeTokenCheck = {
|
|
|
16
13
|
* > Four or more ASCII digits, representing year, where year > 0
|
|
17
14
|
*/
|
|
18
15
|
year(year) {
|
|
19
|
-
|
|
16
|
+
log('Parsing Datetime Year: "%s"', year?.value);
|
|
20
17
|
this._year = null;
|
|
21
18
|
if (!year || !year.value) {
|
|
22
|
-
return
|
|
19
|
+
return unmatched('', 'missing-token', {
|
|
23
20
|
expects: [{ type: 'common', value: 'year' }],
|
|
24
21
|
partName: 'year',
|
|
25
22
|
});
|
|
26
23
|
}
|
|
27
|
-
if (!year.
|
|
24
|
+
if (!year.matches(/^\d+$/)) {
|
|
28
25
|
return year.unmatched({
|
|
29
26
|
reason: 'unexpected-token',
|
|
30
27
|
expects: [],
|
|
@@ -51,15 +48,15 @@ exports.datetimeTokenCheck = {
|
|
|
51
48
|
* > Two ASCII digits, representing the month month, in the range 1 ≤ month ≤ 12
|
|
52
49
|
*/
|
|
53
50
|
month(month) {
|
|
54
|
-
|
|
51
|
+
log('Parsing Datetime Month: "%s"', month?.value);
|
|
55
52
|
this._month = null;
|
|
56
53
|
if (!month || !month.value) {
|
|
57
|
-
return
|
|
54
|
+
return unmatched('', 'missing-token', {
|
|
58
55
|
expects: [{ type: 'common', value: 'month' }],
|
|
59
56
|
partName: 'month',
|
|
60
57
|
});
|
|
61
58
|
}
|
|
62
|
-
if (!month.
|
|
59
|
+
if (!month.matches(/^\d+$/)) {
|
|
63
60
|
return month.unmatched({
|
|
64
61
|
reason: 'unexpected-token',
|
|
65
62
|
expects: [],
|
|
@@ -95,15 +92,14 @@ exports.datetimeTokenCheck = {
|
|
|
95
92
|
* > then the day can be 29, as if the year was a leap year.
|
|
96
93
|
*/
|
|
97
94
|
date(date) {
|
|
98
|
-
|
|
99
|
-
(0, debug_1.log)('Parsing Datetime Date: "%s"', date === null || date === void 0 ? void 0 : date.value);
|
|
95
|
+
log('Parsing Datetime Date: "%s"', date?.value);
|
|
100
96
|
if (!date || !date.value) {
|
|
101
|
-
return
|
|
97
|
+
return unmatched('', 'missing-token', {
|
|
102
98
|
expects: [{ type: 'common', value: 'date' }],
|
|
103
99
|
partName: 'date',
|
|
104
100
|
});
|
|
105
101
|
}
|
|
106
|
-
if (!date.
|
|
102
|
+
if (!date.matches(/^\d+$/)) {
|
|
107
103
|
return date.unmatched({
|
|
108
104
|
reason: 'unexpected-token',
|
|
109
105
|
expects: [],
|
|
@@ -118,13 +114,13 @@ exports.datetimeTokenCheck = {
|
|
|
118
114
|
});
|
|
119
115
|
}
|
|
120
116
|
// Set the leap year if _year is null
|
|
121
|
-
const year =
|
|
117
|
+
const year = this._year ?? 2000;
|
|
122
118
|
const isLeap = (year % 4 === 0 && year % 100 !== 0) || year % 400 === 0;
|
|
123
|
-
const month =
|
|
124
|
-
const dayOfMonth = (
|
|
119
|
+
const month = this._month ?? 1;
|
|
120
|
+
const dayOfMonth = (daysOfMonth[month] ?? 0) + (month === 2 && isLeap ? 1 : 0);
|
|
125
121
|
const _date = date.toNumber();
|
|
126
|
-
|
|
127
|
-
|
|
122
|
+
log('Temporary Year and Month: %s, %s', this._year, this._month);
|
|
123
|
+
log('Computed Year, Month, and Day of Month: %s, %s, %s', year, month, dayOfMonth);
|
|
128
124
|
if (!(1 <= _date && _date <= dayOfMonth)) {
|
|
129
125
|
return date.unmatched({
|
|
130
126
|
reason: { type: 'out-of-range', gte: 1, lte: dayOfMonth },
|
|
@@ -137,14 +133,14 @@ exports.datetimeTokenCheck = {
|
|
|
137
133
|
* > Two ASCII digits, representing hour, in the range 0 ≤ hour ≤ 23
|
|
138
134
|
*/
|
|
139
135
|
hour(hour) {
|
|
140
|
-
|
|
136
|
+
log('Parsing Datetime Hour: "%s"', hour?.value);
|
|
141
137
|
if (!hour || !hour.value) {
|
|
142
|
-
return
|
|
138
|
+
return unmatched('', 'missing-token', {
|
|
143
139
|
expects: [{ type: 'common', value: 'hour' }],
|
|
144
140
|
partName: 'hour',
|
|
145
141
|
});
|
|
146
142
|
}
|
|
147
|
-
if (!hour.
|
|
143
|
+
if (!hour.matches(/^\d+$/)) {
|
|
148
144
|
return hour.unmatched({
|
|
149
145
|
reason: 'unexpected-token',
|
|
150
146
|
expects: [],
|
|
@@ -171,14 +167,14 @@ exports.datetimeTokenCheck = {
|
|
|
171
167
|
* > Two ASCII digits, representing minute, in the range 0 ≤ minute ≤ 59
|
|
172
168
|
*/
|
|
173
169
|
minute(minute) {
|
|
174
|
-
|
|
170
|
+
log('Parsing Datetime Minute: "%s"', minute?.value);
|
|
175
171
|
if (!minute || !minute.value) {
|
|
176
|
-
return
|
|
172
|
+
return unmatched('', 'missing-token', {
|
|
177
173
|
expects: [{ type: 'common', value: 'minute' }],
|
|
178
174
|
partName: 'minute',
|
|
179
175
|
});
|
|
180
176
|
}
|
|
181
|
-
if (!minute.
|
|
177
|
+
if (!minute.matches(/^\d+$/)) {
|
|
182
178
|
return minute.unmatched({
|
|
183
179
|
reason: 'unexpected-token',
|
|
184
180
|
expects: [],
|
|
@@ -205,14 +201,14 @@ exports.datetimeTokenCheck = {
|
|
|
205
201
|
* > Two ASCII digits, representing the integer part of second, in the range 0 ≤ s ≤ 59
|
|
206
202
|
*/
|
|
207
203
|
second(second) {
|
|
208
|
-
|
|
204
|
+
log('Parsing Datetime Second: "%s"', second?.value);
|
|
209
205
|
if (!second || !second.value) {
|
|
210
|
-
return
|
|
206
|
+
return unmatched('', 'missing-token', {
|
|
211
207
|
expects: [{ type: 'common', value: 'second' }],
|
|
212
208
|
partName: 'second',
|
|
213
209
|
});
|
|
214
210
|
}
|
|
215
|
-
if (!second.
|
|
211
|
+
if (!second.matches(/^\d+$/)) {
|
|
216
212
|
return second.unmatched({
|
|
217
213
|
reason: 'unexpected-token',
|
|
218
214
|
expects: [],
|
|
@@ -239,21 +235,21 @@ exports.datetimeTokenCheck = {
|
|
|
239
235
|
* > One, two, or three ASCII digits, representing the fractional part of second
|
|
240
236
|
*/
|
|
241
237
|
secondFractionalPart(secondFP) {
|
|
242
|
-
|
|
238
|
+
log('Parsing Datetime Second Fractional Part: "%s"', secondFP?.value);
|
|
243
239
|
if (!secondFP || !secondFP.value) {
|
|
244
|
-
return
|
|
240
|
+
return unmatched('', 'missing-token', {
|
|
245
241
|
expects: [{ type: 'common', value: 'fractional part' }],
|
|
246
242
|
partName: 'fractional part',
|
|
247
243
|
});
|
|
248
244
|
}
|
|
249
|
-
if (!secondFP.
|
|
245
|
+
if (!secondFP.matches(/^\d+$/)) {
|
|
250
246
|
return secondFP.unmatched({
|
|
251
247
|
reason: 'unexpected-token',
|
|
252
248
|
expects: [],
|
|
253
249
|
partName: 'fractional part',
|
|
254
250
|
});
|
|
255
251
|
}
|
|
256
|
-
if (!(
|
|
252
|
+
if (!(secondFP.length > 0 && secondFP.length <= 3)) {
|
|
257
253
|
return secondFP.unmatched({
|
|
258
254
|
reason: { type: 'out-of-range-length-digit', gte: 1, lte: 3 },
|
|
259
255
|
expects: [],
|
|
@@ -265,15 +261,14 @@ exports.datetimeTokenCheck = {
|
|
|
265
261
|
* > Two ASCII digits, representing the week week, in the range 1 ≤ week ≤ maxweek, where maxweek is the week number of the last day of week-year year
|
|
266
262
|
*/
|
|
267
263
|
week(week) {
|
|
268
|
-
|
|
269
|
-
(0, debug_1.log)('Parsing Datetime Week: "%s"', week === null || week === void 0 ? void 0 : week.value);
|
|
264
|
+
log('Parsing Datetime Week: "%s"', week?.value);
|
|
270
265
|
if (!week || !week.value) {
|
|
271
|
-
return
|
|
266
|
+
return unmatched('', 'missing-token', {
|
|
272
267
|
expects: [{ type: 'common', value: 'week' }],
|
|
273
268
|
partName: 'week',
|
|
274
269
|
});
|
|
275
270
|
}
|
|
276
|
-
if (!week.
|
|
271
|
+
if (!week.matches(/^\d+$/)) {
|
|
277
272
|
return week.unmatched({
|
|
278
273
|
reason: 'unexpected-token',
|
|
279
274
|
expects: [],
|
|
@@ -287,7 +282,7 @@ exports.datetimeTokenCheck = {
|
|
|
287
282
|
partName: 'week',
|
|
288
283
|
});
|
|
289
284
|
}
|
|
290
|
-
const maxweek = getMaxWeekNum(
|
|
285
|
+
const maxweek = getMaxWeekNum(this._year ?? 0);
|
|
291
286
|
const _week = week.toNumber();
|
|
292
287
|
if (!(1 <= _week && _week <= maxweek)) {
|
|
293
288
|
return week.unmatched({
|
|
@@ -301,14 +296,14 @@ exports.datetimeTokenCheck = {
|
|
|
301
296
|
* > A U+002D HYPHEN-MINUS character (-)
|
|
302
297
|
*/
|
|
303
298
|
hyphen(hyphen) {
|
|
304
|
-
|
|
299
|
+
log('Parsing Datetime hyphen: "%s"', hyphen?.value);
|
|
305
300
|
if (!hyphen || !hyphen.value) {
|
|
306
|
-
return
|
|
301
|
+
return unmatched('', 'missing-token', {
|
|
307
302
|
expects: [{ type: 'common', value: 'hyphen' }],
|
|
308
303
|
partName: 'datetime',
|
|
309
304
|
});
|
|
310
305
|
}
|
|
311
|
-
if (!hyphen.
|
|
306
|
+
if (!hyphen.matches('-')) {
|
|
312
307
|
return hyphen.unmatched({
|
|
313
308
|
reason: 'unexpected-token',
|
|
314
309
|
expects: [{ type: 'common', value: 'hyphen' }],
|
|
@@ -320,14 +315,14 @@ exports.datetimeTokenCheck = {
|
|
|
320
315
|
* > A U+003A COLON character (:)
|
|
321
316
|
*/
|
|
322
317
|
colon(colon) {
|
|
323
|
-
|
|
318
|
+
log('Parsing Datetime colon: "%s"', colon?.value);
|
|
324
319
|
if (!colon || !colon.value) {
|
|
325
|
-
return
|
|
320
|
+
return unmatched('', 'missing-token', {
|
|
326
321
|
expects: [{ type: 'common', value: 'colon' }],
|
|
327
322
|
partName: 'time',
|
|
328
323
|
});
|
|
329
324
|
}
|
|
330
|
-
if (!colon.
|
|
325
|
+
if (!colon.matches(':')) {
|
|
331
326
|
return colon.unmatched({
|
|
332
327
|
reason: 'unexpected-token',
|
|
333
328
|
expects: [{ type: 'common', value: 'colon' }],
|
|
@@ -342,9 +337,9 @@ exports.datetimeTokenCheck = {
|
|
|
342
337
|
*/
|
|
343
338
|
colonOrEnd(colon) {
|
|
344
339
|
if (!colon || !colon.value) {
|
|
345
|
-
return
|
|
340
|
+
return matched();
|
|
346
341
|
}
|
|
347
|
-
if (!colon.
|
|
342
|
+
if (!colon.matches(':')) {
|
|
348
343
|
return colon.unmatched({
|
|
349
344
|
reason: 'unexpected-token',
|
|
350
345
|
expects: [{ type: 'common', value: 'colon' }],
|
|
@@ -359,9 +354,9 @@ exports.datetimeTokenCheck = {
|
|
|
359
354
|
*/
|
|
360
355
|
decimalPointOrEnd(dot) {
|
|
361
356
|
if (!dot || !dot.value) {
|
|
362
|
-
return
|
|
357
|
+
return matched();
|
|
363
358
|
}
|
|
364
|
-
if (!dot.
|
|
359
|
+
if (!dot.matches('.')) {
|
|
365
360
|
return dot.unmatched({
|
|
366
361
|
reason: 'unexpected-token',
|
|
367
362
|
expects: [{ type: 'common', value: 'decimal point' }],
|
|
@@ -373,16 +368,16 @@ exports.datetimeTokenCheck = {
|
|
|
373
368
|
* > A U+0054 LATIN CAPITAL LETTER T character (T) or a U+0020 SPACE character
|
|
374
369
|
*/
|
|
375
370
|
localDateTimeSeparator(sep) {
|
|
376
|
-
|
|
371
|
+
log('Parsing Datetime Local-Date-Time separator: "%s"', sep?.value);
|
|
377
372
|
if (!sep || !sep.value) {
|
|
378
|
-
return
|
|
373
|
+
return unmatched('', 'missing-token', {
|
|
379
374
|
expects: [
|
|
380
375
|
{ type: 'const', value: 'T' },
|
|
381
376
|
{ type: 'common', value: 'space' },
|
|
382
377
|
],
|
|
383
378
|
});
|
|
384
379
|
}
|
|
385
|
-
if (!sep.
|
|
380
|
+
if (!sep.matches(['T', ' '])) {
|
|
386
381
|
return sep.unmatched({
|
|
387
382
|
reason: 'unexpected-token',
|
|
388
383
|
expects: [
|
|
@@ -396,13 +391,13 @@ exports.datetimeTokenCheck = {
|
|
|
396
391
|
* > A U+0054 LATIN CAPITAL LETTER T character (T)
|
|
397
392
|
*/
|
|
398
393
|
normalizedlocalDateTimeSeparator(sep) {
|
|
399
|
-
|
|
394
|
+
log('Parsing Datetime Normalized-Local-Date-Time separator: %s', sep?.value);
|
|
400
395
|
if (!sep || !sep.value) {
|
|
401
|
-
return
|
|
396
|
+
return unmatched('', 'missing-token', {
|
|
402
397
|
expects: [{ type: 'const', value: 'T' }],
|
|
403
398
|
});
|
|
404
399
|
}
|
|
405
|
-
if (!sep.
|
|
400
|
+
if (!sep.matches('T')) {
|
|
406
401
|
return sep.unmatched({
|
|
407
402
|
reason: 'unexpected-token',
|
|
408
403
|
expects: [{ type: 'const', value: 'T' }],
|
|
@@ -417,7 +412,7 @@ exports.datetimeTokenCheck = {
|
|
|
417
412
|
*/
|
|
418
413
|
plusOrMinusSign(colon) {
|
|
419
414
|
if (!colon) {
|
|
420
|
-
return
|
|
415
|
+
return unmatched('', 'missing-token', {
|
|
421
416
|
expects: [
|
|
422
417
|
{ type: 'const', value: '+' },
|
|
423
418
|
{ type: 'const', value: '-' },
|
|
@@ -425,7 +420,7 @@ exports.datetimeTokenCheck = {
|
|
|
425
420
|
partName: 'time-zone',
|
|
426
421
|
});
|
|
427
422
|
}
|
|
428
|
-
if (!colon.
|
|
423
|
+
if (!colon.matches(['+', '-'])) {
|
|
429
424
|
return colon.unmatched({
|
|
430
425
|
reason: 'unexpected-token',
|
|
431
426
|
expects: [
|
|
@@ -440,14 +435,14 @@ exports.datetimeTokenCheck = {
|
|
|
440
435
|
* > A U+0057 LATIN CAPITAL LETTER W character (W)
|
|
441
436
|
*/
|
|
442
437
|
weekSign(weekSign) {
|
|
443
|
-
|
|
438
|
+
log('Parsing Datetime W sign: "%s"', weekSign?.value);
|
|
444
439
|
if (!weekSign || !weekSign.value) {
|
|
445
|
-
return
|
|
440
|
+
return unmatched('', 'missing-token', {
|
|
446
441
|
expects: [{ type: 'const', value: 'W' }],
|
|
447
442
|
partName: 'time-zone',
|
|
448
443
|
});
|
|
449
444
|
}
|
|
450
|
-
if (!weekSign.
|
|
445
|
+
if (!weekSign.matches('W')) {
|
|
451
446
|
return weekSign.unmatched({
|
|
452
447
|
reason: 'unexpected-token',
|
|
453
448
|
expects: [{ type: 'const', value: 'W' }],
|
|
@@ -459,7 +454,7 @@ exports.datetimeTokenCheck = {
|
|
|
459
454
|
* Extra token
|
|
460
455
|
*/
|
|
461
456
|
extra(extra) {
|
|
462
|
-
|
|
457
|
+
log('Parsing Datetime EXTRA STRING: "%s"', extra?.value);
|
|
463
458
|
if (extra && extra.value) {
|
|
464
459
|
return extra.unmatched({
|
|
465
460
|
reason: 'extra-token',
|
|
@@ -494,7 +489,7 @@ const daysOfMonth = [
|
|
|
494
489
|
// 12
|
|
495
490
|
31,
|
|
496
491
|
];
|
|
497
|
-
function getMaxWeekNum(year) {
|
|
492
|
+
export function getMaxWeekNum(year) {
|
|
498
493
|
let date = 31;
|
|
499
494
|
while (date > 0) {
|
|
500
495
|
const d = new Date(Date.UTC(year, 11, date, 0, 0, 0, 0));
|
|
@@ -507,6 +502,5 @@ function getMaxWeekNum(year) {
|
|
|
507
502
|
}
|
|
508
503
|
date--;
|
|
509
504
|
}
|
|
510
|
-
return NaN;
|
|
505
|
+
return Number.NaN;
|
|
511
506
|
}
|
|
512
|
-
exports.getMaxWeekNum = getMaxWeekNum;
|