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

Duration input with Cleave-zen #15

Open
MakingOff opened this issue May 16, 2024 · 1 comment
Open

Duration input with Cleave-zen #15

MakingOff opened this issue May 16, 2024 · 1 comment

Comments

@MakingOff
Copy link

Hey!

I'm in a situation where users must be able to input a duration in the following format: HH'h'MM, (47h30).
With HH between 0 and 99 and MM between 0 and 59 (like real minutes would be).
Obviously, I can't use formatTime, I'd only be able to get 23h max.
Nor can I use formatGeneral with blocks: [2, 2], because users could input more than 59 minutes.

So I'm wondering if there's a way to do this?
Or if something could be implemented to make this possible?

Thank you!

@wyozi
Copy link

wyozi commented Aug 11, 2024

This can be kind of supported with formatTime(value, { delimiters: ['h'], timePattern: ['x', 'm'], }) (and by ignorign the error)

I made a fork where this is explicitly supported with

formatTime(value, {
      delimiters: ['h'],
      timePattern: ['xx', 'm'], // number of x = number of digits
    })

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