balderdashy / balderdashy/sails

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

Open
#7,230 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
22.8k
Forks
1.9k
PR merge metrics
No merged PRs in 30d

Description

**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"), },
},**

Contributor guide

Open the contributing guide

Research direction

The report names a Sails model with custom createdAt and updatedAt defaults and shows a MySQL AdapterError from update. Start by reproducing the model update with the listed datetime value and determine whether the Sails ORM or MySQL adapter is responsible. Done should include a confirmed explanation and a verified fix or documentation of the supported datetime format.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, mysql, node.js
Domain
backend, databases
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.