cleave-zen
cleave-zen copied to clipboard
Duration input with Cleave-zen
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!
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
})