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

"Could not parse time for disabled time range" #113

Open
LinKassem opened this issue Jun 1, 2023 · 0 comments
Open

"Could not parse time for disabled time range" #113

LinKassem opened this issue Jun 1, 2023 · 0 comments

Comments

@LinKassem
Copy link

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.

const TIME_PARSE_MERIDIEM = new RegExp(/^(\d{1,2}?):(\d{2}?)\s?(am|pm)$/i)
export const TIME_PARSE_24 = new RegExp(/^(\d{1,2}?):(\d{2}?)$/)

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

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

1 participant