@trackunit/custom-field-components 0.0.134 → 0.0.135
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.js +6 -16
- package/package.json +2 -2
package/index.js
CHANGED
|
@@ -1869,15 +1869,6 @@ const BooleanCustomField = _a => {
|
|
|
1869
1869
|
}));
|
|
1870
1870
|
};
|
|
1871
1871
|
|
|
1872
|
-
const formatDateToString = date => {
|
|
1873
|
-
const month = date.getMonth() + 1;
|
|
1874
|
-
const mm = month.toString(10).length === 1 ? `0${month}` : month;
|
|
1875
|
-
const day = date.getDate();
|
|
1876
|
-
const dd = day.toString(10).length === 1 ? `0${day}` : day;
|
|
1877
|
-
const year = date.getFullYear();
|
|
1878
|
-
return `${year}-${mm}-${dd}`;
|
|
1879
|
-
};
|
|
1880
|
-
|
|
1881
1872
|
const DateCustomField = props => {
|
|
1882
1873
|
const {
|
|
1883
1874
|
setValue,
|
|
@@ -1888,10 +1879,10 @@ const DateCustomField = props => {
|
|
|
1888
1879
|
} = props,
|
|
1889
1880
|
rest = __rest(props, ["setValue", "defaultValue", "register", "id", "validationRules"]);
|
|
1890
1881
|
|
|
1891
|
-
const onChangeHandler = useCallback(
|
|
1892
|
-
|
|
1893
|
-
|
|
1894
|
-
|
|
1882
|
+
const onChangeHandler = useCallback(e => {
|
|
1883
|
+
var _a;
|
|
1884
|
+
|
|
1885
|
+
setValue && setValue(id, (_a = e.target.valueAsDate) === null || _a === void 0 ? void 0 : _a.toISOString());
|
|
1895
1886
|
}, [setValue, id]);
|
|
1896
1887
|
useEffect(() => {
|
|
1897
1888
|
const value = defaultValue && new Date(defaultValue);
|
|
@@ -1900,10 +1891,9 @@ const DateCustomField = props => {
|
|
|
1900
1891
|
}));
|
|
1901
1892
|
}, [register, validationRules, defaultValue, id]);
|
|
1902
1893
|
return jsx(DateField, Object.assign({}, rest, {
|
|
1903
|
-
|
|
1904
|
-
|
|
1894
|
+
helpAddon: props.helpAddon || null,
|
|
1895
|
+
helpText: props.errorMessage || props.helpText,
|
|
1905
1896
|
onChange: onChangeHandler,
|
|
1906
|
-
disabled: props.readOnly,
|
|
1907
1897
|
label: undefined
|
|
1908
1898
|
}));
|
|
1909
1899
|
};
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trackunit/custom-field-components",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.135",
|
|
4
4
|
"repository": "https://github.com/Trackunit/manager",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
6
6
|
"dependencies": {
|
|
7
7
|
"@trackunit/react-core-contexts-test": "0.0.39",
|
|
8
|
-
"@trackunit/react-components": "0.0.
|
|
8
|
+
"@trackunit/react-components": "0.0.147",
|
|
9
9
|
"react": "17.0.2",
|
|
10
10
|
"react-hook-form": "^7.36.1",
|
|
11
11
|
"@trackunit/iris-app-runtime-core": "0.0.68",
|