may i know is the feature to convert date to UTC before saving to mysql is removed since 0.1.18. It was working fine in 0.1.17. I tried all subsequent version from 0.1.18 onward and none of it is working.
Problem
may i know is the feature to convert date to UTC before saving to mysql is removed since 0.1.18. It was working fine in 0.1.17. I tried all subsequent version from 0.1.18 onward and none of it is working. Issue type: [โ] question [ โ] bug report [ ] feature request [ ] documentation issue Database system/driver: [ ] `cordova` [ ] `mongodb` [ ] `mssql` [โ ] `mysql` / `mariadb` [ ] `oracle` [ ] `postgres` [ ] `sqlite` [ ] `sqljs` [ ] `react-native` TypeORM version: [ ] `latest` [ ] `@next` [ โ] `0.1.17` (or put your version here) link to reference issue #976 Steps to reproduce or a small repository showing the problem: <!-- To answer those questions you need to put "x" inside the square brackets, for example: [x] `mysql` [ ] `postgres` Also, please format your code properly (by taking code blocks into [code block]) !>
Unverified for your environment
Select your OS to check compatibility.
1 Fix
Solution: may i know is the feature to convert date to UTC before saving to mysql is removed since 0.1.18. It was working fine in 0.1.17. I tried all subsequent version from 0.1.18 onward an
@cometta, there is no reason for you to change your server time zone to UTC. The purpose of #1717 is actually to prevent this workaround. If you look at the original issue #1716 you will understand the benefits of the change. You should be able to have the database server set to a different timezone than the application server (e.g. multi-datacenter architectures) and still be able to store the
Trust Score
2 verifications
- 1
@cometta, there is no reason for you to change your server time zone to UTC. The
If you look at the original issue #1716 you will understand the benefits of the change.
- 2
You should be able to have the database server set to a different timezone than
The only way to make this work is if every component (database, app server, client) sticks to dates/timestamps with timezone offset information.
- 3
Let's assume your user (client) is living in the timezone `+8` and your servers
You don't want to calculated for each client living in another timezone the correct offset. You just send the date/timestamp including the timezone offset (in this example `+8`) to typeorm and it will be persisted correctly in the database (regardless it's timezone). When you read out the date/timestamp and push it to the client, it will include the timezone offset as well, thus making it easy to convert it into the client's local time.
- 4
In any other scenario you would be forced to set the server time to UTC and to c
In any other scenario you would be forced to set the server time to UTC and to convert your client's timestamps into UTC first before persisting them.
Validation
Resolved in typeorm/typeorm GitHub issue #1999. Community reactions: 1 upvotes.
Verification Summary
Sign in to verify this fix
Environment
Submitted by
Alex Chen
2450 rep