@momo-kits/date-picker 0.0.55-beta → 0.0.55-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.
- package/datePicker/DatePicker.js +337 -141
- package/datePicker/DatePickerInput.js +47 -16
- package/datePicker/ListPicker.js +51 -47
- package/datePicker/WheelPicker.js +130 -83
- package/datePicker/helper/DatePickerHelper.js +14 -6
- package/package.json +16 -14
- package/publish.sh +2 -2
|
@@ -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(
|
|
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)
|
|
167
|
-
|| (months30.indexOf(month)
|
|
168
|
-
|| (
|
|
169
|
-
|| (months28.indexOf(month)
|
|
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,18 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
"
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
2
|
+
"name": "@momo-kits/date-picker",
|
|
3
|
+
"version": "0.0.55-beta.2",
|
|
4
|
+
"private": false,
|
|
5
|
+
"main": "index.js",
|
|
6
|
+
"dependencies": {
|
|
7
|
+
"@momo-platform/versions": "4.0.2"
|
|
8
|
+
},
|
|
9
|
+
"peerDependencies": {
|
|
10
|
+
"@momo-kits/core": ">=0.0.5-beta",
|
|
11
|
+
"lodash": "^4.17.15",
|
|
12
|
+
"prop-types": "^15.7.2",
|
|
13
|
+
"react": "16.9.0",
|
|
14
|
+
"react-native": ">=0.55"
|
|
15
|
+
},
|
|
16
|
+
"devDependencies": {},
|
|
17
|
+
"license": "MoMo"
|
|
16
18
|
}
|
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"}'
|