diff --git a/lib/model.js b/lib/model.js index cca7af7..7bca16b 100644 --- a/lib/model.js +++ b/lib/model.js @@ -109,7 +109,7 @@ function deepCopy (obj) { typeof obj === 'number' || typeof obj === 'string' || obj === null || - (obj && obj.constructor && obj.constructor.name === 'Date') ) { + (util.isDate(obj)) ) { return obj; } diff --git a/test/model.test.js b/test/model.test.js index 93b3083..167a0ed 100644 --- a/test/model.test.js +++ b/test/model.test.js @@ -3,6 +3,7 @@ var model = require('../lib/model') , assert = require('chai').assert , _ = require('underscore') , async = require('async') + , util = require('util') ; @@ -79,7 +80,7 @@ describe('Model', function () { b = model.serialize(a); c = model.deserialize(b); b.indexOf('\n').should.equal(-1); - c.test.constructor.name.should.equal('Date'); + util.isDate(c.test).should.equal(true); c.test.getTime().should.equal(d.getTime()); });