Files
advx/src/utils/format.ts
2025-04-10 23:07:21 -03:00

13 lines
388 B
TypeScript

export const formatCurrency = (value: number | null | undefined): string => {
if (value == null) return "R$ 0,00";
return new Intl.NumberFormat("pt-BR", {
style: "currency",
currency: "BRL",
}).format(value);
};
export const formatDate = (date: Date | string | null | undefined): string => {
if (!date) return "-";
return new Date(date).toLocaleDateString("pt-BR");
};