calendar-ts
v1.0.4
Published
generate calendar data
Downloads
9
Maintainers
Readme
一个生成当月日历数据的插件
默认为周日为第一天, 可以在 new 的时候传入 1 为 周一是第一天
const c = new Calendar()
c.monthDates(2022, 7) // 返回一个当月数据的二维数组
数据展示
[
[
'2022-01-29T16:00:00.000Z',
'2022-01-30T16:00:00.000Z',
'2022-01-31T16:00:00.000Z',
'2022-02-01T16:00:00.000Z',
'2022-02-02T16:00:00.000Z',
'2022-02-03T16:00:00.000Z',
'2022-02-04T16:00:00.000Z'
],
[
'2022-02-05T16:00:00.000Z',
'2022-02-06T16:00:00.000Z',
'2022-02-07T16:00:00.000Z',
'2022-02-08T16:00:00.000Z',
'2022-02-09T16:00:00.000Z',
'2022-02-10T16:00:00.000Z',
'2022-02-11T16:00:00.000Z'
],
[
'2022-02-12T16:00:00.000Z',
'2022-02-13T16:00:00.000Z',
'2022-02-14T16:00:00.000Z',
'2022-02-15T16:00:00.000Z',
'2022-02-16T16:00:00.000Z',
'2022-02-17T16:00:00.000Z',
'2022-02-18T16:00:00.000Z'
],
[
'2022-02-19T16:00:00.000Z',
'2022-02-20T16:00:00.000Z',
'2022-02-21T16:00:00.000Z',
'2022-02-22T16:00:00.000Z',
'2022-02-23T16:00:00.000Z',
'2022-02-24T16:00:00.000Z',
'2022-02-25T16:00:00.000Z'
],
[
'2022-02-26T16:00:00.000Z',
'2022-02-27T16:00:00.000Z',
'2022-02-28T16:00:00.000Z',
'2022-03-01T16:00:00.000Z',
'2022-03-02T16:00:00.000Z',
'2022-03-03T16:00:00.000Z',
'2022-03-04T16:00:00.000Z'
]
]
api 说明
| api |explore | argument | | ---- | ---- | ---- | | monthDates | 获取当月日历数据 | (year, month )| | monthDays | 获取当月日历数据,值为格式化后的 number | (year, month)| | monthText | 获取当月日历数据,值为字符串,此 api 意义不大 | (year, month)|