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

34 lines
1.8 KiB
Markdown
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Contract: Display Formatting
Part of [web-visual-baseline](../contract.md).
## 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
- [Money](money.md)
- [Week dates](weeks.md)