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

Fix for data validator with format #218

Merged
merged 1 commit into from
Jun 21, 2016

Conversation

patricklx
Copy link
Contributor

@patricklx patricklx commented Jun 21, 2016

The date validator is not working with format specified.
It always says invalid value.

It is first validated without the format, returns false, since Date() cannot parse it and then will return an error message and never tries with the format.
This fix skips the Date() check if format is specified
and fixes the data validator test to use a format that is not parsed by
Date()

@patricklx patricklx force-pushed the patch-1 branch 2 times, most recently from 605b11d to d6222f3 Compare June 21, 2016 11:04

if (!date.isValid()) {
return this.createErrorMessage('date', value, options);
let date;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you move this to the top of the function after let { before ... }

@offirgolan
Copy link
Collaborator

@patricklx thank you catching this! I made a couple comments, once they get resolved I will merge.

@patricklx patricklx force-pushed the patch-1 branch 2 times, most recently from f978a50 to 933a0de Compare June 21, 2016 16:02
The date validator is not working with format specified.
It always says invalid value.

It is first validated without the format, returns false, since Date() cannot parse it and then will return an error message and never tries with the format.

This commit skips the Date() check if format is specified
and fixes the data validator test to use a format that is not parsed by
Date()
@patricklx
Copy link
Contributor Author

done ;)

@offirgolan
Copy link
Collaborator

Perfect! Thanks again 😺

@offirgolan offirgolan merged commit 1c34cd8 into adopted-ember-addons:master Jun 21, 2016
offirgolan added a commit that referenced this pull request Jun 27, 2016
* master:
  [Feature] Warning Validators (#226)
  Evaluate attrs options hash (#223)
  chore(package): update ember-try to version 0.2.4 (#221)
  Fix for data validator with format (#218)
  chore(package): update ember-cli to version 2.6.2 (#217)
  chore(package): update ember-cli-moment-shim to version 2.0.0 (#216)
  chore(package): update ember-cli-blanket to version 0.9.5 (#214)
  Add import for getOwner to README example (#215)

# Conflicts:
#	addon/validations/result-collection.js
#	addon/validations/result.js
#	tests/integration/validations/factory-general-test.js
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

2 participants