month-calculator
A plugin for month date calculator , 中文
Install
npm install month-calculator --save
Features
- Highly customizable
- No dependence on UI, You can design by yourself
- Support browser、nodejs、miniProgram(小程序)
Usage
var oMonth = startDate: '2017-07-17' endDate: '2018-08-18'; var months = oMonth; console;
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
getToday
- if today's date is betweenstartDate
andendDate
, will return an Object{ monthIndex, date }
, and themonthIndex
is today's month index in total result, otherwise will returnundefined
Result
After use getTotal
method will return the result structure below
[ ...]
Result date properties
date
- total date formattedYYYY-MM-DD
year
- date formattedYYYY
month
- date formattedMM
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