Skip to content

Commit 7294b1e

Browse files
committed
Ensure date is not null when reading from database
Added an check for NULL when getting a date value from the database. This ensures that NULL values aren't being returned as Jan 1, 1970.
1 parent 70a5b36 commit 7294b1e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/sqlite3db.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -423,7 +423,7 @@ SQLiteDB.prototype.fromDatabase = function (model, data) {
423423
} else {
424424
json[p] = val;
425425
}
426-
} else if (prop && type === 'Date'){
426+
} else if (prop && (type === 'Date') && (val !== null)) {
427427
json[p] = new Date(val);
428428
} else {
429429
json[p] = val;

0 commit comments

Comments
 (0)