diff --git a/knexfile.js b/knexfile.js index 7cc8d093..0a4f0a43 100644 --- a/knexfile.js +++ b/knexfile.js @@ -17,7 +17,8 @@ module.exports = { dateStrings: true, typeCast(field, next) { if (field.type === 'DATETIME') { - return moment(field.string()).format('YYYY-MM-DD HH:mm:ss'); + const val = field.string(); + return val != null ? moment(val).format('YYYY-MM-DD HH:mm:ss') : null; } return next();