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

Parsing fails for dddd HH:mm for hours 00 to 06. #545

Closed
ZachGawlik opened this issue Oct 11, 2017 · 0 comments
Closed

Parsing fails for dddd HH:mm for hours 00 to 06. #545

ZachGawlik opened this issue Oct 11, 2017 · 0 comments

Comments

@ZachGawlik
Copy link

ZachGawlik commented Oct 11, 2017

EDIT:

After briefly looking into the code, the invalid date is coming from moment.utc.apply(null, ['Tuesday 01:03', 'dddd HH:mm']);. I closed this ticket in favor of moment/moment#4227

Example statements

Either read below or see them in action on my JSFiddle. Note: the invalid date edge case seems to depend on your current system time, so they might not display as Invalid at all times.

Edge case errors. All statements below return invalid date.

moment.tz('Saturday 06:59', 'dddd HH:mm', 'America/New_York'); 
moment.tz('Tuesday 01:03', 'dddd HH:mm', 'America/New_York');
moment.tz('Tuesday 01:03', 'dddd HH:mm', 'America/Los_Angeles');

Times 07:00 and later as well as date strings without the day of week are parsed correctly. All statements below return valid dates.

moment.tz('Saturday 07:00', 'dddd HH:mm', 'America/New_York'); 
moment.tz('06:59', 'HH:mm', 'America/New_York');
moment.tz('December 01:03', 'MMMM HH:mm', 'America/New_York');

Moment without timezone returns a valid date.

moment('Saturday 06:59', 'dddd HH:mm')
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