@sheinx/hooks 3.3.7-beta.3 → 3.3.7-beta.5
Sign up to get free protection for your applications and to get access to all the features.
- package/cjs/components/use-datepicker/use-datepicker-format.d.ts.map +1 -1
- package/cjs/components/use-datepicker/use-datepicker-format.js +7 -0
- package/esm/components/use-datepicker/use-datepicker-format.d.ts.map +1 -1
- package/esm/components/use-datepicker/use-datepicker-format.js +7 -0
- package/package.json +1 -1
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"use-datepicker-format.d.ts","sourceRoot":"","sources":["use-datepicker-format.ts"],"names":[],"mappings":"AAAA,OAAO,KAAsC,MAAM,OAAO,CAAC;AAE3D,OAAO,KAAK,EACV,kBAAkB,EAClB,mBAAmB,EACnB,wBAAwB,EACzB,MAAM,8BAA8B,CAAC;AAkEtC,QAAA,MAAM,mBAAmB;;;;;;;;;;;;;;;;
|
1
|
+
{"version":3,"file":"use-datepicker-format.d.ts","sourceRoot":"","sources":["use-datepicker-format.ts"],"names":[],"mappings":"AAAA,OAAO,KAAsC,MAAM,OAAO,CAAC;AAE3D,OAAO,KAAK,EACV,kBAAkB,EAClB,mBAAmB,EACnB,wBAAwB,EACzB,MAAM,8BAA8B,CAAC;AAkEtC,QAAA,MAAM,mBAAmB;;;;;;;;;;;;;;;;yBAiJc,gBAAgB;iCA8BR,MAAM,SAAS,MAAM;yCA7HrD,OAAO,GAAG,KAAK,GAAG,SAAS,QAAQ,MAAM,UAAU,IAAI,KAAK,OAAO;uCAWvE,MAAM,cAAc,CAAC,IAAI,EAAE,CAAC,QAC3B,MAAM;kBACG,MAAM,SAAS;mBAAS,GAAG;;+BAQH,IAAI,YAAY,OAAO,GAAG,KAAK,GAAG,SAAS;;CAwKvF,CAAC;AAEF,eAAe,mBAAmB,CAAC"}
|
@@ -92,6 +92,13 @@ var useDatePickerFormat = function useDatePickerFormat(props) {
|
|
92
92
|
var getCurrentArr = function getCurrentArr() {
|
93
93
|
var arr = convertValueToDateArr(value, format, options);
|
94
94
|
var currentArr = convertValueToDateArr(props.defaultCurrent, 'YYYY-MM-DD', options);
|
95
|
+
var validArr = arr.filter(function (item) {
|
96
|
+
return item;
|
97
|
+
});
|
98
|
+
var validCurrentArr = currentArr.filter(function (item) {
|
99
|
+
return item;
|
100
|
+
});
|
101
|
+
if (!validArr.length && currentArr.length) return validCurrentArr;
|
95
102
|
if (!arr[0]) arr[0] = arr[1] || currentArr[0] || new Date();
|
96
103
|
if (range && !arr[1]) arr[1] = arr[0] || currentArr[1] || new Date();
|
97
104
|
return arr;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"use-datepicker-format.d.ts","sourceRoot":"","sources":["use-datepicker-format.ts"],"names":[],"mappings":"AAAA,OAAO,KAAsC,MAAM,OAAO,CAAC;AAE3D,OAAO,KAAK,EACV,kBAAkB,EAClB,mBAAmB,EACnB,wBAAwB,EACzB,MAAM,8BAA8B,CAAC;AAkEtC,QAAA,MAAM,mBAAmB;;;;;;;;;;;;;;;;
|
1
|
+
{"version":3,"file":"use-datepicker-format.d.ts","sourceRoot":"","sources":["use-datepicker-format.ts"],"names":[],"mappings":"AAAA,OAAO,KAAsC,MAAM,OAAO,CAAC;AAE3D,OAAO,KAAK,EACV,kBAAkB,EAClB,mBAAmB,EACnB,wBAAwB,EACzB,MAAM,8BAA8B,CAAC;AAkEtC,QAAA,MAAM,mBAAmB;;;;;;;;;;;;;;;;yBAiJc,gBAAgB;iCA8BR,MAAM,SAAS,MAAM;yCA7HrD,OAAO,GAAG,KAAK,GAAG,SAAS,QAAQ,MAAM,UAAU,IAAI,KAAK,OAAO;uCAWvE,MAAM,cAAc,CAAC,IAAI,EAAE,CAAC,QAC3B,MAAM;kBACG,MAAM,SAAS;mBAAS,GAAG;;+BAQH,IAAI,YAAY,OAAO,GAAG,KAAK,GAAG,SAAS;;CAwKvF,CAAC;AAEF,eAAe,mBAAmB,CAAC"}
|
@@ -85,6 +85,13 @@ var useDatePickerFormat = function useDatePickerFormat(props) {
|
|
85
85
|
var getCurrentArr = function getCurrentArr() {
|
86
86
|
var arr = convertValueToDateArr(value, format, options);
|
87
87
|
var currentArr = convertValueToDateArr(props.defaultCurrent, 'YYYY-MM-DD', options);
|
88
|
+
var validArr = arr.filter(function (item) {
|
89
|
+
return item;
|
90
|
+
});
|
91
|
+
var validCurrentArr = currentArr.filter(function (item) {
|
92
|
+
return item;
|
93
|
+
});
|
94
|
+
if (!validArr.length && currentArr.length) return validCurrentArr;
|
88
95
|
if (!arr[0]) arr[0] = arr[1] || currentArr[0] || new Date();
|
89
96
|
if (range && !arr[1]) arr[1] = arr[0] || currentArr[1] || new Date();
|
90
97
|
return arr;
|