carbon-addons-iot-react icon indicating copy to clipboard operation
carbon-addons-iot-react copied to clipboard

[DateTimePicker] Setting date range throws error when dateTimeMask does not include time part

Open navjeets opened this issue 2 years ago • 0 comments
trafficstars

What package is this for?

  • [X] React
  • [ ] Angular

Describe the bug

If the dateTimeMask doesn't include the time part e.g. "MM/DD/YYYY", changing the range in DateTimePicker causes exception. Here's the stack trace

Uncaught TypeError: Cannot read properties of undefined (reading 'includes')
    at is24hours (dateTimePickerUtils.js:43:1)
    at parseValue (dateTimePickerUtils.js:149:1)
    at renderValue (DateTimePicker.js:462:1)
    at eval (DateTimePicker.js:469:1)
    at invokePassiveEffectCreate (react-dom.development.js:23487:1)
    at HTMLUnknownElement.callCallback (react-dom.development.js:3945:1)
    at Object.invokeGuardedCallbackDev (react-dom.development.js:3994:1)
    at invokeGuardedCallback (react-dom.development.js:4056:1)
    at flushPassiveEffectsImpl (react-dom.development.js:23574:1)
    at unstable_runWithPriority (scheduler.development.js:468:1)
    at runWithPriority$1 (react-dom.development.js:11276:1)
    at flushPassiveEffects (react-dom.development.js:23447:1)
    at performSyncWorkOnRoot (react-dom.development.js:22269:1)
    at eval (react-dom.development.js:11327:1)
    at unstable_runWithPriority (scheduler.development.js:468:1)
    at runWithPriority$1 (react-dom.development.js:11276:1)
    at flushSyncCallbackQueueImpl (react-dom.development.js:11322:1)
    at flushSyncCallbackQueue (react-dom.development.js:11309:1)
    at flushPassiveEffectsImpl (react-dom.development.js:23620:1)
    at unstable_runWithPriority (scheduler.development.js:468:1)
    at runWithPriority$1 (react-dom.development.js:11276:1)
    at flushPassiveEffects (react-dom.development.js:23447:1)
    at flushDiscreteUpdates (react-dom.development.js:22356:1)
    at flushDiscreteUpdatesIfNeeded (react-dom.development.js:3768:1)
    at dispatchDiscreteEvent (react-dom.development.js:5886:1)

To Reproduce

Steps to reproduce the behavior:

  1. Set the dateTimeMask to "MM/DD/YYYY" in DateTimePicker.
  2. Change the range in DateTimePicker.
  3. See the error.

Expected behavior

User should be able to set the dateTimeMaskin DateTimePicker to just date format.

Environment/versions:

  • OS: All
  • Browser: All
  • carbon-addons-iot-react version: v2.152.4

Additional context

This caused by changes in this commit -> https://github.com/carbon-design-system/carbon-addons-iot-react/commit/cc20d6e0cd1ac133b1e78b38e572878ff6c9561b#diff-b384b4bbb432ea7d7ff4e0a55b7c379c4261fcfaba975ad469c489f7530970f1

Specific timeline issues / requests

Do you want this work within a specific time period? Is it related to an upcoming release? The fix is required for MAS 8.10. Health defect -> https://github.ibm.com/maximo/Asset-Health-Insight/issues/13887

NB: The core contributors will try to work with your timeline, but it's not guaranteed. The earlier you make a request in advance of a desired delivery date, the better!

navjeets avatar Mar 05 '23 05:03 navjeets