@momo-kits/date-picker 0.0.59-beta → 0.0.59-beta.2

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.
@@ -77,7 +77,7 @@ export default class DatePickerHelper {
77
77
  static formatDate(date, format) {
78
78
  if (date && format) {
79
79
  const {
80
- year, month, day, hour, minute, second
80
+ year, month, day, hour, minute, second = 0
81
81
  } = DatePickerHelper.getDateTimeFromFormat(date, format);
82
82
  if (DatePickerHelper.checkValidDate(year, month, day)
83
83
  && DatePickerHelper.checkValidTime(hour, minute, second)) {
@@ -156,17 +156,21 @@ export default class DatePickerHelper {
156
156
  return null;
157
157
  }
158
158
 
159
- static checkValidDate(year, month, day) {
159
+ static checkValidDate(y, m, d) {
160
+ const year = parseInt(y);
161
+ const month = parseInt(m);
162
+ const day = parseInt(d);
160
163
  const months31 = [0, 2, 4, 6, 7, 9, 11];
161
164
  const months30 = [3, 5, 8, 10];
162
165
  const months28 = [1];
163
166
  const isLeap = ((year % 4 === 0) && (year % 100 !== 0)) || (year % 400 === 0);
164
167
  if (year != null && month != null && day != null) {
165
168
  const isDayValid = day > 0;
166
- const isMonthValid = (months31.indexOf(month) !== -1 && day <= 31)
167
- || (months30.indexOf(month) !== -1 && day <= 30)
168
- || (months28.indexOf(month) !== -1 && day <= 28)
169
- || (months28.indexOf(month) !== -1 && day <= 29 && isLeap);
169
+ const isMonthValid = (months31.indexOf(parseInt(month)) != -1 && day <= 31)
170
+ || (months30.indexOf(month) != -1 && day <= 30)
171
+ || (months30.indexOf(month) != -1 && day <= 31)
172
+ || (months28.indexOf(month) != -1 && day <= 28)
173
+ || (months28.indexOf(month) != -1 && day <= 29 && isLeap);
170
174
  return isDayValid && isMonthValid;
171
175
  }
172
176
  return false;
@@ -194,4 +198,8 @@ export default class DatePickerHelper {
194
198
 
195
199
  return monthLength[month - 1];
196
200
  }
201
+
202
+ static capitalizeFirstLetter(string) {
203
+ return string.charAt(0).toUpperCase() + string.slice(1);
204
+ }
197
205
  }
package/package.json CHANGED
@@ -1,16 +1,16 @@
1
1
  {
2
- "name": "@momo-kits/date-picker",
3
- "version": "0.0.59-beta",
4
- "private": false,
5
- "main": "index.js",
6
- "dependencies": {},
7
- "peerDependencies": {
8
- "react-native": ">=0.55",
9
- "prop-types": "^15.7.2",
10
- "react": "16.9.0",
11
- "@momo-kits/core": ">=0.0.5-beta",
12
- "lodash": "^4.17.15"
13
- },
14
- "devDependencies": {},
15
- "license": "MoMo"
2
+ "name": "@momo-kits/date-picker",
3
+ "version": "0.0.59-beta.2",
4
+ "private": false,
5
+ "main": "index.js",
6
+ "dependencies": {},
7
+ "peerDependencies": {
8
+ "@momo-kits/core": ">=0.0.5-beta",
9
+ "lodash": "^4.17.15",
10
+ "prop-types": "^15.7.2",
11
+ "react": "16.9.0",
12
+ "react-native": ">=0.55"
13
+ },
14
+ "devDependencies": {},
15
+ "license": "MoMo"
16
16
  }
package/publish.sh CHANGED
@@ -21,9 +21,9 @@ rsync -r --verbose --exclude '*.mdx' --exclude '*Demo.js' --exclude 'props-type
21
21
  #npm login
22
22
  #publish dist to npm
23
23
  cd dist
24
- npm publish --access=public
24
+ npm publish --tag beta --access=public
25
25
  cd ..
26
26
  rm -rf dist
27
27
 
28
28
 
29
- curl -X POST -H 'Content-Type: application/json' 'https://chat.googleapis.com/v1/spaces/AAAAbP8987c/messages?key=AIzaSyDdI0hCZtE6vySjMm-WEfRq3CPzqKqqsHI&token=UGSFRvk_oYb9uGsAgs31bVvMm6jDkmD8zihGm3eyaQA%3D&threadKey=JoaXTEYaNNkl' -d '{"text": "@momo-kits/date-picker new version release: '*"$VERSION"*' https://www.npmjs.com/package/@momo-kits/date-picker"}'
29
+ #curl -X POST -H 'Content-Type: application/json' 'https://chat.googleapis.com/v1/spaces/AAAAbP8987c/messages?key=AIzaSyDdI0hCZtE6vySjMm-WEfRq3CPzqKqqsHI&token=UGSFRvk_oYb9uGsAgs31bVvMm6jDkmD8zihGm3eyaQA%3D&threadKey=JoaXTEYaNNkl' -d '{"text": "@momo-kits/date-picker new version release: '*"$VERSION"*' https://www.npmjs.com/package/@momo-kits/date-picker"}'