Fix NaN-NaN... in dates

This commit is contained in:
Anatoliy Chakkaev 2011-11-12 19:04:07 +07:00
parent fc99247390
commit 2e1cb45f01
2 changed files with 1 additions and 1 deletions

View File

@ -308,7 +308,6 @@ AbstractClass.prototype.propertyChanged = function (attr) {
return this['_' + attr] !== this[attr + '_was'];
};
AbstractClass.prototype.reload = function (cb) {
this.constructor.find(this.id, cb);
};

View File

@ -76,6 +76,7 @@ MySQL.prototype.toDatabase = function (prop, val) {
if (prop.type.name === 'Number') return val;
if (val === null) return 'NULL';
if (prop.type.name === 'Date') {
if (!val) return 'NULL';
if (!val.toUTCString) {
val = new Date(val);
}