arqex / arqex/react-datetime

Not able to edit Milliseconds field in the widget, able to edit in input field however.

Open
#485 2 comments 1 reaction 0 assignees View on GitHub
Dominant language
JavaScript
Stars
2k
Forks
858
PR merge metrics
No merged PRs in 30d

Description

### I'm Submitting a ...

```
[x ] Bug report
[ ] Feature request
[ ] Support request
```

### Steps to Reproduce

1. Create a DateTime component with custom timeFormat which includes milliseconds.
``
2. Try updating millisecond values from the widget. It does not allow updating. However, you can update from the input element.

### Expected Results

Milliseconds field should be updatable.

### Actual Results

Unable to update Milliseconds field.

### Minimal Reproduction of the Problem

https://codepen.io/anon/pen/LePeqO

### Other Information (e.g. stacktraces, related issues, suggestions how to fix)

From what I have seen in the code the issue originates in src/TimeView.js `updateMilli` function. The first part of `if` condition is never going to be true as it compares types as well, which are number & string respectively.
We can probably change `if ( milli === e.target.value && milli >= 0 && milli < 1000 ) {` to `if ( milli === +e.target.value && milli >= 0 && milli < 1000 ) {` with exception checks, but I am not sure of the use of the first part of this if condition.
I can create a PR if you think this is a good solution.

Contributor guide

Open the contributing guide

Research direction

Reproduce the issue using the CodePen example with a DateTime component configured with timeFormat="HH:mm:ss:SSS". Read src/TimeView.js, focusing on updateMilli and its value comparison; the work is done when milliseconds can be edited through the widget as well as the input field.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, react
Domain
frontend
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.