@bolttech/atoms-date-input 0.4.13 → 0.4.15
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/index.cjs.js +24 -3
- package/package.json +2 -2
package/index.cjs.js
CHANGED
|
@@ -3070,9 +3070,30 @@ const DateInput = /*#__PURE__*/react.forwardRef((_ref, ref) => {
|
|
|
3070
3070
|
const calendarRef = react.useRef(null);
|
|
3071
3071
|
const containerRef = react.useRef(null);
|
|
3072
3072
|
const firstInputRef = react.useRef(null);
|
|
3073
|
-
const
|
|
3074
|
-
|
|
3075
|
-
|
|
3073
|
+
const parseInitialValue = val => {
|
|
3074
|
+
if (!val) return {
|
|
3075
|
+
day: '',
|
|
3076
|
+
month: '',
|
|
3077
|
+
year: ''
|
|
3078
|
+
};
|
|
3079
|
+
const parts = val.split('-');
|
|
3080
|
+
if (parts.length === 3) {
|
|
3081
|
+
return {
|
|
3082
|
+
year: parts[0],
|
|
3083
|
+
month: parts[1],
|
|
3084
|
+
day: parts[2]
|
|
3085
|
+
};
|
|
3086
|
+
}
|
|
3087
|
+
return {
|
|
3088
|
+
day: '',
|
|
3089
|
+
month: '',
|
|
3090
|
+
year: ''
|
|
3091
|
+
};
|
|
3092
|
+
};
|
|
3093
|
+
const initialParts = parseInitialValue(value);
|
|
3094
|
+
const day = react.useRef(initialParts.day);
|
|
3095
|
+
const month = react.useRef(initialParts.month);
|
|
3096
|
+
const year = react.useRef(initialParts.year);
|
|
3076
3097
|
const [isCalendarOpen, setIsCalendarOpen] = react.useState(false);
|
|
3077
3098
|
const isValidDate = dateStr => {
|
|
3078
3099
|
if (!dateStr || typeof dateStr !== 'string') return false;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bolttech/atoms-date-input",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.15",
|
|
4
4
|
"dependencies": {
|
|
5
5
|
"styled-components": "6.1.1",
|
|
6
6
|
"react": "19.1.2",
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
"react-dom": "19.1.2",
|
|
9
9
|
"@bolttech/molecules-calendar": "0.29.5",
|
|
10
10
|
"@bolttech/atoms-icon": "0.24.9",
|
|
11
|
-
"@bolttech/atoms-input": "0.30.
|
|
11
|
+
"@bolttech/atoms-input": "0.30.5"
|
|
12
12
|
},
|
|
13
13
|
"main": "./index.cjs.js",
|
|
14
14
|
"type": "commonjs",
|