不要怂,就是干,撸起袖子干!

Commit f2eca756 by Sascha Depold

Merge branch 'fixIssue494' of git://github.com/solotimes/sequelize into solotimes-fixIssue494

2 parents ecd3de33 e9113f35
Showing with 17 additions and 1 deletions
......@@ -287,7 +287,10 @@ module.exports = (function() {
, self = this
Utils._.each(this.values, function(value, key) {
result = result && (value == other[key])
if(Utils._.isDate(value) && Utils._.isDate(other[key]))
result = result && (value.getTime() == other[key].getTime())
else
result = result && (value == other[key])
})
return result
......
......@@ -409,4 +409,17 @@ describe(Helpers.getTestDialectTeaser("DAO"), function() {
}.bind(this))
})
})
describe('equals', function find() {
it("can compare records with Date field", function(done) {
this.User.create({ username: 'fnord' }).success(function(user1) {
var query = { where: { username: 'fnord' }}
this.User.find(query).success(function(user2) {
expect(user1.equals(user2)).toEqual(true)
done()
}.bind(this))
}.bind(this))
})
})
})
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!