-
Notifications
You must be signed in to change notification settings - Fork 27.5k
fix(input): Take timezone into account when validating minimum and ma… #16390
fix(input): Take timezone into account when validating minimum and ma… #16390
Conversation
0079b78
to
5fb8d31
Compare
…ximum date spans. Closes angular#16342 Closes angular#16390
5fb8d31
to
ccdb700
Compare
…ximum date spans. Closes angular#16342 Closes angular#16390
ccdb700
to
a0861ea
Compare
…ximum date spans Closes angular#16342 Closes angular#16390
a0861ea
to
8b9af1f
Compare
…ximum date spans Closes angular#16342 Closes angular#16390
8b9af1f
to
66a8a8e
Compare
…ximum date spans Closes angular#16342 Closes angular#16390
66a8a8e
to
e5401c9
Compare
…ximum date spans Closes angular#16342 Closes angular#16390
e5401c9
to
58fd32a
Compare
…ximum date spans Closes angular#16342 Closes angular#16390
58fd32a
to
91418cc
Compare
…ximum date spans Closes angular#16342 Closes angular#16390
91418cc
to
e1f150c
Compare
…ximum date spans Closes angular#16342 Closes angular#16390
e1f150c
to
76355f1
Compare
…ximum date spans Closes angular#16342 Closes angular#16390
76355f1
to
f4decfb
Compare
…ximum date spans Closes angular#16342 Closes angular#16390
f4decfb
to
38cda5f
Compare
…ximum date spans Closes angular#16342 Closes angular#16390
38cda5f
to
483c123
Compare
…ximum date spans Closes angular#16342 Closes angular#16390
483c123
to
cf071f8
Compare
…ximum date spans Closes angular#16342 Closes angular#16390
cf071f8
to
8d9f9cb
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good at first glance.
The tests need some love, however.
In inputSpec, we have a min
and a max
suite for every type of date input (month, week, date etc), so the we need 2 tests (min +max) for each of them.
Please also note the change request on the test you've already added - this must go into each of the tests that need to be added.
test/ng/directive/inputSpec.js
Outdated
@@ -840,6 +840,16 @@ describe('input', function() { | |||
|
|||
expect($rootScope.form.alias.$error.max).toBeFalsy(); | |||
}); | |||
|
|||
it('should validate when timezone is provided.', function() { | |||
inputElm = helper.compileInput('<input type="date" ng-model="value" name="alias" ' + |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since you are only testing max
, please remove min
here
test/ng/directive/inputSpec.js
Outdated
$rootScope.$digest(); | ||
|
||
expect($rootScope.form.alias.$error.max).toBeFalsy(); | ||
expect($rootScope.form.alias.$valid).toBeTruthy(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There should be am expectation after this that checks whether the validation also works when the input is updated. You might have to clear the model for that first.
src/ng/directive/input.js
Outdated
} | ||
|
||
function parseDateAndConvertTimeZoneToLocal(value, previousDate) { | ||
var parsedDate = previousDate ? parseDate(value, previousDate) : parseDate(value); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not simply = parseDate(value, previousDate)
? If the previousDate is undefined, it's not used.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They are same but they only different in case you check arguments
function parse(a, b){
console.log(arguments.length)
}
parse(1) // it will log 1
parse(1, undefined) //it will log 2
if someone in the future decide do something depend on the arguments.length it will not be the same.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I doubt this will happen. Even more so as this is an internal API. Our tests should also catch any problems this might cause.
@m-amr are you still working on this? |
@Narretz yes, i am working on it. i will add the missing tests by this week-end. |
32d76dd
to
ee5a110
Compare
…ximum date spans Closes angular#16342 Closes angular#16390
Hi @m-amr , sorry for the delay, I didn't get a notification when you updated the PR. |
Hi @Narretz , |
ee5a110
to
06709f9
Compare
…ximum date spans Closes angular#16342 Closes angular#16390
So there's good news and bad news. 👍 The good news is that everyone that needs to sign a CLA (the pull request submitter and all commit authors) have done so. Everything is all good there. 😕 The bad news is that it appears that one or more commits were authored or co-authored by someone other than the pull request submitter. We need to confirm that all authors are ok with their commits being contributed to this project. Please have them confirm that here in the pull request. Note to project maintainer: This is a terminal state, meaning the |
1 similar comment
So there's good news and bad news. 👍 The good news is that everyone that needs to sign a CLA (the pull request submitter and all commit authors) have done so. Everything is all good there. 😕 The bad news is that it appears that one or more commits were authored or co-authored by someone other than the pull request submitter. We need to confirm that all authors are ok with their commits being contributed to this project. Please have them confirm that here in the pull request. Note to project maintainer: This is a terminal state, meaning the |
@Narretz Can you please review the PR again and tell me if anything is missing or need to change ? |
@m-amr I think I mentioned earlier that the test was not working as intended, but that's okay. |
…ximum date spans Closes angular#16342 Closes angular#16390
4c75421
to
08604c0
Compare
Finally merged, thanks @m-amr |
…ximum date spans.
What kind of change does this PR introduce? (Bug fix, feature, docs update, ...)
Bug fix
What is the current behavior? (You can also link to an open issue here)
All details in issue for Issue #16342
What is the new behavior (if this is a feature change)?
All details in issue for Issue #16342
Does this PR introduce a breaking change?
no
Please check if the PR fulfills these requirements
Other information: