From 327d71534e026739d0cb122f922731d7e944b746 Mon Sep 17 00:00:00 2001 From: harveyshao Date: Fri, 16 Dec 2022 22:16:24 +0800 Subject: [PATCH] opt some --- lib/date.js | 8 -------- 1 file changed, 8 deletions(-) diff --git a/lib/date.js b/lib/date.js index 6f77fdf2..099fa46a 100644 --- a/lib/date.js +++ b/lib/date.js @@ -6,7 +6,6 @@ Volcanos("date", { // @1900-2100区间内的公历转农历 if (leap > 0 && month == leap+1 && isLeap == false) { month--, isLeap = true, days = this.leapDays(year) } else { days = this.monthDays(year, month) } if (isLeap == true && month == leap+1) { isLeap = false } day -= days } if (day == 0 && leap > 0 && month == leap+1) { if (isLeap) { isLeap = false } else { isLeap = true, month-- } } if (day < 0) { day += days, month-- } day++ - // 节气 var term = null, firstTerm = this.getTerm(y, (m*2-1)), secondTerm = this.getTerm(y, (m*2)) if (d == firstTerm) { term = this.termName[m*2-2] } else if (d == secondTerm) { term = this.termName[m*2-1] } @@ -17,7 +16,6 @@ Volcanos("date", { // @1900-2100区间内的公历转农历 // 节日 var nWeek = date.getDay(), cWeek = this.nStr3[nWeek]; if (nWeek == 0) { nWeek = 7 } function getFestival(list, m, d) { return list[m+"-"+d]? list[m+"-"+d].title: null } - var res = {Date: y+'-'+m+'-'+d, lunarDate: year+'-'+month+'-'+day, Year: y, Month: m, Day: d, lYear: year, lMonth: month, lDay: day, gzYear: gzY, gzMonth: gzM, gzDay: gzD, Animal: this.getAnimal(year), cnMonth: (isLeap?"\u95f0":'')+this.toChinaMonth(month), cnDay: this.toChinaDay(day), @@ -28,7 +26,6 @@ Volcanos("date", { // @1900-2100区间内的公历转农历 res.autoClass = "lunar"+(res.lunarFestival||res.Festival? " fest":"")+(term? " term": "") return res }, - // 天干表 ["甲","乙","丙","丁","戊","己","庚","辛","壬","癸"] Gan: ["\u7532","\u4e59","\u4e19","\u4e01","\u620a","\u5df1","\u5e9a","\u8f9b","\u58ec","\u7678"], // 地支表 ["子","丑","寅","卯","辰","巳","午","未","申","酉","j戌","亥"] @@ -39,12 +36,10 @@ Volcanos("date", { // @1900-2100区间内的公历转农历 var zhiKey = (lYear-3)%12; if (zhiKey == 0) { zhiKey = 12 } return this.Gan[ganKey-1] + this.Zhi[zhiKey-1] }, - // 生肖表 ["鼠","牛","虎","兔","龙","蛇","马","羊","猴","鸡","狗","猪"] Animals: ["\u9f20","\u725b","\u864e","\u5154","\u9f99","\u86c7","\u9a6c","\u7f8a","\u7334","\u9e21","\u72d7","\u732a"], // 年份转生肖,精确划分生肖分界线是"立春" getAnimal: function(y) { return this.Animals[(y - 4) % 12] }, - // 月份表 ['正','一','二','三','四','五','六','七','八','九','十','冬','腊'] nStr1: ["\u6b63","\u4e8c","\u4e09","\u56db","\u4e94","\u516d","\u4e03","\u516b","\u4e5d","\u5341","\u51ac","\u814a"], // 月旬表 ['初','十','廿','卅'] @@ -58,7 +53,6 @@ Volcanos("date", { // @1900-2100区间内的公历转农历 case 30: return '\u4e09\u5341' default: return this.nStr2[Math.floor(d/10)]+this.nStr3[d%10] } }, - // 公历每个月份的天数普通表 solarMonth: [31,28,31,30,31,30,31,31,30,31,30,31], // 返回公历y年m月的天数 @@ -94,7 +88,6 @@ Volcanos("date", { // @1900-2100区间内的公历转农历 '8-15': {title: '中秋'}, '9-9': {title: '重阳'}, }, - // 返回农历y年m月(非闰月)的总天数,计算m为闰月时的天数请使用leapDays方法 monthDays: function(y, m) { return (this.lunarInfo[y-1900] & (0x10000>>m))? 30: 29 }, // 返回农历y年闰月是哪个月;若y年没有闰月则返回0 @@ -129,7 +122,6 @@ Volcanos("date", { // @1900-2100区间内的公历转农历 0x0e968,0x0d520,0x0daa0,0x16aa6,0x056d0,0x04ae0,0x0a9d4,0x0a2d0,0x0d150,0x0f252,//2090-2099 0x0d520, //2100 ], - getTerm: function(y, n) { // 传入公历y年获得该年第n个节气的公历日期 var _table = this.termInfo[y-1900] var _info = [