Skip to content

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

@LinKassem

Description

@LinKassem

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions