iflow-feishu 1.0.6 → 1.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/core/card-builder.js +9 -9
package/package.json
CHANGED
package/src/core/card-builder.js
CHANGED
|
@@ -5,28 +5,28 @@
|
|
|
5
5
|
/**
|
|
6
6
|
* 格式化时间显示
|
|
7
7
|
* @param {number} ms - 毫秒数
|
|
8
|
-
* @returns {string} 格式化的时间字符串
|
|
8
|
+
* @returns {string} 格式化的时间字符串 (h m s 格式)
|
|
9
9
|
*/
|
|
10
10
|
function formatTime(ms) {
|
|
11
11
|
if (ms < 1000) {
|
|
12
12
|
return `${ms}ms`;
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
-
const
|
|
16
|
-
const
|
|
17
|
-
const
|
|
15
|
+
const totalSeconds = Math.floor(ms / 1000);
|
|
16
|
+
const seconds = totalSeconds % 60;
|
|
17
|
+
const totalMinutes = Math.floor(totalSeconds / 60);
|
|
18
|
+
const minutes = totalMinutes % 60;
|
|
19
|
+
const hours = Math.floor(totalMinutes / 60);
|
|
18
20
|
|
|
19
21
|
if (hours > 0) {
|
|
20
|
-
|
|
21
|
-
return remainMinutes > 0 ? `${hours}h ${remainMinutes}m` : `${hours}h`;
|
|
22
|
+
return `${hours}h ${minutes}m ${seconds}s`;
|
|
22
23
|
}
|
|
23
24
|
|
|
24
25
|
if (minutes > 0) {
|
|
25
|
-
|
|
26
|
-
return remainSeconds > 0 ? `${minutes}m ${remainSeconds}s` : `${minutes}m`;
|
|
26
|
+
return `${minutes}m ${seconds}s`;
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
-
return `${
|
|
29
|
+
return `${seconds}s`;
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
class CardBuilder {
|