Skip to content

Latest commit

 

History

History
21 lines (16 loc) · 1.19 KB

File metadata and controls

21 lines (16 loc) · 1.19 KB

Display formatting lives in @/lib/format/* (mtp-web)

All currency/number/date display formatting in mtp-web has ONE home: apps/web/src/lib/format/money.ts and .../date.ts.

  • money.ts: money (₹+2dp) · money0 (₹ whole) · amount (2dp no symbol) · number (whole no symbol) · compact (₹1.2L/₹3k) · rate (toFixed) · percent.
  • date.ts: today · isoDate(d) · dateLabel/monthLabel · dateTimeStamp · dateTimeLabel · addDays.

Never inline Intl.NumberFormat, toLocaleString("en-IN"), new Date().toISOString().slice(...), or per-file fmt/inr/formatInr helpers. Change app-wide presentation in one file. Consolidated 2026-05-29 (was duplicated across ~45 sites; formatInr/inr defined 3×; a latent toLocaleString() no-locale grouping bug fixed).

Retained codemod for future sweeps: mtp-web/scripts/codemod-format-dates.mjs (do not delete — user directive). Rule + DoD: mtp-web/docs/conventions/04-wiring-compliance-contract.md.

Related open anti-pattern: inline style={{…}} with literal values (~150 sites) bypasses the stylelint token guard — should move to Component.module.css + tokens. See [[feedback_reuse_first_extract_gate]].