[TextField] type="time" does not render 00 seconds
See original GitHub issueDuplicates
- I have searched the existing issues
Latest version
- I have tested the latest version
Current behavior 😯
When a value of ‘00:00:00’ is passed to <TextField type='time'/>, the seconds are not rendered.
The seconds are rendered for ‘00:00:01’
Expected behavior 🤔
Seconds selector is rendered for <TextField type=‘time’ value={‘00:00:00’}/>
Steps to reproduce 🕹
Steps:
- Import TextField component
- Render TextFieldwith props: value=‘00:00:00’, type=‘time’
- Observe that the TextFieldwith picker is not rendered
code sand box: https://codesandbox.io/s/mui-time-textfield-pg2pqn?file=/src/App.js
Context 🔦
I am creating an application to manage GTFS data. The specification requires that stop times be given in the form hh:mm:ss In one of the forms I would like the starting value for the stop time to be 00:00:00. The TextField component does not render the seconds part of the string. What makes matters worse is that when a value is selected the value changes to hh:mm, which does not conform to the GTFS specification.
Your environment 🌎
`npx @mui/envinfo`
Don't forget to mention which browser you used.
Output from `npx @mui/envinfo` goes here.
Issue Analytics
- State:
- Created a year ago
- Comments:8 (6 by maintainers)
Top Results From Across the Web
Remove seconds in Chrome input=time - Stack Overflow
Finally, I am including a screenshot of how Chrome 23.0.1271.64 m renders the different time formats (on my machine); <input type="time" value="23:20:50.52" ...
Read more ><input type="time"> - HTML: HyperText Markup Language | MDN
<input> elements of type time create input fields designed to let the user easily enter a time (hours and minutes, and optionally seconds)....
Read more >Input Types for HTML Forms - W3docs
If the user's browser doesn't support range, it will fall back and show it as text input. To show the level, use the...
Read more >Date and Time Input / Output - Snowflake Documentation
The sign prevents ambiguity when the fractional seconds or the time zone offset does not contain the maximum number of allowable digits. For...
Read more >input (type=time) element - HTML Quick
If you don't know what an element is or how you must use it, ... pick an hour between 12:00 and 16:00 and...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@abhinav-22-tech
Hey, sure, no problem 👍
Ref: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#attr-step
Yes, it indeed doesn’t seem like a bug.
In the API doc of TextField, we provide the link for the possible attributes of the input element, so I think this was more of a support question in fact. I added the relevant label.
Here is a working solution: https://codesandbox.io/s/mui-time-textfield-forked-01dk6i?file=/src/App.js