dayjs-range

1.0.12 • Public • Published

compute first day and last day of type(month,quarter,year) by provided data

根据提供的时间,得出当前时间的月,季,年的第一天至最后一天。

install

npm i dayjs-range

usage

dayjs().getTimeBorder(timestamp, type)

参数

< timestamp > timestamp 时间戳

< type > month | quarter | year

e.g:

month | 月

let time = dayjs.getTimeBorder(1635952894007, 'month')

console.log(time.startDate) // 2021-11-01

console.log(time.endDate) // 2021-11-30

quarter | 季度

let time = dayjs.getTimeBorder(1635952894007, 'quarter')

console.log(time.startDate) // 2021-10-01

console.log(time.endDate) // 2021-12-31

year | 年

let time = dayjs.getTimeBorder(1635952894007, 'year')

console.log(time.startDate) // 2021-01-01

console.log(time.endDate) // 2021-12-31

Package Sidebar

Install

npm i dayjs-range

Weekly Downloads

14

Version

1.0.12

License

MIT

Unpacked Size

2.81 kB

Total Files

3

Last publish

Collaborators

  • star_chen