Skip to content

Commit 34f78a2

Browse files
committed
Add a little comment, for the correct format
1 parent 8074e9c commit 34f78a2

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

日历(over)/index.js

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,10 +90,21 @@
9090
}
9191
calendar.prototype = {
9292
constructor: calendar,
93+
/**
94+
* @description 是不是闰月
95+
* @param {Number|String} year
96+
* @return {Boolean}
97+
*/
9398
YearType: function (year) {
9499
if (year % 4 == 0 && year % 100 != 0 || year % 400 == 0) { return true; }
95100
return false;
96101
},
102+
/**
103+
* @description 判断某个月份需要什么
104+
* @param {Number|String} year
105+
* @param {Number|String} month
106+
* @return {Number}
107+
*/
97108
DayMonth: function (year, month) {
98109
if (month == 2 && this.YearType(year)) {
99110
return StaticMonth[1][1];
@@ -102,6 +113,13 @@
102113
}
103114
return StaticMonth[month - 1]
104115
},
116+
/**
117+
* @description 蔡琴公式
118+
* @param {Number|String} year
119+
* @param {Number|String} month
120+
* @param {Number|String} day
121+
* @return {Number}
122+
*/
105123
zellerweek: function (year, month, day) {
106124
var m = month, d = day;;
107125
if (month <= 2) {
@@ -116,6 +134,11 @@
116134
}
117135
return w;
118136
},
137+
/**
138+
* @description 儒略历转化天数
139+
* @param {Number|String} jd
140+
* @return {Object}
141+
*/
119142
julianToDay: function (jd) {
120143
var r = {};
121144
var D = this._int(jd + 0.5);
@@ -143,6 +166,13 @@
143166
F * 60; r.s = F;
144167
return r;
145168
},
169+
/**
170+
* @description 年月日转儒略日
171+
* @param {Number|String} y
172+
* @param {Number|String} m
173+
* @param {Number|String} d
174+
* @return {Number}
175+
*/
146176
dayToJulian: function (y, m, d) {
147177
var year = y, month = m, day = d + 0.5;
148178
//d+0.5是为了调整儒略日的在每天公历的中午12点
@@ -161,6 +191,9 @@
161191
var a = Math.floor(365.25 * (year + 4716) + 0.01) + Math.floor(30.60001 * (month + 1)) + dd + B - 1524.5;
162192
return a;
163193
},
194+
/**
195+
* @description default left button action
196+
*/
164197
defaultLeftBtn: function () {
165198
if (this.month < 1) return;
166199
if (this.month == 1) {
@@ -170,6 +203,9 @@
170203
this.month -= 1;
171204
}
172205
},
206+
/**
207+
* @description default right button action
208+
*/
173209
defaultRightBtn: function () {
174210
if (this.month < 1) return;
175211
if (this.month == 12) {

0 commit comments

Comments
 (0)