MCPcopy Create free account
hub / github.com/11ty/parse-date-strings / parse

Function parse

test/temporal.js:38–58  ·  view source on GitHub ↗
(str)

Source from the content-addressed store, hash-verified

36}
37
38export function parse(str) {
39 let result;
40 let errors = [];
41 try {
42 result = parseDate(str);
43 } catch(e) {
44 errors.push(e);
45 }
46 try {
47 result = parseDateTime(str);
48 } catch(e) {
49 errors.push(e);
50 }
51
52 // if both methods resulted in errors
53 if(errors.length === 2) {
54 throw errors.pop();
55 }
56
57 return result;
58}

Callers

nothing calls this directly

Calls 2

parseDateFunction · 0.85
parseDateTimeFunction · 0.85

Tested by

no test coverage detected