Files
bible/rules/patterns/web-visual-baseline/formatting/contract.md
T

1.8 KiB

Contract: Display Formatting

Part of web-visual-baseline.

Data Formatting

  • Money: no minor units (no cents/kopecks) — round to whole currency units for display. Group thousands with a non-breaking space ( ), not a comma or dot — e.g. $13 320, not $13,320.00. The ru-RU locale's own toLocaleString() grouping character is already a non-breaking space, so Math.round(value).toLocaleString('ru-RU') satisfies this directly without hand-rolled grouping logic.
  • Dates that only need day-level (not time-of-day) precision — a delivery ETA, a planning/reorder date — are shown as an ISO week number: W32. When a table row aggregates several dates that disagree (e.g. several purchase lots under one order with different ETAs), show the week range instead: W32-34. Audit-trail timestamps (created/updated-at) are exempt — show those as ordinary dates, since collapsing them to a week would hide the information they exist to convey.
  • Week formatting is a display convention, not a storage format: preserve the exact date in form values and API payloads. Date inputs may display 2026 · W40 while submitting 2026-10-01. Exact-date filters may retain a normal date input.
  • Include the ISO week-year when a range crosses years or the year would be ambiguous. Do not compute a cross-year range from the minimum/maximum week numbers alone.
  • Compact amounts (for example $1,2 млн) are allowed in summary metrics. Keep full rounded amounts in tables so values remain comparable. Distinguish a known zero from a missing value.
  • Align numeric columns right and use tabular numerals. Keep short identifiers on one line; truncate long descriptions only when the complete value is available on inspection.

Examples