Tradeshift / tradeshift-ui

Tradeshift UI is a framework-agnostic JavaScript library to help Tradeshift App developers to create cohesive user experiences and to provide reusable UI components.
https://ui.tradeshift.com
Other
33 stars 44 forks source link

DatePicker fails to display date when source/input date not as expected #232

Closed tolrodco closed 7 years ago

tolrodco commented 7 years ago

Bug report

DatePicker will log warnings when the source date is not in the expected format (YYYY-MM-DD). For localization to the frontend this can be an minor annoyance where a warning is sent to the console. If the sourced input date isn't in the required format it will not display the date value, but instead present a blank field to the user--this also occurs after the user has selected a date from the picker.

Tradeshift UI version affected

v7.1.0

Expected Behavior

DatePicker should not care about the resulting/sourced format, but of what is set as the requested format to be displayed on the frontend -- processing the valid sourced date to the expected format.

Actual Behavior

If the source/display value aren't the expected format in the current iteration (YYYY-MM-DD) the user selected or original sourced date will not display in the input field. User selected date will momentarily display, and, will then display a blank field.

Steps to reproduce

Have a source or selected date be other than YYYY-MM-DD for an input value, the UI should respond with a "flash" of data then result in an empty field. The value of the field will still be valid but will not display it in the format that you have set as expected.

wiredearp commented 7 years ago

I believe that this mimics the behavior of the HTML5 native <input type="date'/> that the UI component is indeed supposed to mimic. So the issue is really not that the UI component should accept any kind of date format on the HTML and JS level, but that we should localize this universal (ISO standard) format to the users specific language when we render the final UI (noting that this is actually not possible with a HTML5 native <input type="date'/>). So I've changed the label from bug to enhancement. If @tolrodco can agree to this, I think we can close this issue since it appears to duplicate https://github.com/Tradeshift/tradeshift-ui/issues/64.

tolrodco commented 7 years ago

Agreed. 👍