1.0.1 • Published 4 years ago

calendar-tools-pkg v1.0.1

Weekly downloads
-
License
ISC
Repository
-
Last release
4 years ago

calendar-tools-pkg

封装了制作日历所必要的函数

使用方法

yarn add calendar-tools-pkgnpm install calendar-tools-pkg

函数说明类型参数说明
formatDate格式化时间为YYYY-MM-DD(可选时间粒度,最小粒度为天)function formatDate(date:Date,field:'day'|'month'|'year'):string
getDateListByMonth获取一个月的页面所显示的所有时间,可指定一周的起点function getDateListByMonth(date: Date,startDay: number): CalendarDateInfo[]date:目标月份的任意一个Date对象,startDay:一周的开始,0代表周日,1代表周一 ,其它同理
getDateListByWeek类似getDateListByMonth,不同的是这个函数用于生成周视图function getDateListByWeek(date: Date,startDay: number): CalendarDateInfo[]同上

农历信息的生成可以使用calendar.js,由于这个工具体积较大,且不是必须,这里没有做打包。