@@ -102,10 +102,10 @@ export const genitiveTokens = ["MMMM", "MMM", "dddd", "ddd"]
102
102
/**
103
103
* A map of FormatPattern tuples to their respective token.
104
104
*/
105
- export const tokens = new Map (
106
- [ ...clockAgnostic , ...clock24 , ...clock12 ] . map ( ( format ) => {
105
+ export const tokens = /* @__PURE__ */ new Map (
106
+ /* @__PURE__ */ [ ...clockAgnostic , ...clock24 , ...clock12 ] . map ( ( format ) => {
107
107
return [ format [ 0 ] , format ]
108
- } ) ,
108
+ } )
109
109
)
110
110
111
111
/**
@@ -139,7 +139,7 @@ export const four = (n: number) => String(n).padStart(2, "0")
139
139
* @param part - The part to normalize.
140
140
*/
141
141
export function normStr (
142
- part : Intl . DateTimeFormatPart ,
142
+ part : Intl . DateTimeFormatPart
143
143
) : Intl . DateTimeFormatPart {
144
144
if ( part . type === "literal" ) {
145
145
part . value = part . value . normalize ( "NFKC" )
@@ -160,7 +160,7 @@ export function fill(
160
160
parts : Part [ ] ,
161
161
locale : string ,
162
162
genitive = false ,
163
- offset : string | null = null ,
163
+ offset : string | null = null
164
164
) : FilledPart [ ] {
165
165
const partMap = createPartMap ( inputDate , parts , locale , genitive )
166
166
const d = date ( inputDate )
@@ -213,7 +213,7 @@ function createPartMap(
213
213
inputDate : DateInput ,
214
214
parts : Part [ ] ,
215
215
locale : string ,
216
- genitive = false ,
216
+ genitive = false
217
217
) : Record < keyof Intl . DateTimeFormatPartTypesRegistry , string > {
218
218
const d = date ( inputDate )
219
219
const hour12 = parts . filter ( ( part ) => part . hour12 )
@@ -239,7 +239,7 @@ function createPartMap(
239
239
)
240
240
)
241
241
. formatToParts ( d )
242
- . map ( normStr ) ,
242
+ . map ( normStr )
243
243
)
244
244
if ( genitive && genitiveParts . length ) {
245
245
for ( const part of genitiveParts ) {
@@ -263,7 +263,7 @@ function createPartMap(
263
263
break
264
264
}
265
265
const genitiveFormattedPart = formattedParts . find (
266
- ( p ) => p . type === part . partName ,
266
+ ( p ) => p . type === part . partName
267
267
)
268
268
const index = valueParts . findIndex ( ( p ) => p . type === part . partName )
269
269
if ( genitiveFormattedPart && index > - 1 ) {
@@ -276,13 +276,10 @@ function createPartMap(
276
276
if ( hour12 . length ) addValues ( hour12 , true )
277
277
if ( hour24 . length ) addValues ( hour24 )
278
278
279
- return valueParts . reduce (
280
- ( map , part ) => {
281
- map [ part . type ] = part . value
282
- return map
283
- } ,
284
- { } as Record < keyof Intl . DateTimeFormatPartTypesRegistry , string > ,
285
- )
279
+ return valueParts . reduce ( ( map , part ) => {
280
+ map [ part . type ] = part . value
281
+ return map
282
+ } , { } as Record < keyof Intl . DateTimeFormatPartTypesRegistry , string > )
286
283
}
287
284
288
285
/**
@@ -293,7 +290,7 @@ function createPartMap(
293
290
export function minsToOffset ( timeDiffInMins : number ) : string {
294
291
const hours = String ( Math . floor ( Math . abs ( timeDiffInMins / 60 ) ) ) . padStart (
295
292
2 ,
296
- "0" ,
293
+ "0"
297
294
)
298
295
const mins = String ( Math . abs ( timeDiffInMins % 60 ) ) . padStart ( 2 , "0" )
299
296
const sign = timeDiffInMins < 0 ? "-" : "+"
@@ -366,7 +363,7 @@ export function validate(parts: Part[]): Part[] | never {
366
363
! ( isNumeric ( lastPart ) && part . token . toLowerCase ( ) === "a" )
367
364
) {
368
365
throw new Error (
369
- `Illegal adjacent tokens (${ lastPart . token } , ${ part . token } )` ,
366
+ `Illegal adjacent tokens (${ lastPart . token } , ${ part . token } )`
370
367
)
371
368
}
372
369
}
0 commit comments