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

bug: date objects arent handled #104

Closed
wants to merge 1 commit into from

Conversation

bricejlin
Copy link

Inputs aren't handling date objects correctly. The issue is in flattenObject method https://github.com/skaterdav85/validatorjs/blob/master/src/validator.js#L160

I found that you can add an additional check there current instanceof Date, which should fix it. Let me know if you want me to add that.

@iamdtang
Copy link
Collaborator

iamdtang commented Jul 8, 2016

@LKay, can you take a look since you worked on this? Thanks!

@LKay
Copy link
Contributor

LKay commented Jul 8, 2016

@garygreen Sure, I'll do it along with #102 probably tomorrow as today I'm fully booked.

@LKay LKay mentioned this pull request Jul 9, 2016
@iamdtang
Copy link
Collaborator

@LKay @bricejlin so is this already taken care of in #105 ?

@LKay
Copy link
Contributor

LKay commented Jul 10, 2016

It seems so. I added test for Date object and it is valid for both node and phantomjs tests. I tested it locally and seems correct too.

The only weird thing about date validation is that some browsers don't treat some formats as valid even though they should be valid by JS specification. I could use moment which seems to handle that fine, but I think this might be an overkill for just simple date validation.

@bricejlin bricejlin closed this Jul 11, 2016
@bricejlin bricejlin deleted the brice/date-bug branch July 11, 2016 14:14
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.

None yet

3 participants