14 lines
329 B
TypeScript
14 lines
329 B
TypeScript
|
|
export function formatCurrency(value: number) {
|
||
|
|
return new Intl.NumberFormat("en-US", {
|
||
|
|
style: "currency",
|
||
|
|
currency: "USD"
|
||
|
|
}).format(value ?? 0);
|
||
|
|
}
|
||
|
|
|
||
|
|
export function formatDate(value: string) {
|
||
|
|
return new Intl.DateTimeFormat("en-US", {
|
||
|
|
dateStyle: "medium",
|
||
|
|
timeStyle: "short"
|
||
|
|
}).format(new Date(value));
|
||
|
|
}
|