balderdashy / sails

Realtime MVC Framework for Node.js
https://sailsjs.com
MIT License
22.81k stars 1.95k forks source link

Incorrect datetime value: '2022-06-23T05:26:54.000Z' for column 'createdAt' at row 1 #7230

Open msahidurr opened 2 years ago

msahidurr commented 2 years ago

Sails default controller method is good for working. But my question is: why sails didn't check the attributes user custom default value.

"dependencies": { "async": "2.1.4", "autoprefixer": "^7.2.6", "aws-sdk": "^2.1147.0", "babel-core": "^6.26.3", "babel-eslint": "^8.2.6", "babel-plugin-syntax-dynamic-import": "^6.18.0", "babel-plugin-transform-object-rest-spread": "^6.26.0", "babel-preset-env": "^1.7.0", "bcrypt": "^3.0.8", "bluebird": "^3.7.2", "compression": "^1.7.4", "cors": "^2.8.5", "cron": "^1.8.2", "crypto": "^1.0.1", "csv-stringify": "^5.6.5", "del": "^3.0.0", "dotenv": "^8.6.0", "ejs": "2.5.7", "eslint": "^4.19.1", "eslint-config-airbnb-base": "^12.1.0", "eslint-plugin-import": "^2.26.0", "gm": "^1.23.1", "helmet": "^3.23.3", "include-all": "~4.0.3", "jsonwebtoken": "^8.5.1", "knex": "^0.21.21", "lodash": "3.10.1", "mkdirp": "^0.5.6", "moment": "^2.29.3", "moment-timezone": "^0.5.34", "mysql": "^2.18.1", "newrelic": "^6.14.0", "pump": "^1.0.3", "puppeteer": "^1.20.0", "razorpay": "^1.7.1", "rc": "^1.2.8", "redis": "^2.8.0", "request": "^2.88.2", "run-sequence": "^2.2.1", "s3": "^4.4.0", "sails": "^1.0.0", "sails-disk": "^2.1.1", "sails-hook-grunt": "^1.0.8", "sails-hook-orm": "^2.1.1", "sails-hook-sockets": "^1.5.5", "sails-mongo": "^1.2.0", "sails-mysql": "^1.0.3", "sendgrid": "^5.2.3", "socket.io": "^2.4.1", "uglify-js": "^3.15.5", "uuid": "^3.4.0", "voucher-code-generator": "^1.3.0", "winston": "^3.7.2", "winston-cloudwatch": "^2.5.2", "response-time": "^2.0.0" },

{ name: "AdapterError", adapterMethodName: "update", modelIdentity: "doctorcategory",…} adapterMethodName: "update" modelIdentity: "doctorcategory" name: "AdapterError" raw: {code: "ER_TRUNCATED_WRONG_VALUE", errno: 1292,…} code: "ER_TRUNCATED_WRONG_VALUE" errno: 1292 index: 0 sql: "" sqlMessage: "Incorrect datetime value: '2022-06-23T05:26:54.000Z' for column 'createdAt' at row 1" sqlState: "22007" }

Model : attributes: { createdAt: { type: 'ref', columnType: 'datetime', defaultsTo: moment().format("YYYY-MM-DD HH:mm:ss"), }, updatedAt: { type: 'ref', columnType: 'datetime', defaultsTo: moment().format("YYYY-MM-DD HH:mm:ss"), }, },

sailsbot commented 2 years ago

@RingLives Thanks for posting! We'll take a look as soon as possible.

In the mean time, there are a few ways you can help speed things along:

Please remember: never post in a public forum if you believe you've found a genuine security vulnerability. Instead, disclose it responsibly.

For help with questions about Sails, click here.