Add new type DateString to fromColumnValue

To sync with loopback-datasource-juggler #1356
which introduces new Type: DateString
This commit is contained in:
Buck Bito 2017-04-27 11:30:00 -07:00 committed by Kevin Delisle
parent d0a88ef045
commit cee6303454
1 changed files with 5 additions and 2 deletions

View File

@ -352,6 +352,9 @@ MySQL.prototype.toColumnValue = function(prop, val) {
}
return val;
}
if (prop.type.name === 'DateString') {
return val.when;
}
if (prop.type === Boolean) {
return !!val;
}
@ -405,11 +408,11 @@ MySQL.prototype.fromColumnValue = function(prop, val) {
val = String(val);
break;
case 'Date':
case 'DateString':
// MySQL allows, unless NO_ZERO_DATE is set, dummy date/time entries
// new Date() will return Invalid Date for those, so we need to handle
// those separate.
if (val == '0000-00-00 00:00:00') {
if (!val || val == '0000-00-00 00:00:00' || val == '0000-00-00') {
val = null;
}
break;