feat: add repayment discounts and interactive net worth trends
Support positive repayment discounts and negative surcharges with exact decimal conversion. Add independent trend toggles, pointer and keyboard date inspection, tests and Chinese documentation.
This commit is contained in:
1 parent
096f1577c2
commit
b2c22ca050
16 files changed
+505
-84
No files matched your search
@@ -0,0 +1,7 @@
|
||||
// UI: positive discount, negative surcharge. API stores the opposite fee sign.
|
||||
// Flip the decimal string directly to preserve all eight fractional digits.
|
||||
export function repaymentFee(discount: string) {
|
||||
if (!/^-?(0|[1-9]\d{0,15})(\.\d{1,8})?$/.test(discount)) throw new Error('还款优惠格式无效');
|
||||
if (/^-?0(?:\.0+)?$/.test(discount)) return '0';
|
||||
return discount.startsWith('-') ? discount.slice(1) : '-' + discount;
|
||||
}
|
||||
Reference in new issue
Block a user