@trackunit/custom-field-components 1.21.2 → 1.21.4

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 CHANGED
@@ -7,6 +7,7 @@ var reactFormComponents = require('@trackunit/react-form-components');
7
7
  var sharedUtils = require('@trackunit/shared-utils');
8
8
  var react = require('react');
9
9
  var reactHookForm = require('react-hook-form');
10
+ var reactDateAndTimeHooks = require('@trackunit/react-date-and-time-hooks');
10
11
  var reactComponents = require('@trackunit/react-components');
11
12
  var reactCoreHooks = require('@trackunit/react-core-hooks');
12
13
  var reactModal = require('@trackunit/react-modal');
@@ -168,15 +169,16 @@ const BooleanCustomField = ({ defaultValue = false, "data-testid": dataTestId =
168
169
  */
169
170
  const DateCustomField = (props) => {
170
171
  const { setValue, defaultValue, register, id, validationRules, ...rest } = props;
172
+ const { YYYYMMDDToUTCMidnightISO } = reactDateAndTimeHooks.useDateAndTime();
171
173
  const onChangeHandler = react.useCallback((e) => {
172
174
  if (setValue) {
173
- const isoUTC = reactFormComponents.toISODateStringUTC(e.target.value);
175
+ const isoUTC = YYYYMMDDToUTCMidnightISO(e.target.value);
174
176
  setValue(id, isoUTC ?? undefined, {
175
177
  shouldDirty: true,
176
178
  shouldValidate: true,
177
179
  });
178
180
  }
179
- }, [setValue, id]);
181
+ }, [setValue, id, YYYYMMDDToUTCMidnightISO]);
180
182
  react.useEffect(() => {
181
183
  const value = Boolean(defaultValue) && defaultValue !== undefined ? new Date(defaultValue) : undefined;
182
184
  if (register) {
package/index.esm.js CHANGED
@@ -1,10 +1,11 @@
1
1
  import { jsx, jsxs } from 'react/jsx-runtime';
2
2
  import { registerTranslations, useNamespaceTranslation } from '@trackunit/i18n-library-translation';
3
3
  import { getCustomFieldValueForDisplayInUI } from '@trackunit/iris-app-runtime-core';
4
- import { FormGroup, Checkbox, toISODateStringUTC, DateField, MultiSelectField, SelectField, TextBaseInput, useGetPhoneValidationRules, NumberField, TextField, PhoneField, ActionButton } from '@trackunit/react-form-components';
4
+ import { FormGroup, Checkbox, DateField, MultiSelectField, SelectField, TextBaseInput, useGetPhoneValidationRules, NumberField, TextField, PhoneField, ActionButton } from '@trackunit/react-form-components';
5
5
  import { uuidv4, exhaustiveCheck } from '@trackunit/shared-utils';
6
6
  import { useState, useEffect, useCallback, createElement, useMemo } from 'react';
7
7
  import { Controller, useWatch } from 'react-hook-form';
8
+ import { useDateAndTime } from '@trackunit/react-date-and-time-hooks';
8
9
  import { Card, CardHeader, Tooltip, CardBody, Text, CardFooter, Button, IconButton, Icon } from '@trackunit/react-components';
9
10
  import { useConfirmationDialog } from '@trackunit/react-core-hooks';
10
11
  import { useModal, Modal, ModalHeader, ModalBody, ModalFooter } from '@trackunit/react-modal';
@@ -166,15 +167,16 @@ const BooleanCustomField = ({ defaultValue = false, "data-testid": dataTestId =
166
167
  */
167
168
  const DateCustomField = (props) => {
168
169
  const { setValue, defaultValue, register, id, validationRules, ...rest } = props;
170
+ const { YYYYMMDDToUTCMidnightISO } = useDateAndTime();
169
171
  const onChangeHandler = useCallback((e) => {
170
172
  if (setValue) {
171
- const isoUTC = toISODateStringUTC(e.target.value);
173
+ const isoUTC = YYYYMMDDToUTCMidnightISO(e.target.value);
172
174
  setValue(id, isoUTC ?? undefined, {
173
175
  shouldDirty: true,
174
176
  shouldValidate: true,
175
177
  });
176
178
  }
177
- }, [setValue, id]);
179
+ }, [setValue, id, YYYYMMDDToUTCMidnightISO]);
178
180
  useEffect(() => {
179
181
  const value = Boolean(defaultValue) && defaultValue !== undefined ? new Date(defaultValue) : undefined;
180
182
  if (register) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trackunit/custom-field-components",
3
- "version": "1.21.2",
3
+ "version": "1.21.4",
4
4
  "repository": "https://github.com/Trackunit/manager",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "engines": {
@@ -8,12 +8,13 @@
8
8
  },
9
9
  "dependencies": {
10
10
  "react-select": "^5.10.2",
11
- "@trackunit/react-form-components": "1.22.2",
11
+ "@trackunit/react-date-and-time-hooks": "1.21.5",
12
+ "@trackunit/react-form-components": "1.22.3",
12
13
  "@trackunit/shared-utils": "1.13.99",
13
- "@trackunit/custom-field-api": "1.21.2",
14
+ "@trackunit/custom-field-api": "1.21.3",
14
15
  "@trackunit/iris-app-runtime-core": "1.15.13",
15
16
  "@trackunit/react-components": "1.22.2",
16
- "@trackunit/react-modal": "1.22.2",
17
+ "@trackunit/react-modal": "1.22.3",
17
18
  "@trackunit/react-core-hooks": "1.15.14",
18
19
  "@trackunit/i18n-library-translation": "1.18.5",
19
20
  "@trackunit/iris-app-runtime-core-api": "1.14.13"