1.0.12 • Published 3 years ago

dayjs-range v1.0.12

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

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

1.0.2

3 years ago

1.0.1

3 years ago

1.0.9

3 years ago

1.0.8

3 years ago

1.0.7

3 years ago

1.0.6

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.11

3 years ago

1.0.10

3 years ago

1.0.12

3 years ago

1.0.0

3 years ago