We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent d0a88ef commit cee6303Copy full SHA for cee6303
lib/mysql.js
@@ -352,6 +352,9 @@ MySQL.prototype.toColumnValue = function(prop, val) {
352
}
353
return val;
354
355
+ if (prop.type.name === 'DateString') {
356
+ return val.when;
357
+ }
358
if (prop.type === Boolean) {
359
return !!val;
360
@@ -405,11 +408,11 @@ MySQL.prototype.fromColumnValue = function(prop, val) {
405
408
val = String(val);
406
409
break;
407
410
case 'Date':
-
411
+ case 'DateString':
412
// MySQL allows, unless NO_ZERO_DATE is set, dummy date/time entries
413
// new Date() will return Invalid Date for those, so we need to handle
414
// those separate.
- if (val == '0000-00-00 00:00:00') {
415
+ if (!val || val == '0000-00-00 00:00:00' || val == '0000-00-00') {
416
val = null;
417
418
0 commit comments