Skip to content

Commit 60eba1c

Browse files
committed
chore: fix lint error
1 parent 312cdb0 commit 60eba1c

File tree

1 file changed

+7
-6
lines changed
  • packages/field/src/components/Second

1 file changed

+7
-6
lines changed

packages/field/src/components/Second/index.tsx

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,17 @@ export type FieldDigitProps = {
1818
* @returns {string}
1919
*/
2020
export function formatSecond(result: number) {
21+
let newResult = result;
2122
let formatText = '';
2223
let past = false;
23-
if (result < 0) {
24-
result = -result;
24+
if (newResult < 0) {
25+
newResult = -newResult;
2526
past = true;
2627
}
27-
const d = Math.floor(result / (3600 * 24));
28-
const h = Math.floor((result / 3600) % 24);
29-
const m = Math.floor((result / 60) % 60);
30-
const s = Math.floor(result % 60);
28+
const d = Math.floor(newResult / (3600 * 24));
29+
const h = Math.floor((newResult / 3600) % 24);
30+
const m = Math.floor((newResult / 60) % 60);
31+
const s = Math.floor(newResult % 60);
3132
formatText = `${s}秒`;
3233
if (m > 0) {
3334
formatText = `${m}分钟${formatText}`;

0 commit comments

Comments
 (0)