Fix the regression for date conversion
This commit is contained in:
parent
014e91ea0c
commit
eb20eebe95
|
@ -1173,7 +1173,7 @@ DataAccessObject._coerce = function (where) {
|
|||
break;
|
||||
}
|
||||
}
|
||||
} else
|
||||
}
|
||||
// Coerce the array items
|
||||
if (Array.isArray(val)) {
|
||||
for (var i = 0; i < val.length; i++) {
|
||||
|
|
|
@ -270,6 +270,15 @@ describe('Memory connector', function() {
|
|||
});
|
||||
});
|
||||
|
||||
it('should successfully extract 2 users using date range', function(done) {
|
||||
User.find({where: {birthday: {between:
|
||||
[new Date(1940, 0).toISOString(), new Date(1990, 0).toISOString()]}}},
|
||||
function(err, users) {
|
||||
should(users.length).be.equal(2);
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
it('should successfully extract 0 user from the db', function(done) {
|
||||
User.find({where: {birthday: {between: [new Date(1990,0), Date.now()]}}},
|
||||
function(err, users) {
|
||||
|
@ -278,6 +287,14 @@ describe('Memory connector', function() {
|
|||
});
|
||||
});
|
||||
|
||||
it('should count using date string', function(done) {
|
||||
User.count({birthday: {lt: new Date(1990,0).toISOString()}},
|
||||
function(err, count) {
|
||||
should(count).be.equal(2);
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
it('should support order with multiple fields', function(done) {
|
||||
User.find({order: 'vip ASC, seq DESC'}, function(err, posts) {
|
||||
should.not.exist(err);
|
||||
|
|
Loading…
Reference in New Issue