(name)
| 34 | const ascForm = (t) => `${DAYS_ABBR[jsDay(t[6])]} ${MONTHS_ABBR[t[1] - 1]} ${String(t[2]).padStart(2, " ")} ${pad(t[3])}:${pad(t[4])}:${pad(t[5])} ${t[0]}`; |
| 35 | |
| 36 | const monthIndex = (name) => { |
| 37 | const full = MONTHS.findIndex((m) => m.toLowerCase() === name.toLowerCase()); |
| 38 | return full >= 0 ? full : MONTHS_ABBR.findIndex((m) => m.toLowerCase() === name.toLowerCase()); |
| 39 | }; |
| 40 | |
| 41 | // Compile the format into a regex, capture fields, assemble a struct_time JSON. |
| 42 | const STRP = { Y: "(\\d{4})", y: "(\\d{2})", m: "(\\d{1,2})", d: "(\\d{1,2})", H: "(\\d{1,2})", M: "(\\d{1,2})", S: "(\\d{1,2})", j: "(\\d{1,3})", b: "([A-Za-z]+)", B: "([A-Za-z]+)", a: "([A-Za-z]+)", A: "([A-Za-z]+)" }; |