File tree Expand file tree Collapse file tree 1 file changed +7
-6
lines changed
packages/field/src/components/Second Expand file tree Collapse file tree 1 file changed +7
-6
lines changed Original file line number Diff line number Diff line change @@ -18,16 +18,17 @@ export type FieldDigitProps = {
1818 * @returns {string }
1919 */
2020export 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 } ` ;
You can’t perform that action at this time.
0 commit comments