feat(dates): read a bare ISO date as one boundary
bluearchive.wiki gives each boundary its own column and writes it as a plain 2026-08-04, so unlike every reader here there is no range to split and no field order to infer. Day precision, because the page states no time of day. Anchored at both ends, which matters more for this shape than for any other in the module: it is the least distinctive one, and unanchored it would happily find a date inside an article slug or a version string. Also names the two readers the paragraph below the table was describing. "The last two" stopped being true when rows were appended after them, and the examples belong to parseAdjacentFullRange either way. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
This commit is contained in:
co-authored by
Claude Opus 5
parent
02dd7b3ed4
commit
77921e88f5
@@ -52,6 +52,25 @@ export function parseMonthDayYear(input: string): ParsedInstant | null {
|
||||
return value === null ? null : { iso: value, precision: "day" };
|
||||
}
|
||||
|
||||
/**
|
||||
* "2026-08-04" → 2026-08-04T00:00:00.000Z, day precision.
|
||||
*
|
||||
* A whole cell, anchored at both ends, because this is the least distinctive
|
||||
* shape here: unanchored it would find a date inside a version string or an
|
||||
* article slug. Blue Archive's wiki gives each boundary its own column and
|
||||
* writes it as a bare ISO date, so unlike every range above there is nothing to
|
||||
* split and no field order to infer.
|
||||
*
|
||||
* Rejects an impossible calendar date (`2026-02-30`) through `iso`, and states
|
||||
* `day` rather than `exact` because the source publishes no time of day.
|
||||
*/
|
||||
export function parseIsoDay(input: string): ParsedInstant | null {
|
||||
const m = /^\s*(\d{4})-(\d{1,2})-(\d{1,2})\s*$/.exec(input);
|
||||
if (!m) return null;
|
||||
const value = iso(Number(m[1]), Number(m[2]), Number(m[3]));
|
||||
return value === null ? null : { iso: value, precision: "day" };
|
||||
}
|
||||
|
||||
/**
|
||||
* "August 12 - September 21, 2026" → both instants, year taken from the end.
|
||||
* A range whose end carries no year is unresolvable and returns null.
|
||||
|
||||
Reference in New Issue
Block a user