Skip to content

Time format is too opinionated; Timezone offset and seconds are necessary #71

@shashank1010

Description

@shashank1010

I created a playground to test matchTime RegExp I found at here

https://regex101.com/r/CKXTQt/2
As you can see, it only treats a time string valid if it contains seconds and a timezone offset.

I'm using <input type="time" /> for a time/duration input; and the library treats the data input invalid.
It always only gives me hh:mm:ss OR hh:mm depending on how i've configured my input field (local time)

I also took the liberty to modified the RegExp that works for both hh:mm and hh:mm:ss, along with time timezone offset (z | +00:00) formats.
https://regex101.com/r/u0mN8x/1

The two are also equally performant.

I created a pull request #70 for you to review.

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