mirror of
https://github.com/Hopiu/angular.js.git
synced 2026-03-21 17:00:24 +00:00
bug(equals): incorect comparison of dates
This commit is contained in:
parent
5d8528cc2e
commit
ffa8441886
2 changed files with 9 additions and 0 deletions
|
|
@ -671,6 +671,8 @@ function equals(o1, o2) {
|
|||
}
|
||||
return true;
|
||||
}
|
||||
} else if (isDate(o1)) {
|
||||
return isDate(o2) && o1.getTime() == o2.getTime();
|
||||
} else {
|
||||
if (isScope(o1) || isScope(o2) || isWindow(o1) || isWindow(o2)) return false;
|
||||
keySet = {};
|
||||
|
|
|
|||
|
|
@ -168,6 +168,13 @@ describe('angular', function() {
|
|||
expect(equals(window, window.parent)).toBe(false);
|
||||
expect(equals(window, undefined)).toBe(false);
|
||||
});
|
||||
|
||||
it('should compare dates', function() {
|
||||
expect(equals(new Date(0), new Date(0))).toBe(true);
|
||||
expect(equals(new Date(0), new Date(1))).toBe(false);
|
||||
expect(equals(new Date(0), 0)).toBe(false);
|
||||
expect(equals(0, new Date(0))).toBe(false);
|
||||
});
|
||||
});
|
||||
|
||||
describe('size', function() {
|
||||
|
|
|
|||
Loading…
Reference in a new issue