Presentation of data.
WHAT TO FORMAT CONSISTENTLY
Money Dates and times Numbers Quantities and units
WHERE TO DEFINE THE FORMATTING
In one place, reused.
WHY
Otherwise the same value appears differently on different pages.
WHAT TO USE FOR MONEY
A consistent format including the currency, with fixed decimal places.
WHAT TO BE CAREFUL WITH
Storing money as decimals and formatting at display, rather than rounding as you go.
WHAT TO USE FOR DATES
A format your users read naturally, stated unambiguously.
WHY THAT MATTERS
Numeric dates are ambiguous between regions.
Including the month name removes the ambiguity.
WHAT TO SHOW FOR RECENT TIMES
Relative descriptions, where helpful, with the exact value available.
WHAT TO AVOID
Relative times for anything requiring precision Different formats in different parts of the application
WHAT TO CENTRALISE
Formatting helpers or accessors on models.
WHAT TO TEST
Very large values, zero, and negative values.