diff --git a/packages/field/src/components/Second/index.tsx b/packages/field/src/components/Second/index.tsx index 2cbef7dcfabf..3027b665a323 100644 --- a/packages/field/src/components/Second/index.tsx +++ b/packages/field/src/components/Second/index.tsx @@ -18,16 +18,17 @@ export type FieldDigitProps = { * @returns {string} */ export function formatSecond(result: number) { + let newResult = result; let formatText = ''; let past = false; - if (result < 0) { - result = -result; + if (newResult < 0) { + newResult = -newResult; past = true; } - const d = Math.floor(result / (3600 * 24)); - const h = Math.floor((result / 3600) % 24); - const m = Math.floor((result / 60) % 60); - const s = Math.floor(result % 60); + const d = Math.floor(newResult / (3600 * 24)); + const h = Math.floor((newResult / 3600) % 24); + const m = Math.floor((newResult / 60) % 60); + const s = Math.floor(newResult % 60); formatText = `${s}秒`; if (m > 0) { formatText = `${m}分钟${formatText}`;