react-timekeeper icon indicating copy to clipboard operation
react-timekeeper copied to clipboard

"Could not parse time for disabled time range"

Open LinKassem opened this issue 1 year ago • 0 comments

Just in case anyone is facing this error:

I was using new Date().getMinutes() to set the minutes in the disabledTimeRange object. So when the minutes returned were from 0 to 9 I would get the error "Could not parse time for disabled time range". I think it caused by the TIME_PARSE_24 regex. https://github.com/catc/react-timekeeper/blob/19e5569ec1c75496e79d2fe126035276e6a0b965/src/helpers/time.ts#L4-L5

I fixed it by padding the minutes by 0 if it's value is less than 10.

LinKassem avatar Jun 01 '23 07:06 LinKassem