@uncinc/uncinc-react-kitchen-sink 2.11.12 → 2.11.13

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.
@@ -117,18 +117,25 @@ var DateSelect = function DateSelect(props) {
117
117
 
118
118
  // Validation and setting either an error or the FieldValue
119
119
  useEffect(function () {
120
- hideYear && setYear(fixedYear || new Date().getFullYear());
120
+ if (hideYear) {
121
+ setYear(fixedYear || new Date().getFullYear());
122
+ }
121
123
 
122
124
  // In some cases, this element can re-render while there's already a value in the Formik Context.
123
125
  // For example, when we build a Webform with multiplate pages, and you go báck a page.
124
126
  //
125
127
  // The values will still be in the Formik Context, but we need to set them again in useState
126
128
  if (value) {
127
- value.getDate() && setDay(value.getDate());
128
-
129
- // months are zero-indexed
130
- value.getMonth() !== undefined && setMonth(value.getMonth() + 1);
131
- value.getFullYear() && setYear(value.getFullYear());
129
+ if (!day && value.getDate()) {
130
+ setDay(value.getDate());
131
+ }
132
+ if (!month && value.getMonth() !== undefined) {
133
+ // months are zero-indexed
134
+ setMonth(value.getMonth() + 1);
135
+ }
136
+ if (!year && value.getFullYear()) {
137
+ setYear(value.getFullYear());
138
+ }
132
139
  }
133
140
 
134
141
  // All options are filled, start validation
@@ -143,6 +150,7 @@ var DateSelect = function DateSelect(props) {
143
150
  var date = new Date("".concat(year, "-").concat(toTwoDigits(month), "-").concat(toTwoDigits(day)));
144
151
  setFieldValue(fieldName, date);
145
152
  }
153
+ // eslint-disable-next-line react-hooks/exhaustive-deps
146
154
  }, [isSubmitting, day, month, year]);
147
155
  var handleValidation = function handleValidation(value) {
148
156
  if (validation && typeof validation === 'function') {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uncinc/uncinc-react-kitchen-sink",
3
- "version": "2.11.12",
3
+ "version": "2.11.13",
4
4
  "description": "Default React components that are easily extended.",
5
5
  "author": "uncinc",
6
6
  "license": "MIT",