Merge pull request #40 from bergie/master

MySQL reliability fix: date values may be null
This commit is contained in:
1602 2012-03-01 08:13:14 -08:00
commit bc36089eb1
1 changed files with 1 additions and 1 deletions

View File

@ -130,7 +130,7 @@ MySQL.prototype.fromDatabase = function (model, data) {
Object.keys(data).forEach(function (key) {
var val = data[key];
if (props[key]) {
if (props[key].type.name === 'Date') {
if (props[key].type.name === 'Date' && val !== null) {
val = new Date(val.toString().replace(/GMT.*$/, 'GMT'));
}
}