Change format date from ISO-8601 to "YYYY-MM-DD HH:mm:ss" for save in database without ER_TRUNCATED_WRONG_VALUE error
This commit is contained in:
parent
2f427a67dd
commit
02d2b215f2
2 changed files with 3 additions and 7 deletions
|
@ -19,11 +19,7 @@ const knex = require('knex')({
|
|||
},
|
||||
pool: {
|
||||
min: 2,
|
||||
max: 10,
|
||||
afterCreate: function(conn, cb) {
|
||||
conn.query('SET sql_mode="ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION";', function (err) {
|
||||
cb(err, conn);
|
||||
});
|
||||
max: 10
|
||||
}
|
||||
},
|
||||
migrations: {
|
||||
|
|
|
@ -62,7 +62,7 @@ fieldTypes.date = {
|
|||
afterJSON: (groupedField, entity) => {
|
||||
const key = getFieldColumn(groupedField);
|
||||
if (key in entity) {
|
||||
entity[key] = entity[key] ? moment(entity[key]).toISOString() : null;
|
||||
entity[key] = entity[key] ? moment(entity[key]).utc().format("YYYY-MM-DD HH:mm:ss") : null;
|
||||
}
|
||||
},
|
||||
listRender: (groupedField, value) => formatDate(groupedField.settings.dateFormat, value)
|
||||
|
@ -72,7 +72,7 @@ fieldTypes.birthday = {
|
|||
afterJSON: (groupedField, entity) => {
|
||||
const key = getFieldColumn(groupedField);
|
||||
if (key in entity) {
|
||||
entity[key] = entity[key] ? moment(entity[key]).toISOString() : null;
|
||||
entity[key] = entity[key] ? moment(entity[key]).utc().format("YYYY-MM-DD HH:mm:ss") : null;
|
||||
}
|
||||
},
|
||||
listRender: (groupedField, value) => formatBirthday(groupedField.settings.dateFormat, value)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue