aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/Angular.js2
-rw-r--r--test/AngularSpec.js7
2 files changed, 9 insertions, 0 deletions
diff --git a/src/Angular.js b/src/Angular.js
index 65610869..87c10e23 100644
--- a/src/Angular.js
+++ b/src/Angular.js
@@ -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 = {};
diff --git a/test/AngularSpec.js b/test/AngularSpec.js
index 10f5fd2a..9d7bda94 100644
--- a/test/AngularSpec.js
+++ b/test/AngularSpec.js
@@ -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() {