fix: 金额计算展示保留原始数据精度,去除 toFixed(1) 进位截断并升级至 v1.0.3
This commit is contained in:
@@ -1,5 +1,14 @@
|
|||||||
## 七、 版本发布历史 (Changelog)
|
## 七、 版本发布历史 (Changelog)
|
||||||
|
|
||||||
|
### v1.0.3 (2026-09-16)
|
||||||
|
- **修复 (金额精度保留与无损展示)**:
|
||||||
|
- 去除金额展示层原有的 `toFixed(1)` 进位截断,彻底解决如 `103.5h × ¥19.5/h = ¥2018.25` 在看板与汇总中被四舍五入进位显示为 `¥2018.3` 的问题。
|
||||||
|
- 金额计算与格式化逻辑(`money`、`signed`、`moneyParts`)调整为保留原始数据有效位数,同时消除 JS 浮点二进制精度抖动。
|
||||||
|
- 看板大字整数与小数拆分逻辑自适应原始小数位,保证整数部千分位与小数分位严密吻合。
|
||||||
|
- **Android 原生资产与版本**:
|
||||||
|
- 同步静态资产至 `android/app/src/main/assets/www/`。
|
||||||
|
- 版本号升级:`versionCode 4`,`versionName "1.0.3"`。
|
||||||
|
|
||||||
### v1.0.2 (2026-09-15)
|
### v1.0.2 (2026-09-15)
|
||||||
- **修复 (MCP 状态联动与生命周期)**:
|
- **修复 (MCP 状态联动与生命周期)**:
|
||||||
- 修复退出登录后前端 `mcp` 响应式对象残留已开启状态、点击关闭弹出「未登录」错误的问题。
|
- 修复退出登录后前端 `mcp` 响应式对象残留已开启状态、点击关闭弹出「未登录」错误的问题。
|
||||||
|
|||||||
@@ -207,6 +207,15 @@ curl -s http://127.0.0.1:9522/api/health
|
|||||||
|
|
||||||
## 七、 版本发布历史 (Changelog)
|
## 七、 版本发布历史 (Changelog)
|
||||||
|
|
||||||
|
### v1.0.3 (2026-09-16)
|
||||||
|
- **修复 (金额精度保留与无损展示)**:
|
||||||
|
- 去除金额展示层原有的 `toFixed(1)` 进位截断,彻底解决如 `103.5h × ¥19.5/h = ¥2018.25` 在看板与汇总中被四舍五入进位显示为 `¥2018.3` 的问题。
|
||||||
|
- 金额计算与格式化逻辑(`money`、`signed`、`moneyParts`)调整为保留原始数据有效位数,同时消除 JS 浮点二进制精度抖动。
|
||||||
|
- 看板大字整数与小数拆分逻辑自适应原始小数位,保证整数部千分位与小数分位严密吻合。
|
||||||
|
- **Android 原生资产与版本**:
|
||||||
|
- 同步静态资产至 `android/app/src/main/assets/www/`。
|
||||||
|
- 版本号升级:`versionCode 4`,`versionName "1.0.3"`。
|
||||||
|
|
||||||
### v1.0.2 (2026-09-15)
|
### v1.0.2 (2026-09-15)
|
||||||
- **修复 (MCP 状态联动与生命周期)**:
|
- **修复 (MCP 状态联动与生命周期)**:
|
||||||
- 修复退出登录后前端 `mcp` 响应式对象残留已开启状态、点击关闭弹出「未登录」错误的问题。
|
- 修复退出登录后前端 `mcp` 响应式对象残留已开启状态、点击关闭弹出「未登录」错误的问题。
|
||||||
|
|||||||
@@ -10,8 +10,8 @@ android {
|
|||||||
applicationId "top.ouaone.workhours"
|
applicationId "top.ouaone.workhours"
|
||||||
minSdk 23
|
minSdk 23
|
||||||
targetSdk 34
|
targetSdk 34
|
||||||
versionCode 3
|
versionCode 4
|
||||||
versionName "1.0.2"
|
versionName "1.0.3"
|
||||||
}
|
}
|
||||||
|
|
||||||
signingConfigs {
|
signingConfigs {
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "work-hours-tracker",
|
"name": "work-hours-tracker",
|
||||||
"version": "1.0.2",
|
"version": "1.0.3",
|
||||||
"private": true,
|
"private": true,
|
||||||
"description": "工时记账:单文件前端 + 薪酬纯模块(shared/payroll.js)+ 平台无关服务端(server/)",
|
"description": "工时记账:单文件前端 + 薪酬纯模块(shared/payroll.js)+ 平台无关服务端(server/)",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|||||||
+16
-10
@@ -287,26 +287,32 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
// ===== 格式化 =====
|
// ===== 格式化 =====
|
||||||
function fmt(n) { return (Number(n) || 0).toFixed(1); }
|
// 消除浮点二进制抖动,同时保留原始数据(不进行有损进位截断)
|
||||||
function money(n) { return '¥' + (Number(n) || 0).toFixed(1); }
|
function rawAmount(n) {
|
||||||
function signed(n) {
|
|
||||||
var v = Number(n) || 0;
|
var v = Number(n) || 0;
|
||||||
return (v >= 0 ? '+¥' : '-¥') + Math.abs(v).toFixed(1);
|
return Math.round((v + Number.EPSILON) * 100) / 100;
|
||||||
|
}
|
||||||
|
function fmt(n) { return (Number(n) || 0).toFixed(1); }
|
||||||
|
function money(n) { return '¥' + rawAmount(n); }
|
||||||
|
function signed(n) {
|
||||||
|
var v = rawAmount(n);
|
||||||
|
return (v >= 0 ? '+¥' : '-¥') + Math.abs(v);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 金额拆成 符号/整数部/小数部,供看板主数字分层渲染(大字只放整数部)。
|
* 金额拆成 符号/整数部/小数部,供看板主数字分层渲染(大字只放整数部)。
|
||||||
* 必须从 toFixed(1) 的结果上切,不能用 Math.floor 另算,
|
* 保留原始数据的小数部分,不进行有损四舍五入。
|
||||||
* 否则 99.96 会被 money() 进为 100.0、而拆分出 99.0,两处数字对不上。
|
|
||||||
*/
|
*/
|
||||||
function moneyParts(n) {
|
function moneyParts(n) {
|
||||||
var v = Number(n) || 0;
|
var v = rawAmount(n);
|
||||||
var s = Math.abs(v).toFixed(1);
|
var s = String(Math.abs(v));
|
||||||
var dot = s.indexOf('.');
|
var dot = s.indexOf('.');
|
||||||
|
var intPart = dot !== -1 ? s.slice(0, dot) : s;
|
||||||
|
var fracPart = dot !== -1 ? s.slice(dot) : '';
|
||||||
return {
|
return {
|
||||||
sign: v < 0 ? '-' : '',
|
sign: v < 0 ? '-' : '',
|
||||||
int: s.slice(0, dot).replace(/\B(?=(\d{3})+(?!\d))/g, ','), // 千分位
|
int: intPart.replace(/\B(?=(\d{3})+(?!\d))/g, ','), // 千分位
|
||||||
frac: s.slice(dot)
|
frac: fracPart
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -110,7 +110,7 @@
|
|||||||
"isCurrentMonth": true,
|
"isCurrentMonth": true,
|
||||||
"recordCount": 4,
|
"recordCount": 4,
|
||||||
"boardInt": "702",
|
"boardInt": "702",
|
||||||
"boardFrac": ".0",
|
"boardFrac": "",
|
||||||
"boardSign": "",
|
"boardSign": "",
|
||||||
"hourOptions": "6,6.5,7,7.5,8,8.5,9,9.5,10,10.5,11,11.5,12",
|
"hourOptions": "6,6.5,7,7.5,8,8.5,9,9.5,10,10.5,11,11.5,12",
|
||||||
"daysInMonth": 30,
|
"daysInMonth": 30,
|
||||||
@@ -226,7 +226,7 @@
|
|||||||
"isCurrentMonth": true,
|
"isCurrentMonth": true,
|
||||||
"recordCount": 2,
|
"recordCount": 2,
|
||||||
"boardInt": "468",
|
"boardInt": "468",
|
||||||
"boardFrac": ".0",
|
"boardFrac": "",
|
||||||
"boardSign": "",
|
"boardSign": "",
|
||||||
"hourOptions": "6,6.5,7,7.5,8,8.5,9,9.5,10,10.5,11,11.5,12",
|
"hourOptions": "6,6.5,7,7.5,8,8.5,9,9.5,10,10.5,11,11.5,12",
|
||||||
"daysInMonth": 30,
|
"daysInMonth": 30,
|
||||||
@@ -342,7 +342,7 @@
|
|||||||
"isCurrentMonth": true,
|
"isCurrentMonth": true,
|
||||||
"recordCount": 1,
|
"recordCount": 1,
|
||||||
"boardInt": "195",
|
"boardInt": "195",
|
||||||
"boardFrac": ".0",
|
"boardFrac": "",
|
||||||
"boardSign": "",
|
"boardSign": "",
|
||||||
"hourOptions": "6,6.5,7,7.5,8,8.5,9,9.5,10,10.5,11,11.5,12",
|
"hourOptions": "6,6.5,7,7.5,8,8.5,9,9.5,10,10.5,11,11.5,12",
|
||||||
"daysInMonth": 30,
|
"daysInMonth": 30,
|
||||||
@@ -458,7 +458,7 @@
|
|||||||
"isCurrentMonth": true,
|
"isCurrentMonth": true,
|
||||||
"recordCount": 27,
|
"recordCount": 27,
|
||||||
"boardInt": "4,428",
|
"boardInt": "4,428",
|
||||||
"boardFrac": ".0",
|
"boardFrac": "",
|
||||||
"boardSign": "",
|
"boardSign": "",
|
||||||
"hourOptions": "6,6.5,7,7.5,8,8.5,9,9.5,10,10.5,11,11.5,12",
|
"hourOptions": "6,6.5,7,7.5,8,8.5,9,9.5,10,10.5,11,11.5,12",
|
||||||
"daysInMonth": 30,
|
"daysInMonth": 30,
|
||||||
@@ -574,7 +574,7 @@
|
|||||||
"isCurrentMonth": true,
|
"isCurrentMonth": true,
|
||||||
"recordCount": 26,
|
"recordCount": 26,
|
||||||
"boardInt": "4,056",
|
"boardInt": "4,056",
|
||||||
"boardFrac": ".0",
|
"boardFrac": "",
|
||||||
"boardSign": "",
|
"boardSign": "",
|
||||||
"hourOptions": "6,6.5,7,7.5,8,8.5,9,9.5,10,10.5,11,11.5,12",
|
"hourOptions": "6,6.5,7,7.5,8,8.5,9,9.5,10,10.5,11,11.5,12",
|
||||||
"daysInMonth": 30,
|
"daysInMonth": 30,
|
||||||
@@ -704,7 +704,7 @@
|
|||||||
"isCurrentMonth": true,
|
"isCurrentMonth": true,
|
||||||
"recordCount": 3,
|
"recordCount": 3,
|
||||||
"boardInt": "468",
|
"boardInt": "468",
|
||||||
"boardFrac": ".0",
|
"boardFrac": "",
|
||||||
"boardSign": "",
|
"boardSign": "",
|
||||||
"hourOptions": "6,6.5,7,7.5,8,8.5,9,9.5,10,10.5,11,11.5,12",
|
"hourOptions": "6,6.5,7,7.5,8,8.5,9,9.5,10,10.5,11,11.5,12",
|
||||||
"daysInMonth": 30,
|
"daysInMonth": 30,
|
||||||
@@ -834,7 +834,7 @@
|
|||||||
"isCurrentMonth": true,
|
"isCurrentMonth": true,
|
||||||
"recordCount": 3,
|
"recordCount": 3,
|
||||||
"boardInt": "408",
|
"boardInt": "408",
|
||||||
"boardFrac": ".0",
|
"boardFrac": "",
|
||||||
"boardSign": "",
|
"boardSign": "",
|
||||||
"hourOptions": "6,6.5,7,7.5,8,8.5,9,9.5,10,10.5,11,11.5,12",
|
"hourOptions": "6,6.5,7,7.5,8,8.5,9,9.5,10,10.5,11,11.5,12",
|
||||||
"daysInMonth": 30,
|
"daysInMonth": 30,
|
||||||
@@ -950,7 +950,7 @@
|
|||||||
"isCurrentMonth": true,
|
"isCurrentMonth": true,
|
||||||
"recordCount": 1,
|
"recordCount": 1,
|
||||||
"boardInt": "156",
|
"boardInt": "156",
|
||||||
"boardFrac": ".0",
|
"boardFrac": "",
|
||||||
"boardSign": "",
|
"boardSign": "",
|
||||||
"hourOptions": "6,6.5,7,7.5,8,8.5,9,9.5,10,10.5,11,11.5,12",
|
"hourOptions": "6,6.5,7,7.5,8,8.5,9,9.5,10,10.5,11,11.5,12",
|
||||||
"daysInMonth": 30,
|
"daysInMonth": 30,
|
||||||
@@ -1066,7 +1066,7 @@
|
|||||||
"isCurrentMonth": true,
|
"isCurrentMonth": true,
|
||||||
"recordCount": 1,
|
"recordCount": 1,
|
||||||
"boardInt": "176",
|
"boardInt": "176",
|
||||||
"boardFrac": ".0",
|
"boardFrac": "",
|
||||||
"boardSign": "",
|
"boardSign": "",
|
||||||
"hourOptions": "6,6.5,7,7.5,8,8.5,9,9.5,10,10.5,11,11.5,12",
|
"hourOptions": "6,6.5,7,7.5,8,8.5,9,9.5,10,10.5,11,11.5,12",
|
||||||
"daysInMonth": 30,
|
"daysInMonth": 30,
|
||||||
@@ -1182,7 +1182,7 @@
|
|||||||
"isCurrentMonth": true,
|
"isCurrentMonth": true,
|
||||||
"recordCount": 6,
|
"recordCount": 6,
|
||||||
"boardInt": "312",
|
"boardInt": "312",
|
||||||
"boardFrac": ".0",
|
"boardFrac": "",
|
||||||
"boardSign": "",
|
"boardSign": "",
|
||||||
"hourOptions": "6,6.5,7,7.5,8,8.5,9,9.5,10,10.5,11,11.5,12",
|
"hourOptions": "6,6.5,7,7.5,8,8.5,9,9.5,10,10.5,11,11.5,12",
|
||||||
"daysInMonth": 30,
|
"daysInMonth": 30,
|
||||||
@@ -1298,7 +1298,7 @@
|
|||||||
"isCurrentMonth": true,
|
"isCurrentMonth": true,
|
||||||
"recordCount": 6,
|
"recordCount": 6,
|
||||||
"boardInt": "312",
|
"boardInt": "312",
|
||||||
"boardFrac": ".0",
|
"boardFrac": "",
|
||||||
"boardSign": "",
|
"boardSign": "",
|
||||||
"hourOptions": "6,6.5,7,7.5,8,8.5,9,9.5,10,10.5,11,11.5,12",
|
"hourOptions": "6,6.5,7,7.5,8,8.5,9,9.5,10,10.5,11,11.5,12",
|
||||||
"daysInMonth": 30,
|
"daysInMonth": 30,
|
||||||
@@ -1414,7 +1414,7 @@
|
|||||||
"isCurrentMonth": false,
|
"isCurrentMonth": false,
|
||||||
"recordCount": 3,
|
"recordCount": 3,
|
||||||
"boardInt": "156",
|
"boardInt": "156",
|
||||||
"boardFrac": ".0",
|
"boardFrac": "",
|
||||||
"boardSign": "",
|
"boardSign": "",
|
||||||
"hourOptions": "6,6.5,7,7.5,8,8.5,9,9.5,10,10.5,11,11.5,12",
|
"hourOptions": "6,6.5,7,7.5,8,8.5,9,9.5,10,10.5,11,11.5,12",
|
||||||
"daysInMonth": 31,
|
"daysInMonth": 31,
|
||||||
@@ -1530,7 +1530,7 @@
|
|||||||
"isCurrentMonth": false,
|
"isCurrentMonth": false,
|
||||||
"recordCount": 3,
|
"recordCount": 3,
|
||||||
"boardInt": "156",
|
"boardInt": "156",
|
||||||
"boardFrac": ".0",
|
"boardFrac": "",
|
||||||
"boardSign": "",
|
"boardSign": "",
|
||||||
"hourOptions": "6,6.5,7,7.5,8,8.5,9,9.5,10,10.5,11,11.5,12",
|
"hourOptions": "6,6.5,7,7.5,8,8.5,9,9.5,10,10.5,11,11.5,12",
|
||||||
"daysInMonth": 31,
|
"daysInMonth": 31,
|
||||||
@@ -1654,7 +1654,7 @@
|
|||||||
"isCurrentMonth": true,
|
"isCurrentMonth": true,
|
||||||
"recordCount": 1,
|
"recordCount": 1,
|
||||||
"boardInt": "117",
|
"boardInt": "117",
|
||||||
"boardFrac": ".0",
|
"boardFrac": "",
|
||||||
"boardSign": "",
|
"boardSign": "",
|
||||||
"hourOptions": "6,6.5,7,7.5,8,8.5,9,9.5,10,10.5,11,11.5,12",
|
"hourOptions": "6,6.5,7,7.5,8,8.5,9,9.5,10,10.5,11,11.5,12",
|
||||||
"daysInMonth": 30,
|
"daysInMonth": 30,
|
||||||
@@ -1778,7 +1778,7 @@
|
|||||||
"isCurrentMonth": true,
|
"isCurrentMonth": true,
|
||||||
"recordCount": 1,
|
"recordCount": 1,
|
||||||
"boardInt": "283",
|
"boardInt": "283",
|
||||||
"boardFrac": ".0",
|
"boardFrac": "",
|
||||||
"boardSign": "-",
|
"boardSign": "-",
|
||||||
"hourOptions": "6,6.5,7,7.5,8,8.5,9,9.5,10,10.5,11,11.5,12",
|
"hourOptions": "6,6.5,7,7.5,8,8.5,9,9.5,10,10.5,11,11.5,12",
|
||||||
"daysInMonth": 30,
|
"daysInMonth": 30,
|
||||||
@@ -1894,7 +1894,7 @@
|
|||||||
"isCurrentMonth": true,
|
"isCurrentMonth": true,
|
||||||
"recordCount": 4,
|
"recordCount": 4,
|
||||||
"boardInt": "156",
|
"boardInt": "156",
|
||||||
"boardFrac": ".0",
|
"boardFrac": "",
|
||||||
"boardSign": "",
|
"boardSign": "",
|
||||||
"hourOptions": "6,6.5,7,7.5,8,8.5,9,9.5,10,10.5,11,11.5,12",
|
"hourOptions": "6,6.5,7,7.5,8,8.5,9,9.5,10,10.5,11,11.5,12",
|
||||||
"daysInMonth": 30,
|
"daysInMonth": 30,
|
||||||
@@ -2010,7 +2010,7 @@
|
|||||||
"isCurrentMonth": true,
|
"isCurrentMonth": true,
|
||||||
"recordCount": 1,
|
"recordCount": 1,
|
||||||
"boardInt": "156",
|
"boardInt": "156",
|
||||||
"boardFrac": ".0",
|
"boardFrac": "",
|
||||||
"boardSign": "",
|
"boardSign": "",
|
||||||
"hourOptions": "6,6.5,7,7.5,8,8.5,9,9.5,10,10.5,11,11.5,12",
|
"hourOptions": "6,6.5,7,7.5,8,8.5,9,9.5,10,10.5,11,11.5,12",
|
||||||
"daysInMonth": 30,
|
"daysInMonth": 30,
|
||||||
@@ -2126,7 +2126,7 @@
|
|||||||
"isCurrentMonth": true,
|
"isCurrentMonth": true,
|
||||||
"recordCount": 3,
|
"recordCount": 3,
|
||||||
"boardInt": "156",
|
"boardInt": "156",
|
||||||
"boardFrac": ".0",
|
"boardFrac": "",
|
||||||
"boardSign": "",
|
"boardSign": "",
|
||||||
"hourOptions": "6,6.5,7,7.5,8,8.5,9,9.5,10,10.5,11,11.5,12",
|
"hourOptions": "6,6.5,7,7.5,8,8.5,9,9.5,10,10.5,11,11.5,12",
|
||||||
"daysInMonth": 30,
|
"daysInMonth": 30,
|
||||||
@@ -2242,7 +2242,7 @@
|
|||||||
"isCurrentMonth": true,
|
"isCurrentMonth": true,
|
||||||
"recordCount": 20,
|
"recordCount": 20,
|
||||||
"boardInt": "6,400",
|
"boardInt": "6,400",
|
||||||
"boardFrac": ".0",
|
"boardFrac": "",
|
||||||
"boardSign": "",
|
"boardSign": "",
|
||||||
"hourOptions": "6,6.5,7,7.5,8,8.5,9,9.5,10,10.5,11,11.5,12",
|
"hourOptions": "6,6.5,7,7.5,8,8.5,9,9.5,10,10.5,11,11.5,12",
|
||||||
"daysInMonth": 30,
|
"daysInMonth": 30,
|
||||||
@@ -2358,7 +2358,7 @@
|
|||||||
"isCurrentMonth": true,
|
"isCurrentMonth": true,
|
||||||
"recordCount": 1,
|
"recordCount": 1,
|
||||||
"boardInt": "156",
|
"boardInt": "156",
|
||||||
"boardFrac": ".0",
|
"boardFrac": "",
|
||||||
"boardSign": "",
|
"boardSign": "",
|
||||||
"hourOptions": "6,6.5,7,7.5,8,8.5,9,9.5,10,10.5,11,11.5,12",
|
"hourOptions": "6,6.5,7,7.5,8,8.5,9,9.5,10,10.5,11,11.5,12",
|
||||||
"daysInMonth": 30,
|
"daysInMonth": 30,
|
||||||
@@ -2494,7 +2494,7 @@
|
|||||||
"isCurrentMonth": true,
|
"isCurrentMonth": true,
|
||||||
"recordCount": 4,
|
"recordCount": 4,
|
||||||
"boardInt": "624",
|
"boardInt": "624",
|
||||||
"boardFrac": ".0",
|
"boardFrac": "",
|
||||||
"boardSign": "",
|
"boardSign": "",
|
||||||
"hourOptions": "6,6.5,7,7.5,8,8.5,9,9.5,10,10.5,11,11.5,12",
|
"hourOptions": "6,6.5,7,7.5,8,8.5,9,9.5,10,10.5,11,11.5,12",
|
||||||
"daysInMonth": 30,
|
"daysInMonth": 30,
|
||||||
@@ -2610,7 +2610,7 @@
|
|||||||
"isCurrentMonth": true,
|
"isCurrentMonth": true,
|
||||||
"recordCount": 0,
|
"recordCount": 0,
|
||||||
"boardInt": "0",
|
"boardInt": "0",
|
||||||
"boardFrac": ".0",
|
"boardFrac": "",
|
||||||
"boardSign": "",
|
"boardSign": "",
|
||||||
"hourOptions": "6,6.5,7,7.5,8,8.5,9,9.5,10,10.5,11,11.5,12",
|
"hourOptions": "6,6.5,7,7.5,8,8.5,9,9.5,10,10.5,11,11.5,12",
|
||||||
"daysInMonth": 30,
|
"daysInMonth": 30,
|
||||||
@@ -2726,7 +2726,7 @@
|
|||||||
"isCurrentMonth": true,
|
"isCurrentMonth": true,
|
||||||
"recordCount": 3,
|
"recordCount": 3,
|
||||||
"boardInt": "516",
|
"boardInt": "516",
|
||||||
"boardFrac": ".8",
|
"boardFrac": ".75",
|
||||||
"boardSign": "",
|
"boardSign": "",
|
||||||
"hourOptions": "6,6.5,7,7.5,8,8.5,9,9.5,10,10.5,11,11.5,12",
|
"hourOptions": "6,6.5,7,7.5,8,8.5,9,9.5,10,10.5,11,11.5,12",
|
||||||
"daysInMonth": 30,
|
"daysInMonth": 30,
|
||||||
@@ -2842,7 +2842,7 @@
|
|||||||
"isCurrentMonth": true,
|
"isCurrentMonth": true,
|
||||||
"recordCount": 3,
|
"recordCount": 3,
|
||||||
"boardInt": "429",
|
"boardInt": "429",
|
||||||
"boardFrac": ".0",
|
"boardFrac": "",
|
||||||
"boardSign": "",
|
"boardSign": "",
|
||||||
"hourOptions": "6,6.5,7,7.5,8,8.5,9,9.5,10,10.5,11,11.5,12",
|
"hourOptions": "6,6.5,7,7.5,8,8.5,9,9.5,10,10.5,11,11.5,12",
|
||||||
"daysInMonth": 30,
|
"daysInMonth": 30,
|
||||||
@@ -2958,7 +2958,7 @@
|
|||||||
"isCurrentMonth": true,
|
"isCurrentMonth": true,
|
||||||
"recordCount": 3,
|
"recordCount": 3,
|
||||||
"boardInt": "439",
|
"boardInt": "439",
|
||||||
"boardFrac": ".0",
|
"boardFrac": "",
|
||||||
"boardSign": "",
|
"boardSign": "",
|
||||||
"hourOptions": "6,6.5,7,7.5,8,8.5,9,9.5,10,10.5,11,11.5,12",
|
"hourOptions": "6,6.5,7,7.5,8,8.5,9,9.5,10,10.5,11,11.5,12",
|
||||||
"daysInMonth": 30,
|
"daysInMonth": 30,
|
||||||
@@ -3074,7 +3074,7 @@
|
|||||||
"isCurrentMonth": true,
|
"isCurrentMonth": true,
|
||||||
"recordCount": 27,
|
"recordCount": 27,
|
||||||
"boardInt": "4,428",
|
"boardInt": "4,428",
|
||||||
"boardFrac": ".0",
|
"boardFrac": "",
|
||||||
"boardSign": "",
|
"boardSign": "",
|
||||||
"hourOptions": "6,6.5,7,7.5,8,8.5,9,9.5,10,10.5,11,11.5,12",
|
"hourOptions": "6,6.5,7,7.5,8,8.5,9,9.5,10,10.5,11,11.5,12",
|
||||||
"daysInMonth": 30,
|
"daysInMonth": 30,
|
||||||
@@ -3190,7 +3190,7 @@
|
|||||||
"isCurrentMonth": true,
|
"isCurrentMonth": true,
|
||||||
"recordCount": 27,
|
"recordCount": 27,
|
||||||
"boardInt": "4,478",
|
"boardInt": "4,478",
|
||||||
"boardFrac": ".0",
|
"boardFrac": "",
|
||||||
"boardSign": "",
|
"boardSign": "",
|
||||||
"hourOptions": "6,6.5,7,7.5,8,8.5,9,9.5,10,10.5,11,11.5,12",
|
"hourOptions": "6,6.5,7,7.5,8,8.5,9,9.5,10,10.5,11,11.5,12",
|
||||||
"daysInMonth": 30,
|
"daysInMonth": 30,
|
||||||
@@ -3306,7 +3306,7 @@
|
|||||||
"isCurrentMonth": false,
|
"isCurrentMonth": false,
|
||||||
"recordCount": 2,
|
"recordCount": 2,
|
||||||
"boardInt": "351",
|
"boardInt": "351",
|
||||||
"boardFrac": ".0",
|
"boardFrac": "",
|
||||||
"boardSign": "",
|
"boardSign": "",
|
||||||
"hourOptions": "6,6.5,7,7.5,8,8.5,9,9.5,10,10.5,11,11.5,12",
|
"hourOptions": "6,6.5,7,7.5,8,8.5,9,9.5,10,10.5,11,11.5,12",
|
||||||
"daysInMonth": 31,
|
"daysInMonth": 31,
|
||||||
@@ -3422,7 +3422,7 @@
|
|||||||
"isCurrentMonth": false,
|
"isCurrentMonth": false,
|
||||||
"recordCount": 2,
|
"recordCount": 2,
|
||||||
"boardInt": "351",
|
"boardInt": "351",
|
||||||
"boardFrac": ".0",
|
"boardFrac": "",
|
||||||
"boardSign": "",
|
"boardSign": "",
|
||||||
"hourOptions": "6,6.5,7,7.5,8,8.5,9,9.5,10,10.5,11,11.5,12",
|
"hourOptions": "6,6.5,7,7.5,8,8.5,9,9.5,10,10.5,11,11.5,12",
|
||||||
"daysInMonth": 31,
|
"daysInMonth": 31,
|
||||||
@@ -3538,7 +3538,7 @@
|
|||||||
"isCurrentMonth": true,
|
"isCurrentMonth": true,
|
||||||
"recordCount": 0,
|
"recordCount": 0,
|
||||||
"boardInt": "0",
|
"boardInt": "0",
|
||||||
"boardFrac": ".0",
|
"boardFrac": "",
|
||||||
"boardSign": "",
|
"boardSign": "",
|
||||||
"hourOptions": "6,6.5,7,7.5,8,8.5,9,9.5,10,10.5,11,11.5,12",
|
"hourOptions": "6,6.5,7,7.5,8,8.5,9,9.5,10,10.5,11,11.5,12",
|
||||||
"daysInMonth": 30,
|
"daysInMonth": 30,
|
||||||
|
|||||||
+13
-11
@@ -425,20 +425,22 @@ test('isCurrentMonth / isSameDay 只认传进来的 now', () => {
|
|||||||
|
|
||||||
// ───────────────────────── 格式化 ─────────────────────────
|
// ───────────────────────── 格式化 ─────────────────────────
|
||||||
|
|
||||||
test('金额格式化保留 1 位,null/undefined 当 0', () => {
|
test('金额格式化保留原始数据(分位不截断,不进位),null/undefined 当 0', () => {
|
||||||
assert.equal(P.fmt(undefined), '0.0');
|
assert.equal(P.fmt(undefined), '0.0');
|
||||||
assert.equal(P.money(null), '¥0.0');
|
assert.equal(P.money(null), '¥0');
|
||||||
assert.equal(P.money(1234.56), '¥1234.6');
|
assert.equal(P.money(1234.56), '¥1234.56');
|
||||||
assert.equal(P.signed(0), '+¥0.0');
|
assert.equal(P.money(2018.25), '¥2018.25');
|
||||||
assert.equal(P.signed(-5), '-¥5.0');
|
assert.equal(P.signed(0), '+¥0');
|
||||||
assert.equal(P.signed(30), '+¥30.0');
|
assert.equal(P.signed(-5), '-¥5');
|
||||||
|
assert.equal(P.signed(-50.25), '-¥50.25');
|
||||||
|
assert.equal(P.signed(30), '+¥30');
|
||||||
});
|
});
|
||||||
|
|
||||||
test('moneyParts 从 toFixed(1) 的结果上切,不另算整数部', () => {
|
test('moneyParts 保留原始数据小数位,千分位与小数部拆分对齐', () => {
|
||||||
// 99.96 若用 Math.floor 另算会得到 99,与 money() 的 ¥100.0 打架
|
assert.deepEqual(P.moneyParts(99.96), { sign: '', int: '99', frac: '.96' });
|
||||||
assert.deepEqual(P.moneyParts(99.96), { sign: '', int: '100', frac: '.0' });
|
assert.deepEqual(P.moneyParts(2018.25), { sign: '', int: '2,018', frac: '.25' });
|
||||||
assert.deepEqual(P.moneyParts(-1234.56), { sign: '-', int: '1,234', frac: '.6' });
|
assert.deepEqual(P.moneyParts(-1234.56), { sign: '-', int: '1,234', frac: '.56' });
|
||||||
assert.deepEqual(P.moneyParts(0), { sign: '', int: '0', frac: '.0' });
|
assert.deepEqual(P.moneyParts(0), { sign: '', int: '0', frac: '' });
|
||||||
assert.deepEqual(P.moneyParts(1234567.8), { sign: '', int: '1,234,567', frac: '.8' });
|
assert.deepEqual(P.moneyParts(1234567.8), { sign: '', int: '1,234,567', frac: '.8' });
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user