tap.format helpers, which format in tap.locale and tap.timezone so a
number or a date reads the way the rest of the host reads.
Remarks
The host takes both from the browser. The testing mock does not: it formats inen-US and UTC so an expected string does not move with the machine running the
test, and its date and relative answer differently from the host’s — date
ignores style and returns YYYY-MM-DD, and relative returns a whole ISO
timestamp rather than a phrase. Assert on your own formatting, not on either of
those two strings.
Methods
currency()
code is an ISO currency code, such as USD.
Parameters
value
number
code
string
Returns
string
date()
long is the only
style that changes anything: every other value renders the medium form.
Parameters
value
string | Date
style?
"short" | "long"
Returns
string
number()
Parameters
value
number
options?
NumberFormatOptions
Returns
string
relative()
3 days ago.
Parameters
value
string | Date
Returns
string