Skip to content

Commit bc60395

Browse files
author
hoang.duong
committed
dayjs extend weekday
1 parent 8baa6cc commit bc60395

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

trydayjs.js

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ dayjs.extend(require('dayjs/plugin/timezone'))
55
dayjs.extend(require('dayjs/plugin/localizedFormat'))
66
dayjs.extend(require('dayjs/plugin/relativeTime'))
77
dayjs.extend(require('dayjs/plugin/customParseFormat'))
8+
dayjs.extend(require('dayjs/plugin/weekday'))
89

910
dayjs.locale('vi')
1011

@@ -19,4 +20,14 @@ for (let i = 0; i < 7; i++) {
1920
)
2021
}
2122

22-
console.log(dayjs.utc().startOf('month').format())
23+
console.log(dayjs.utc().startOf('month').format())
24+
const s = []
25+
const WEEKDAYS = Array.from({ length: 7 }, (_, i) => i).reduce((previousValue, currentValue) => {
26+
console.log(previousValue, currentValue)
27+
// previousValue.push(dayjs().weekday(currentIndex).format('ddd'))
28+
previousValue.push(dayjs().weekday(currentValue).format('ddd'))
29+
return previousValue
30+
}, [])
31+
console.log(Array.from({ length: 7 }, (_, i) => dayjs().weekday(i).format('ddd')))
32+
33+
console.log(Math.ceil(36 / 7))

0 commit comments

Comments
 (0)