date string parse bug
See original GitHub issueconst mysql = require('mysql2/promise');
mysql.createConnection({
host: '127.0.0.1',
user: 'app',
password: 'password',
database: 'app',
}).then((conn) => {
conn.query('SELECT DATE(?) AS `date_field`', ['2019-08-30']).then(([result]) => {
console.log(result);
}).then(() => {
return conn.close();
})
});
Date object show 2019-08-29
but date string is 2019-08-30
node version: v10.17.0 mysql2 version: 2.0.2
Issue Analytics
- State:
- Created 4 years ago
- Comments:12 (4 by maintainers)
Top Results From Across the Web
Error parsing date string with `new Date` - javascript
Your date string (whatever it is "31-08-2016" ) isn't in a format recognized by the Date constructor. So you ended up with a...
Read more >Error parsing date string when trying to copy one
Solved: I've put in a place an automatic rule that where a date custom field takes (start date) the value of another date...
Read more >Parse error: Invalid digit in the date string
This error indicates that the Destination IMAP system rejected an item because of an invalid date. When creating items at the Destination using ......
Read more >Error Parsing String with String to Date&Time
I've just updated to Knime v.4.5 and I got a parse error with a workflow that I ... I get the message “Execute...
Read more >Date.parse() - JavaScript - MDN Web Docs
The Date.parse() method parses a string representation of a date, and returns the number of milliseconds since January 1, 1970, 00:00:00 UTC or...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
dateStrings: true
connection option able to use to workaroundthe server returns “2019-08-30” string to us, and this library tries it’s best to convert that into
Date
objectif you don’t pass tz, it’s using “local” timezone - https://github.com/sidorares/node-mysql2/blob/a0ea513b0d4929e6ee61639a09f38a85ac01f7fa/lib/packets/packet.js#L611