@momo-kits/calendar 0.169.6 → 0.169.7-beta.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/MonthList.tsx CHANGED
@@ -26,6 +26,9 @@ const MAX_RENDER_PER_BATCH = Platform.OS === 'android' ? 1 : 12;
26
26
  // @ts-ignore
27
27
  const converter = new LunarDateConverter();
28
28
 
29
+ /**
30
+ * True when `a` and `b` fall in the same month of the same year.
31
+ */
29
32
  const isSameMonth = (a: Moment, b: Moment) => {
30
33
  return a.year() === b.year() && a.month() === b.month();
31
34
  };
package/Util.ts CHANGED
@@ -13,14 +13,17 @@ const Solar = (momentDate: moment.Moment) => ({
13
13
  solarYear: momentDate.year(),
14
14
  });
15
15
 
16
+ /** Day or month as two digits, zero-padded: 5 → `05`. */
16
17
  const padTwoDigits = (value: number) => {
17
18
  return value < 10 ? `0${value}` : `${value}`;
18
19
  };
19
20
 
20
- const formatYYYYMMDD = (dd: number, mm: number, yyyy: any) => {
21
+ /** `YYYY-MM-DD`, zero-padded ISO so `moment()` parses it without a format. */
22
+ const formatYYYYMMDD = (dd: number, mm: number, yyyy: number) => {
21
23
  return `${yyyy}-${padTwoDigits(mm)}-${padTwoDigits(dd)}`;
22
24
  };
23
25
 
26
+ /** Zero-padded `DD/MM`, the key holidays are grouped by. */
24
27
  const formatDDMM = (dd: number, mm: number) => {
25
28
  return `${padTwoDigits(dd)}/${padTwoDigits(mm)}`;
26
29
  };
@@ -120,7 +123,7 @@ const Utils = {
120
123
  if (holiday.solar[headerInfo.month() + 1]) {
121
124
  // @ts-ignore
122
125
  holiday.solar[headerInfo.month() + 1].forEach(
123
- (date: { month: number; day: any }) => {
126
+ (date: { month: number; day: number }) => {
124
127
  const dateAsMoment = moment({
125
128
  year: headerInfo.year(),
126
129
  month: date.month - 1,
@@ -133,7 +136,7 @@ const Utils = {
133
136
  );
134
137
  }
135
138
 
136
- holiday.lunar.forEach((item: { lunarDay: any; lunarMonth: any }) => {
139
+ holiday.lunar.forEach(item => {
137
140
  if (currentYear instanceof Array) {
138
141
  const solar1 = converter.LunarToSolar({
139
142
  lunarDay: item.lunarDay,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@momo-kits/calendar",
3
- "version": "0.169.6",
3
+ "version": "0.169.7-beta.3",
4
4
  "private": false,
5
5
  "main": "index.tsx",
6
6
  "peerDependencies": {