DAY precision routed through formatDate() which hard-coded de-DE, so an
en/es reader saw the German month name ("24. Dezember 1943"). Route DAY
through Intl.DateTimeFormat(locale, …) like the other branches, keeping
the T12:00:00 UTC-safety convention. Add en/es DAY+MONTH parity cases to
docs/date-label-fixtures.json (TS-only; the Java title formatter stays
German by design) and assert them in the spec.
Refs #666
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
141 lines
5.1 KiB
JSON
141 lines
5.1 KiB
JSON
{
|
||
"_comment": "Single source of truth for the honest date-label rule set shared by the TS formatDocumentDate (frontend/src/lib/shared/utils/documentDate.ts) and the Java formatTitleDate (backend importing/DocumentTitleFormatter.java). The 'cases' array holds the GERMAN (de) canonical form and is asserted by BOTH suites — that is the Java<->TS drift guard (en-dash vs hyphen, 'ca.' vs 'circa', season words, range collapse). The Java title formatter intentionally renders German server-side (import titles are always German); only the TS UI formatter is locale-aware, so 'localeCases' (en/es month-name output) is asserted by the TS spec ONLY and must NOT be fed to the Java test. Do not edit one side's expectation without editing this file and the relevant test(s). Season->month mapping note: the Python import normalizer (tools/import-normalizer) is the UPSTREAM authority for which representative month a season maps to (4/7/10/1); both formatters mirror it but it sits OUTSIDE this Java<->TS guard, so a normalizer change is not caught here. See issue #666 and the Markus/Sara drift-guard decision.",
|
||
"cases": [
|
||
{
|
||
"name": "DAY renders a full long date",
|
||
"precision": "DAY",
|
||
"anchor": "1943-12-24",
|
||
"end": null,
|
||
"raw": null,
|
||
"expected": "24. Dezember 1943"
|
||
},
|
||
{
|
||
"name": "MONTH renders month and year only — never a fabricated day",
|
||
"precision": "MONTH",
|
||
"anchor": "1916-06-01",
|
||
"end": null,
|
||
"raw": "Juni 1916",
|
||
"expected": "Juni 1916"
|
||
},
|
||
{
|
||
"name": "SEASON renders the season word from raw",
|
||
"precision": "SEASON",
|
||
"anchor": "1916-06-01",
|
||
"end": null,
|
||
"raw": "Sommer 1916",
|
||
"expected": "Sommer 1916"
|
||
},
|
||
{
|
||
"name": "SEASON with null raw derives the season from the anchor month",
|
||
"precision": "SEASON",
|
||
"anchor": "1916-04-01",
|
||
"end": null,
|
||
"raw": null,
|
||
"expected": "Frühling 1916"
|
||
},
|
||
{
|
||
"name": "YEAR renders the year only — suppresses month and day",
|
||
"precision": "YEAR",
|
||
"anchor": "1916-06-15",
|
||
"end": null,
|
||
"raw": null,
|
||
"expected": "1916"
|
||
},
|
||
{
|
||
"name": "APPROX renders a ca. prefix before the year",
|
||
"precision": "APPROX",
|
||
"anchor": "1920-01-01",
|
||
"end": null,
|
||
"raw": null,
|
||
"expected": "ca. 1920"
|
||
},
|
||
{
|
||
"name": "RANGE in the same month collapses the shared month and year",
|
||
"precision": "RANGE",
|
||
"anchor": "1917-01-10",
|
||
"end": "1917-01-11",
|
||
"raw": null,
|
||
"expected": "10.–11. Jan. 1917"
|
||
},
|
||
{
|
||
"name": "RANGE across months expands both months, sharing the year",
|
||
"precision": "RANGE",
|
||
"anchor": "1917-01-30",
|
||
"end": "1917-02-02",
|
||
"raw": null,
|
||
"expected": "30. Jan. – 2. Feb. 1917"
|
||
},
|
||
{
|
||
"name": "RANGE across a year boundary expands both full dates",
|
||
"precision": "RANGE",
|
||
"anchor": "1916-12-30",
|
||
"end": "1917-01-02",
|
||
"raw": null,
|
||
"expected": "30. Dez. 1916 – 2. Jan. 1917"
|
||
},
|
||
{
|
||
"name": "RANGE where end equals start collapses to a single day",
|
||
"precision": "RANGE",
|
||
"anchor": "1917-01-10",
|
||
"end": "1917-01-10",
|
||
"raw": null,
|
||
"expected": "10. Jan. 1917"
|
||
},
|
||
{
|
||
"name": "RANGE with a null end renders an open-range indicator, never a fabricated end",
|
||
"precision": "RANGE",
|
||
"anchor": "1917-01-10",
|
||
"end": null,
|
||
"raw": null,
|
||
"expected": "ab 10. Jan. 1917"
|
||
},
|
||
{
|
||
"name": "UNKNOWN renders the unknown label regardless of anchor",
|
||
"precision": "UNKNOWN",
|
||
"anchor": null,
|
||
"end": null,
|
||
"raw": "?",
|
||
"expected": "Datum unbekannt"
|
||
}
|
||
],
|
||
"localeComment": "TS-only locale parity for the read path (the younger phone audience may use en/es). Asserted ONLY by documentDate.spec.ts — the Java title formatter is German-only by design, so these MUST NOT be fed to DocumentTitleFormatterTest. Each case pins the localized month-name output for DAY and MONTH so a locale regression (e.g. a future de-DE hard-coding) is caught by the drift table, not just by ad-hoc tests.",
|
||
"localeCases": [
|
||
{
|
||
"name": "DAY in English renders the English month name",
|
||
"precision": "DAY",
|
||
"anchor": "1943-12-24",
|
||
"end": null,
|
||
"raw": null,
|
||
"locale": "en",
|
||
"expected": "December 24, 1943"
|
||
},
|
||
{
|
||
"name": "DAY in Spanish renders the Spanish month name",
|
||
"precision": "DAY",
|
||
"anchor": "1943-12-24",
|
||
"end": null,
|
||
"raw": null,
|
||
"locale": "es",
|
||
"expected": "24 de diciembre de 1943"
|
||
},
|
||
{
|
||
"name": "MONTH in English renders the English month name, never a day",
|
||
"precision": "MONTH",
|
||
"anchor": "1916-06-01",
|
||
"end": null,
|
||
"raw": "Juni 1916",
|
||
"locale": "en",
|
||
"expected": "June 1916"
|
||
},
|
||
{
|
||
"name": "MONTH in Spanish renders the Spanish month name, never a day",
|
||
"precision": "MONTH",
|
||
"anchor": "1916-06-01",
|
||
"end": null,
|
||
"raw": "Juni 1916",
|
||
"locale": "es",
|
||
"expected": "junio de 1916"
|
||
}
|
||
]
|
||
}
|