MCPcopy
hub / github.com/date-fns/date-fns / parse

Method parse

pkgs/core/src/parse/_lib/parsers/DayParser.ts:10–49  ·  view source on GitHub ↗
(dateString: string, token: string, match: Match)

Source from the content-addressed store, hash-verified

8 priority = 90;
9
10 parse(dateString: string, token: string, match: Match): ParseResult<number> {
11 switch (token) {
12 // Tue
13 case "E":
14 case "EE":
15 case "EEE":
16 return (
17 match.day(dateString, {
18 width: "abbreviated",
19 context: "formatting",
20 }) ||
21 match.day(dateString, { width: "short", context: "formatting" }) ||
22 match.day(dateString, { width: "narrow", context: "formatting" })
23 );
24 // T
25 case "EEEEE":
26 return match.day(dateString, {
27 width: "narrow",
28 context: "formatting",
29 });
30 // Tu
31 case "EEEEEE":
32 return (
33 match.day(dateString, { width: "short", context: "formatting" }) ||
34 match.day(dateString, { width: "narrow", context: "formatting" })
35 );
36 // Tuesday
37 case "EEEE":
38 default:
39 return (
40 match.day(dateString, { width: "wide", context: "formatting" }) ||
41 match.day(dateString, {
42 width: "abbreviated",
43 context: "formatting",
44 }) ||
45 match.day(dateString, { width: "short", context: "formatting" }) ||
46 match.day(dateString, { width: "narrow", context: "formatting" })
47 );
48 }
49 }
50
51 override validate<DateType extends Date>(
52 _date: DateType,

Callers 5

runFunction · 0.45
getVersionFunction · 0.45
readDocsJSONFunction · 0.45
buildMds.tsFile · 0.45
tests.tsFile · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected