Add new type DateString to fromColumnValue
To sync with loopback-datasource-juggler #1356 which introduces new Type: DateString
This commit is contained in:
parent
d0a88ef045
commit
cee6303454
|
@ -352,6 +352,9 @@ MySQL.prototype.toColumnValue = function(prop, val) {
|
||||||
}
|
}
|
||||||
return val;
|
return val;
|
||||||
}
|
}
|
||||||
|
if (prop.type.name === 'DateString') {
|
||||||
|
return val.when;
|
||||||
|
}
|
||||||
if (prop.type === Boolean) {
|
if (prop.type === Boolean) {
|
||||||
return !!val;
|
return !!val;
|
||||||
}
|
}
|
||||||
|
@ -405,11 +408,11 @@ MySQL.prototype.fromColumnValue = function(prop, val) {
|
||||||
val = String(val);
|
val = String(val);
|
||||||
break;
|
break;
|
||||||
case 'Date':
|
case 'Date':
|
||||||
|
case 'DateString':
|
||||||
// MySQL allows, unless NO_ZERO_DATE is set, dummy date/time entries
|
// 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
|
// new Date() will return Invalid Date for those, so we need to handle
|
||||||
// those separate.
|
// 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;
|
val = null;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in New Issue