1.0.7 • Published 6 years ago
calendar-calculator v1.0.7
calendar-calculator
A plugin for calendar calculator , 中文
Install
npm install calendar-calculator
Features
- Highly customizable
- No dependence on UI, You can design by yourself
- Support browser、nodejs、miniProgram(小程序)
Usage
var oCalendar = new CalendarCalculator({
startDate: '2017-07-17',
endDate: '2018-08-18'
});
var months = oCalendar.getTotal();
console.log(months);
Parameter
startDate
- the start date formatted likeYYYY-MM-DD
endDate
- the end date formatted likeYYYY-MM-DD
Method
getTotal
- get the total months fromstartDate
toendDate
Result
After use getTotal
method will return the result structure below
[
{
title: '2017-07',
dates: [
{
date: '2017-06-25',
day: '25',
disabled: true,
isPrevMonth: true,
week: '日',
weekday: 0
}
...
]
}
...
]
date properties
date
- total date formattedYYYY-MM-DD
day
- date formattedDD
weekday
- weekday from0
to6
week
- Chinese weekday日一二三四五六
isPrevMonth
- if it is previous month date, will betrue
isNextMonth
- if it is next month date, will betrue
disabled
- if it isisPrevMonth
、isNextMonth
or current month disabled date(not betweenstartDate
toendDate
), will betrue