Skip to content

Conversation

tarjei
Copy link

@tarjei tarjei commented Oct 7, 2019

This is with the formatTimeItem implementation above:

ft = value =>  `00${value || ''}`.substr(-2, 2)
> ft(0)
'00'
> ft(1)
'01'
> ft(18)
'18'
> ft(60)
'60'
> ft(59)
'59'
> 

This is with the old one:

ft = value =>  `${value || ''}00`.substr(0, 2)
[Function: ft]
> ft(59)
'59'
> ft(1)
'10'
> ft(18)
'18'
> ft(8)
'80'

tarjei added 2 commits October 7, 2019 15:55
This is with the formatTimeItem implementation above: 
```
ft = value =>  `00${value || ''}`.substr(-2, 2)
> ft(0)
'00'
> ft(1)
'01'
> ft(18)
'18'
> ft(60)
'60'
> ft(59)
'59'
> 
```

This is with the old one:

```
ft = value =>  `${value || ''}00`.substr(0, 2)
[Function: ft]
> ft(59)
'59'
> ft(1)
'10'
> ft(18)
'18'
> ft(8)
'80'
```


```
@coveralls
Copy link

Coverage Status

Coverage increased (+0.3%) to 95.288% when pulling 8da6c54 on tarjei:patch-1 into 5cbd7ae on antonfisher:master.

@antonfisher
Copy link
Owner

Hi, Tarjei! As I see it, this is the expected behavior, did you have a chance to reproduce the bug on the demo page: https://antonfisher.com/react-simple-timefield/?

@tarjei
Copy link
Author

tarjei commented Oct 13, 2019

Yes. Try to move your cursor to the front of the input and type a number betewwn 3 and 9. Nothing happens :) That is what I was trying to do something with.

Regards,
Tarjei

@antonfisher
Copy link
Owner

Allowing numbers between 3 and 9 on the first cursor position would lead to invalid time. Why would you want to be able to type them there? They are restricted by design there :)

@tarjei
Copy link
Author

tarjei commented Oct 15, 2019

Seen from a users perspective, typing a 3 in the first field does not create a change. A non-technical user does not realize that he needs to type a zero first. Therefore it is usefull to just default to something that is usefull.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants