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

refactor date parsing to validate months outside 1-12 range #71

Closed
wants to merge 6 commits into from

Conversation

ForestJohnson
Copy link

@ForestJohnson ForestJohnson commented Jan 3, 2020

Fixes #70

Code pulled from bwendt-mylo@f59b34a

all tests passing

@ForestJohnson
Copy link
Author

ForestJohnson commented Jan 3, 2020

The logic that compares teh two dateInfos (from bwendt-mylo@f59b34a) was flawed because it would fail on dates that have time zone offsets due to the way that fecha / JS standard library handles time zones. So i replaced it with

  if(dateInfo.day != null && dateInfo.day < 1 || dateInfo.day > 32) {
    return false;
  }
  if(dateInfo.month != null && dateInfo.month < 0 || dateInfo.month > 11) {
    return false;
  }
  return true;

which is the simplest shortest way of achieving my goal.

@taylorhakes
Copy link
Owner

I have fixed this issue in this PR #72

@ForestJohnson
Copy link
Author

💯

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

Successfully merging this pull request may close these issues.

The 31st month is considered valid and injested by adding years
2 participants