Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Leading '0' when 24hour format set #391

Open
leetoufong opened this issue Aug 11, 2020 · 2 comments
Open

Leading '0' when 24hour format set #391

leetoufong opened this issue Aug 11, 2020 · 2 comments

Comments

@leetoufong
Copy link

leetoufong commented Aug 11, 2020

Hi I understand that this plugin is no longer being maintained but wondering if someone could help me with an issue. I want the input to operate as close to type="time" as possible. I am wanting there to be a leading 0 when there is a singular integer hour. Setting the defaultTime or setTime options also do not work.

For example 1 through 9 hours should display as 01 or 09.

Please see this codepen: https://codepen.io/leetoufong/pen/LYGKbKR?editors=1010
The expected result I need: 01:45:12
What is actually displaying on the input: 1:45:12
When logging the value, the return value is: 1:45:12
When manually typing a 0 then a 1, the hour value reverts back to: 1:45:12

Furthermore, this will adhere to standard ISO 24 hour time format.

@leetoufong
Copy link
Author

leetoufong commented Aug 11, 2020

My other issue is that I need to utilize the placeholder attribute but it seems buggy. Once a user places in a value, it goes away and never comes back until they "fully" highlight hours minutes and seconds and then delete. If they halfway fill out (for example leaving minutes empty), the value will revert to 0:00:00 once you blur out. The expected result would be that it would revert back to the HH:mm:ss placeholder.

The workaround ask would be to have the default value a HH:mm:ss string. If the user partially fills out or deletes, then it will revert back to HH:mm:ss not 0:00:00. Please see this codepen: https://codepen.io/leetoufong/pen/LYGKbKR?editors=1010 for reference

@rwx666888
Copy link

Edit the source file, search for (1? '0'), do not contain "()", you can find 4 results;
turn up:
this.hour
change into:
this.hour.toString().length === 1? '0' + this.hour: this.hour

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

No branches or pull requests

2 participants