Skip to content

Commit 85c5d60

Browse files
committed
fix[parseTime]: fix getDay() bug PanJiaChen#152
1 parent 4889c17 commit 85c5d60

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/utils/index.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@ export function parseTime(time, cFormat) {
2525
}
2626
const time_str = format.replace(/{(y|m|d|h|i|s|a)+}/g, (result, key) => {
2727
let value = formatObj[key]
28-
if (key === 'a') { return ['一', '二', '三', '四', '五', '六', '日'][value - 1] }
28+
// Note: getDay() returns 0 on Sunday
29+
if (key === 'a') { return ['日', '一', '二', '三', '四', '五', '六'][value ] }
2930
if (result.length > 0 && value < 10) {
3031
value = '0' + value
3132
}

0 commit comments

Comments
 (0)