File tree Expand file tree Collapse file tree 1 file changed +18
-7
lines changed Expand file tree Collapse file tree 1 file changed +18
-7
lines changed Original file line number Diff line number Diff line change @@ -78,14 +78,25 @@ export const formatTime = (time) => {
78
78
const localTime = date . getTime ( ) - timezoneOffset * 60 * 1000
79
79
const localDate = new Date ( localTime )
80
80
const year = localDate . getFullYear ( )
81
- const month = localDate . getMonth ( ) + 1
82
- const day = localDate . getDate ( )
83
- const hour = localDate . getHours ( )
81
+ let month = localDate . getMonth ( ) + 1
82
+ let day = localDate . getDate ( )
83
+ let hour = localDate . getHours ( )
84
84
let minute = localDate . getMinutes ( )
85
- const second = localDate . getSeconds ( )
85
+ let second = localDate . getSeconds ( )
86
+ /**
87
+ * TO Little SHI:
88
+ * 你需要在这解决时间的bug
89
+ */
86
90
// 如果minute是个位数,转换成两位数
87
- if ( minute < 10 ) {
88
- minute = '0' + minute
89
- }
91
+ if ( month < 10 ) month = '0' + month
92
+
93
+ if ( day < 10 ) day = '0' + day
94
+
95
+ if ( hour < 10 ) hour = '0' + hour
96
+
97
+ if ( minute < 10 ) minute = '0' + minute
98
+
99
+ if ( second < 10 ) second = '0' + second
100
+
90
101
return `${ year } /${ month } /${ day } ${ hour } :${ minute } :${ second } `
91
102
}
You can’t perform that action at this time.
0 commit comments