API reference: @salmonui/core/format
Formatterinterface
import type { Formatter } from '@salmonui/core/format';interface Formatter {
readonly locale: string;
readonly currency: string;
readonly timeZone: string | undefined;
format(value: unknown, format?: string | FormatOptions, type?: ColumnType): string;
number(value: unknown, format?: string | FormatOptions): string;
date(value: unknown, format?: string | FormatOptions): string;
dateTime(value: unknown, format?: string | FormatOptions): string;
money(value: unknown, fractionDigits?: number, currency?: string): string;
percent(value: unknown, fractionDigits?: number): string;
}
| Name | Signature | Description |
|---|---|---|
locale | readonly locale: string; | |
currency | readonly currency: string; | |
timeZone | readonly timeZone: string | undefined; | |
format | format(value: unknown, format?: string | FormatOptions, type?: ColumnType): string; | Formats like a column |
number | number(value: unknown, format?: string | FormatOptions): string; | |
date | date(value: unknown, format?: string | FormatOptions): string; | |
dateTime | dateTime(value: unknown, format?: string | FormatOptions): string; | |
money | money(value: unknown, fractionDigits?: number, currency?: string): string; | |
percent | percent(value: unknown, fractionDigits?: number): string; |