node-mysql2
node-mysql2 copied to clipboard
Timezone setting is not sure
Hi I'm use a mysql2 at my express server. and I want to set timezone. first I set mysql2 connection configuration like this
{
host: "dev_db_container",
user: process.env.DB_USER,
password: process.env.DB_PASS,
port: process.env.DB_PORT,
database: process.env.DB_TEST_NAME,
timezone: 'Asia/Seoul',
charset: "utf8mb4"
}
It works for this project. but I can't use unit test because when I connect mysql2 shows this line
Ignoring invalid timezone passed to Connection: Asia/Seoul. This is currently a warning, but in future versions of MySQL2, an error will be thrown if you pass an invalid configuration option to a Connection
So, I modified configuration code like this
{
host: "dev_db_container",
user: process.env.DB_USER,
password: process.env.DB_PASS,
port: process.env.DB_PORT,
database: process.env.DB_TEST_NAME,
timezone: '+09:00',
charset: "utf8mb4"
}
but this setting is not return datetime on kst. How can I fix it? Or remove timezone setting and I adjust it?
I encountered the same situation and set timezone in the connection parameters, but it didn't work.
Same here. However, after changing the timezone of my DB(in my case, I'm using Docker MariaDB Container) through the command SET GLOBAL time_zone = 'Asia/Seoul'
, my server returned time on kst. But there is still no change when modifying the timezone
option.