v1.2.30 新增万圣节、万圣节前夜;新增全国中小学生安全教育日;新增春社(原二月初二春社改为社日节)、秋社。
This commit is contained in:
@@ -570,3 +570,23 @@ test('test052', () => {
|
||||
const lunar = Solar.fromYmd(2011, 11, 12).getLunar();
|
||||
expect(lunar.getDayPositionTai()).toBe('厕灶厨 外西南');
|
||||
});
|
||||
|
||||
test('test053', () => {
|
||||
const lunar = Solar.fromYmd(1722, 9, 25).getLunar();
|
||||
expect(lunar.getOtherFestivals() + '').toBe('秋社');
|
||||
});
|
||||
|
||||
test('test054', () => {
|
||||
const lunar = Solar.fromYmd(840, 9, 14).getLunar();
|
||||
expect(lunar.getOtherFestivals() + '').toBe('秋社');
|
||||
});
|
||||
|
||||
test('test055', () => {
|
||||
const lunar = Solar.fromYmd(2022, 3, 16).getLunar();
|
||||
expect(lunar.getOtherFestivals() + '').toBe('春社');
|
||||
});
|
||||
|
||||
test('test056', () => {
|
||||
const lunar = Solar.fromYmd(2021, 3, 21).getLunar();
|
||||
expect(lunar.getOtherFestivals() + '').toBe('春社');
|
||||
});
|
||||
|
||||
@@ -31,3 +31,18 @@ test('9', () => {
|
||||
test('10', () => {
|
||||
expect(SolarUtil.isLeapYear(1500)).toBe(false);
|
||||
});
|
||||
|
||||
test('11', () => {
|
||||
var solar = Solar.fromYmd(2022, 3, 28);
|
||||
expect(solar.getFestivals() + '').toBe('全国中小学生安全教育日');
|
||||
});
|
||||
|
||||
test('12', () => {
|
||||
var solar = Solar.fromYmd(2021, 3, 29);
|
||||
expect(solar.getFestivals() + '').toBe('全国中小学生安全教育日');
|
||||
});
|
||||
|
||||
test('13', () => {
|
||||
var solar = Solar.fromYmd(1996, 3, 25);
|
||||
expect(solar.getFestivals() + '').toBe('全国中小学生安全教育日');
|
||||
});
|
||||
|
||||
33
lunar.js
33
lunar.js
@@ -163,6 +163,12 @@
|
||||
if(f){
|
||||
l.push(f);
|
||||
}
|
||||
if (this._p.day + 7 >= SolarUtil.getDaysOfMonth(this._p.year, this._p.month)) {
|
||||
f = SolarUtil.WEEK_FESTIVAL[this._p.month + '-0-' + week];
|
||||
if (f) {
|
||||
l.push(f);
|
||||
}
|
||||
}
|
||||
return l;
|
||||
},
|
||||
getOtherFestivals:function(){
|
||||
@@ -1073,9 +1079,28 @@
|
||||
if(fs){
|
||||
l=l.concat(fs);
|
||||
}
|
||||
if(this._p.solar.toYmd()===this._p.jieQi['清明'].next(-1).toYmd()){
|
||||
var solarYmd = this._p.solar.toYmd();
|
||||
if(this._p.solar.toYmd() === this._p.jieQi['清明'].next(-1).toYmd()){
|
||||
l.push('寒食节');
|
||||
}
|
||||
|
||||
var jq = this._p.jieQi['立春'];
|
||||
var offset = 4 - jq.getLunar().getDayGanIndex();
|
||||
if (offset < 0) {
|
||||
offset += 10
|
||||
}
|
||||
if (solarYmd === jq.next(offset + 40).toYmd()) {
|
||||
l.push('春社');
|
||||
}
|
||||
|
||||
jq = this._p.jieQi['立秋'];
|
||||
offset = 4 - jq.getLunar().getDayGanIndex();
|
||||
if (offset < 0) {
|
||||
offset += 10
|
||||
}
|
||||
if (solarYmd === jq.next(offset + 40).toYmd()) {
|
||||
l.push('秋社');
|
||||
}
|
||||
return l;
|
||||
},
|
||||
getBaZi:function(){
|
||||
@@ -2756,9 +2781,9 @@
|
||||
WEEK:['日','一','二','三','四','五','六'],
|
||||
DAYS_OF_MONTH:[31,28,31,30,31,30,31,31,30,31,30,31],
|
||||
XINGZUO:['白羊','金牛','双子','巨蟹','狮子','处女','天秤','天蝎','射手','摩羯','水瓶','双鱼'],
|
||||
FESTIVAL:{'1-1':'元旦节','2-14':'情人节','3-8':'妇女节','3-12':'植树节','3-15':'消费者权益日','4-1':'愚人节','5-1':'劳动节','5-4':'青年节','6-1':'儿童节','7-1':'建党节','8-1':'建军节','9-10':'教师节','10-1':'国庆节','12-24':'平安夜','12-25':'圣诞节'},
|
||||
FESTIVAL:{'1-1':'元旦节','2-14':'情人节','3-8':'妇女节','3-12':'植树节','3-15':'消费者权益日','4-1':'愚人节','5-1':'劳动节','5-4':'青年节','6-1':'儿童节','7-1':'建党节','8-1':'建军节','9-10':'教师节','10-1':'国庆节','10-31':'万圣节前夜','11-1':'万圣节','12-24':'平安夜','12-25':'圣诞节'},
|
||||
OTHER_FESTIVAL:{'1-8':['周恩来逝世纪念日'],'1-10':['中国人民警察节','中国公安110宣传日'],'1-21':['列宁逝世纪念日'],'1-26':['国际海关日'],'2-2':['世界湿地日'],'2-4':['世界抗癌日'],'2-7':['京汉铁路罢工纪念'],'2-10':['国际气象节'],'2-19':['邓小平逝世纪念日'],'2-21':['国际母语日'],'2-24':['第三世界青年日'],'3-1':['国际海豹日'],'3-3':['全国爱耳日'],'3-5':['周恩来诞辰纪念日','中国青年志愿者服务日'],'3-6':['世界青光眼日'],'3-12':['孙中山逝世纪念日'],'3-14':['马克思逝世纪念日'],'3-17':['国际航海日'],'3-18':['全国科技人才活动日'],'3-21':['世界森林日','世界睡眠日'],'3-22':['世界水日'],'3-23':['世界气象日'],'3-24':['世界防治结核病日'],'4-2':['国际儿童图书日'],'4-7':['世界卫生日'],'4-22':['列宁诞辰纪念日'],'4-23':['世界图书和版权日'],'4-26':['世界知识产权日'],'5-3':['世界新闻自由日'],'5-5':['马克思诞辰纪念日'],'5-8':['世界红十字日'],'5-11':['世界肥胖日'],'5-27':['上海解放日'],'5-31':['世界无烟日'],'6-5':['世界环境日'],'6-6':['全国爱眼日'],'6-8':['世界海洋日'],'6-11':['中国人口日'],'6-14':['世界献血日'],'7-1':['香港回归纪念日'],'7-7':['中国人民抗日战争纪念日'],'7-11':['世界人口日'],'8-5':['恩格斯逝世纪念日'],'8-6':['国际电影节'],'8-12':['国际青年日'],'8-22':['邓小平诞辰纪念日'],'9-3':['中国抗日战争胜利纪念日'],'9-8':['世界扫盲日'],'9-9':['毛泽东逝世纪念日'],'9-14':['世界清洁地球日'],'9-18':['九一八事变纪念日'],'9-20':['全国爱牙日'],'9-21':['国际和平日'],'9-27':['世界旅游日'],'10-4':['世界动物日'],'10-10':['辛亥革命纪念日'],'10-13':['中国少年先锋队诞辰日'],'10-25':['抗美援朝纪念日'],'11-12':['孙中山诞辰纪念日'],'11-17':['国际大学生节'],'11-28':['恩格斯诞辰纪念日'],'12-1':['世界艾滋病日'],'12-12':['西安事变纪念日'],'12-13':['国家公祭日'],'12-26':['毛泽东诞辰纪念日']},
|
||||
WEEK_FESTIVAL:{'5-2-0':'母亲节','6-3-0':'父亲节','11-4-4':'感恩节'},
|
||||
WEEK_FESTIVAL:{'3-0-1':'全国中小学生安全教育日','5-2-0':'母亲节','6-3-0':'父亲节','11-4-4':'感恩节'},
|
||||
isLeapYear:function(year){return (year % 4 === 0 && year % 100 !== 0) || (year % 400 === 0);},
|
||||
getDaysOfMonth:function(year,month){
|
||||
var m = month-1;
|
||||
@@ -2833,7 +2858,7 @@
|
||||
GONG:{'角':'东','井':'南','奎':'西','斗':'北','亢':'东','鬼':'南','娄':'西','牛':'北','氐':'东','柳':'南','胃':'西','女':'北','房':'东','星':'南','昴':'西','虚':'北','心':'东','张':'南','毕':'西','危':'北','尾':'东','翼':'南','觜':'西','室':'北','箕':'东','轸':'南','参':'西','壁':'北' },
|
||||
SHOU:{'东':'青龙','南':'朱雀','西':'白虎','北':'玄武'},
|
||||
FESTIVAL:{'1-1':'春节','1-15':'元宵节','2-2':'龙头节','5-5':'端午节','7-7':'七夕节','8-15':'中秋节','9-9':'重阳节','12-8':'腊八节'},
|
||||
OTHER_FESTIVAL:{'1-4':['接神日'],'1-5':['隔开日'],'1-7':['人日'],'1-8':['谷日','顺星节'],'1-9':['天日'],'1-10':['地日'],'1-20':['天穿节'],'1-25':['填仓节'],'1-30':['正月晦'],'2-1':['中和节'],'2-2':['春社'],'3-3':['上巳节'],'5-20':['分龙节'],'5-25':['会龙节'],'6-6':['天贶节'],'6-24':['观莲节'],'6-25':['五谷母节'],'7-14':['中元节'],'7-22':['财神节'],'7-29':['地藏节'],'8-1':['天灸日'],'10-1':['寒衣节'],'10-10':['十成节'],'10-15':['下元节'],'12-7':['驱傩日'],'12-16':['尾牙'],'12-24':['祭灶日']},
|
||||
OTHER_FESTIVAL:{'1-4':['接神日'],'1-5':['隔开日'],'1-7':['人日'],'1-8':['谷日','顺星节'],'1-9':['天日'],'1-10':['地日'],'1-20':['天穿节'],'1-25':['填仓节'],'1-30':['正月晦'],'2-1':['中和节'],'2-2':['社日节'],'3-3':['上巳节'],'5-20':['分龙节'],'5-25':['会龙节'],'6-6':['天贶节'],'6-24':['观莲节'],'6-25':['五谷母节'],'7-14':['中元节'],'7-22':['财神节'],'7-29':['地藏节'],'8-1':['天灸日'],'10-1':['寒衣节'],'10-10':['十成节'],'10-15':['下元节'],'12-7':['驱傩日'],'12-16':['尾牙'],'12-24':['祭灶日']},
|
||||
CHONG:{'子':'午','丑':'未','寅':'申','卯':'酉','辰':'戌','巳':'亥','午':'子','未':'丑','申':'寅','酉':'卯','戌':'辰','亥':'巳'},
|
||||
CHONG_GAN:{'甲':'戊','乙':'己','丙':'庚','丁':'辛','戊':'壬','己':'癸','庚':'甲','辛':'乙','壬':'丙','癸':'丁'},
|
||||
CHONG_GAN_BAD:{'庚':'甲','辛':'乙','壬':'丙','癸':'丁'},
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "lunar-javascript",
|
||||
"version": "1.2.29",
|
||||
"version": "1.2.30",
|
||||
"description": "lunar is a calendar library for Solar and Chinese Lunar.",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
|
||||
Reference in New Issue
Block a user