Comparing version 0.0.1 to 0.0.2
@@ -38,4 +38,3 @@ 'use strict'; | ||
'0909': '重阳', | ||
'1208': '腊八', | ||
'1230': '除夕' | ||
'1208': '腊八' | ||
}; | ||
@@ -64,2 +63,12 @@ | ||
/** | ||
* `除夕`的判断,`春节`的前一天。 | ||
*/ | ||
var _chuxi = function _chuxi(date) { | ||
var nextDate = new Date(date); | ||
nextDate.setDate(date.getDate() + 1); | ||
var lDate = solar2Lunar(nextDate).lunar; | ||
return '0101' === _format(lDate.month) + _format(lDate.date); | ||
}; | ||
var holidayCn = function holidayCn(date) { | ||
@@ -79,2 +88,5 @@ var solar = arguments.length <= 1 || arguments[1] === undefined ? true : arguments[1]; | ||
} | ||
if (_chuxi(date)) { | ||
ret.push('除夕'); | ||
} | ||
} | ||
@@ -81,0 +93,0 @@ if (solar) { |
{ | ||
"name": "holiday.cn", | ||
"version": "0.0.1", | ||
"version": "0.0.2", | ||
"description": "Get holidays in China:cn:.", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
@@ -29,3 +29,2 @@ import Lunar from 'ilunar'; | ||
'1208': '腊八', | ||
'1230': '除夕', | ||
}; | ||
@@ -50,2 +49,12 @@ | ||
/** | ||
* `除夕`的判断,`春节`的前一天。 | ||
*/ | ||
const _chuxi = date => { | ||
const nextDate = new Date(date); | ||
nextDate.setDate(date.getDate() + 1); | ||
const lDate = solar2Lunar(nextDate).lunar; | ||
return '0101' === (_format(lDate.month) + _format(lDate.date)); | ||
}; | ||
const holidayCn = (date, solar=true, lunar=true) => { | ||
@@ -62,2 +71,5 @@ let ret = []; | ||
} | ||
if (_chuxi(date)) { | ||
ret.push('除夕'); | ||
} | ||
} | ||
@@ -64,0 +76,0 @@ if (solar) { |
5504
155