|
90 | 90 | }
|
91 | 91 | calendar.prototype = {
|
92 | 92 | constructor: calendar,
|
| 93 | + /** |
| 94 | + * @description 是不是闰月 |
| 95 | + * @param {Number|String} year |
| 96 | + * @return {Boolean} |
| 97 | + */ |
93 | 98 | YearType: function (year) {
|
94 | 99 | if (year % 4 == 0 && year % 100 != 0 || year % 400 == 0) { return true; }
|
95 | 100 | return false;
|
96 | 101 | },
|
| 102 | + /** |
| 103 | + * @description 判断某个月份需要什么 |
| 104 | + * @param {Number|String} year |
| 105 | + * @param {Number|String} month |
| 106 | + * @return {Number} |
| 107 | + */ |
97 | 108 | DayMonth: function (year, month) {
|
98 | 109 | if (month == 2 && this.YearType(year)) {
|
99 | 110 | return StaticMonth[1][1];
|
|
102 | 113 | }
|
103 | 114 | return StaticMonth[month - 1]
|
104 | 115 | },
|
| 116 | + /** |
| 117 | + * @description 蔡琴公式 |
| 118 | + * @param {Number|String} year |
| 119 | + * @param {Number|String} month |
| 120 | + * @param {Number|String} day |
| 121 | + * @return {Number} |
| 122 | + */ |
105 | 123 | zellerweek: function (year, month, day) {
|
106 | 124 | var m = month, d = day;;
|
107 | 125 | if (month <= 2) {
|
|
116 | 134 | }
|
117 | 135 | return w;
|
118 | 136 | },
|
| 137 | + /** |
| 138 | + * @description 儒略历转化天数 |
| 139 | + * @param {Number|String} jd |
| 140 | + * @return {Object} |
| 141 | + */ |
119 | 142 | julianToDay: function (jd) {
|
120 | 143 | var r = {};
|
121 | 144 | var D = this._int(jd + 0.5);
|
|
143 | 166 | F * 60; r.s = F;
|
144 | 167 | return r;
|
145 | 168 | },
|
| 169 | + /** |
| 170 | + * @description 年月日转儒略日 |
| 171 | + * @param {Number|String} y |
| 172 | + * @param {Number|String} m |
| 173 | + * @param {Number|String} d |
| 174 | + * @return {Number} |
| 175 | + */ |
146 | 176 | dayToJulian: function (y, m, d) {
|
147 | 177 | var year = y, month = m, day = d + 0.5;
|
148 | 178 | //d+0.5是为了调整儒略日的在每天公历的中午12点
|
|
161 | 191 | var a = Math.floor(365.25 * (year + 4716) + 0.01) + Math.floor(30.60001 * (month + 1)) + dd + B - 1524.5;
|
162 | 192 | return a;
|
163 | 193 | },
|
| 194 | + /** |
| 195 | + * @description default left button action |
| 196 | + */ |
164 | 197 | defaultLeftBtn: function () {
|
165 | 198 | if (this.month < 1) return;
|
166 | 199 | if (this.month == 1) {
|
|
170 | 203 | this.month -= 1;
|
171 | 204 | }
|
172 | 205 | },
|
| 206 | + /** |
| 207 | + * @description default right button action |
| 208 | + */ |
173 | 209 | defaultRightBtn: function () {
|
174 | 210 | if (this.month < 1) return;
|
175 | 211 | if (this.month == 12) {
|
|
0 commit comments