IssueRaiser

Improve Timezone Support for Existing MySQL Databases configured with a Non-UTC Timezone

<!-- Thanks for helping us improve Prisma! πŸ™ Please follow the sections in the template and provide as much information as possible about your problem, e.g. by setting the `DEBUG="*"` environment variable and enabling additional logging output in Prisma Client. Learn more about writing proper bug reports here: https://pris.ly/d/bug-reports --> ## Bug description <!-- A clear and concise description of what the bug is. --> The OS and MySQL time both are set to KST(Korea Standard Time) which is UTC+9:00. But when create or update records with `new Date()`, `DATETIME` string doesn't respect the database's timezone and always filled with UTC time. For example, when the current time is `2020-06-20 13:00:00` in **Korea**, I expect the data should be stored like below id | created_at :--:|:--: 1 | 2020-06-20 13:00:00 However, what I get is UTC time which differs -9 hours. id | created_at :--:|:--: 1 | 2020-06-20 04:00:00 ## How to reproduce <!-- Steps to reproduce the behavior: 1. Go to '...' 2. Change '....' 3. Run '....' 4. See error --> 1. Set the system and MySQL timezone to `Asia/Seoul` or `UTC+9:00` 2. Create with `new Date()` ```ts await prisma.myTable.create({ data: { createdAt: new Date() } }) ``` ## Expected behavior <!-- A clear and concise description of what you expected to happen. --> I expect the `DATETIME` string to be synced with MySQL's timezone. ## Prisma information <!-- Your Prisma schema, Prisma Client queries, ... Do not include you

Posted by jhaemin on Jun 20, 2020, 11:13 AM

Tags

Related issues

Raise real-world problems, find people facing the same issue, and discuss solutions.3,500 issues0 comments

support (Other)

Improve Timezone Support for Existing MySQL Databases configured with a Non-UTC Timezone

jhaeminJun 20, 2020, 11:13 AM

<!-- Thanks for helping us improve Prisma! πŸ™ Please follow the sections in the template and provide as much information as possible about your problem, e.g. by setting the `DEBUG="*"` environment variable and enabling additional logging output in Prisma Client. Learn more about writing proper bug reports here: https://pris.ly/d/bug-reports --> ## Bug description <!-- A clear and concise description of what the bug is. --> The OS and MySQL time both are set to KST(Korea Standard Time) which is UTC+9:00. But when create or update records with `new Date()`, `DATETIME` string doesn't respect the database's timezone and always filled with UTC time. For example, when the current time is `2020-06-20 13:00:00` in **Korea**, I expect the data should be stored like below id | created_at :--:|:--: 1 | 2020-06-20 13:00:00 However, what I get is UTC time which differs -9 hours. id | created_at :--:|:--: 1 | 2020-06-20 04:00:00 ## How to reproduce <!-- Steps to reproduce the behavior: 1. Go to '...' 2. Change '....' 3. Run '....' 4. See error --> 1. Set the system and MySQL timezone to `Asia/Seoul` or `UTC+9:00` 2. Create with `new Date()` ```ts await prisma.myTable.create({ data: { createdAt: new Date() } }) ``` ## Expected behavior <!-- A clear and concise description of what you expected to happen. --> I expect the `DATETIME` string to be synced with MySQL's timezone. ## Prisma information <!-- Your Prisma schema, Prisma Client queries, ... Do not include you

Comments (0)

No comments yet. Start the discussion.

Comment on this issue