Esri / calcite-design-system

A monorepo containing the packages for Esri's Calcite Design System
https://developers.arcgis.com/calcite-design-system/
Other
282 stars 76 forks source link

Set value on calcite-input-time-picker works incorrectly when default value exists #4206

Closed fendiaoxiaoshuazi closed 2 years ago

fendiaoxiaoshuazi commented 2 years ago

Actual Behavior

When the default value exists on the calcite-input-time-picker, the set value on the input time picker will work incorrectly.

For example, the input time picker has the default value of 11:00, when I try to set the input time picker's value to 14:30 by code, the input time picker will receive an incorrect value 14:00:00. (Note: if the input time picker does not have the default value, set value can work correctly.)

image

Expected Behavior

The value should be set correctly on the input time picker when the default value exists.

Reproduction Sample

https://codepen.io/nan9266/pen/XWzzaxM?editors=1111

Reproduction Steps

  1. Open the console
  2. Click on the "change time as 14:30" button
    • Do not manually change the value of the input time picker before clicking the button
  3. Observe the UI and console both shows incorrect value

Reproduction Version

1.0.0-beta.72

Relevant Info

No response

Regression?

No response

fendiaoxiaoshuazi commented 2 years ago

The issue was found in the Survey123 JS API. When the time question has the default value, and they want to change the value through the JS function, the value cannot be set correctly.

eriklharper commented 2 years ago

Thanks for reporting this and reproducing the issue! I am the original author of this component and have verified this locally. It appears to be caused by the internal calciteTimePickerChange event listener sending an incorrect time value back up to the input component. I can fix this by making the internal time-picker component respect direct value setting so that it doesn't interfere with direct value setting in the input component.

github-actions[bot] commented 2 years ago

Installed and assigned for verification.

geospatialem commented 2 years ago

Verified on next

change time fix verification