feat: migrate app routes and business modules
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
export const parseMoneyToCents = (amount) => {
|
||||
const amountParts = String(amount || "").match(/^(\d+)(?:\.(\d{1,2}))?$/);
|
||||
if (!amountParts) return null;
|
||||
return (
|
||||
BigInt(amountParts[1]) * 100n +
|
||||
BigInt((amountParts[2] || "").padEnd(2, "0"))
|
||||
);
|
||||
};
|
||||
|
||||
export const formatSignedMoney = (amount) => {
|
||||
const normalizedAmount = String(amount);
|
||||
const sign = normalizedAmount.startsWith("-") ? "-" : "+";
|
||||
return `${sign}¥${normalizedAmount.replace(/^-/, "")}`;
|
||||
};
|
||||
Reference in New Issue
Block a user