2024-08-28 18:38:20 +00:00
|
|
|
export const adjustPrecision = ({ amount, scale }: { amount: number; scale: number }) => {
|
|
|
|
|
const factor = 10 ** scale;
|
|
|
|
|
return Number(amount) / factor;
|
|
|
|
|
};
|
2024-10-03 14:23:46 +00:00
|
|
|
|
|
|
|
|
export const formatDateToYYYYMMDD = (date: Date): string => {
|
|
|
|
|
const year = date.getFullYear();
|
|
|
|
|
const month = String(date.getMonth() + 1).padStart(2, "0"); // Los meses van de 0 a 11, por lo que sumamos 1
|
|
|
|
|
const day = String(date.getDate()).padStart(2, "0");
|
|
|
|
|
|
|
|
|
|
return `${year}-${month}-${day}`;
|
|
|
|
|
};
|