-
-
Notifications
You must be signed in to change notification settings - Fork 627
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
timezone pain #642
Comments
typeCast does work in pool. Are you using .execute? typeCast seems only to work currently with .query as mentioned in #649 |
You're probably right about that. In the meantime I've switched back to https://github.com/mysqljs/mysql I'm using the timezone settings shown below: let config = {
// ...
timezone: 'UTC', // Interpret all received timestamps as UTC. Otherwise local timezone is assumed.
dateStrings: [
'DATE', // DATE's are returned as strings (otherwise they would be interpreted as YYYY-MM-DD 00:00:00+00:00)
'DATETIME' // DATETIME's return as strings (otherwise they would interpreted as YYYY-MM-DD HH:mm:ss+00:00)
]
};
let pool = mysql.createPool(config);
pool.on('connection', conn => {
conn.query("SET time_zone='+00:00';", error => {
if(error){
throw error;
}
});
}); These settings work no matter what the client/server timezones are. |
I didn't notice this was fixed until now. Just wanted to say, thanks for fixing it! |
The timezone option does not appear to do anything. If this package is supposed to be a dropin replacement for node-mysql, why isn't this at least mentioned somewhere? I've seen a few attempts at using the typeCast function instead, but this function doesn't work with pool (at least when I tried it). Are you planning on adding any of these soon?
The reason I need these is because my node application and the mysql server are running on different timezones, and I don't know what they are beforehand.
The text was updated successfully, but these errors were encountered: