MCPcopy
hub / github.com/iamkun/dayjs / matches

Method matches

src/index.js:285–339  ·  view source on GitHub ↗
(match)

Source from the content-addressed store, hash-verified

283 })
284
285 const matches = (match) => {
286 switch (match) {
287 case 'YY':
288 return String(this.$y).slice(-2)
289 case 'YYYY':
290 return Utils.s(this.$y, 4, '0')
291 case 'M':
292 return $M + 1
293 case 'MM':
294 return Utils.s($M + 1, 2, '0')
295 case 'MMM':
296 return getShort(locale.monthsShort, $M, months, 3)
297 case 'MMMM':
298 return getShort(months, $M)
299 case 'D':
300 return this.$D
301 case 'DD':
302 return Utils.s(this.$D, 2, '0')
303 case 'd':
304 return String(this.$W)
305 case 'dd':
306 return getShort(locale.weekdaysMin, this.$W, weekdays, 2)
307 case 'ddd':
308 return getShort(locale.weekdaysShort, this.$W, weekdays, 3)
309 case 'dddd':
310 return weekdays[this.$W]
311 case 'H':
312 return String($H)
313 case 'HH':
314 return Utils.s($H, 2, '0')
315 case 'h':
316 return get$H(1)
317 case 'hh':
318 return get$H(2)
319 case 'a':
320 return meridiemFunc($H, $m, true)
321 case 'A':
322 return meridiemFunc($H, $m, false)
323 case 'm':
324 return String($m)
325 case 'mm':
326 return Utils.s($m, 2, '0')
327 case 's':
328 return String(this.$s)
329 case 'ss':
330 return Utils.s(this.$s, 2, '0')
331 case 'SSS':
332 return Utils.s(this.$ms, 3, '0')
333 case 'Z':
334 return zoneStr // 'ZZ' logic below
335 default:
336 break
337 }
338 return null
339 }
340
341 return str.replace(C.REGEX_FORMAT, (match, $1) => $1 || matches(match) || zoneStr.replace(':', '')) // 'ZZ'
342 }

Callers

nothing calls this directly

Calls 1

getShortFunction · 0.85

Tested by

no test coverage detected