| 9 | |
| 10 | === Testcase showing the problem |
| 11 | I've created a draft pullrequest with a testcase to show this problem here: https://github.com/django/django/pull/12991 |
| 12 | |
| 13 | With that testcase, on my system (mariadb 5.5.5-10.3.22-MariaDB-0ubuntu0.19.10.1, CEST/UTC+0200 timezone), I see that: |
| 14 | - With sqlite and `USE_TZ=False`: fails because `Now()` is in UTC and Django uses its configured `TIME_ZONE` (`America/Chicago`). |
| 15 | - With sqlite and `USE_TZ=True`: works, since `Now()` is in UTC and Django defaults to UTC. |
| 16 | - With sqlite and `USE_TZ=True` and database `TIME_ZONE=Europe/Amsterdam`: fails, since `Now()` is in UTC and Django now uses `Europe/Amsterdam` (for this, I set `TIME_ZONE` in the `DATABASES` of my settings manually, not sure if I could do that inside a testcase). |
| 17 | - With Mysql and `USE_TZ=True`: fails, since Mysql uses the system timezone (UTC+0200) and Django uses UTC. |
| 18 | - With Mysql and `USE_TZ=False`: fails, since Mysql uses the system timezone (UTC+0200) and Django uses its configured `TIME_ZONE` (`America/Chicago`). |
| 19 | - With Postgresql, all tests succeed. |
| 20 | |
| 21 | See the pullrequest for detailed test output, including some debug prints that help confirm all of the above observations. |
35 | | === Testcase showing the problem |
36 | | I've created a draft pullrequest with a testcase to show this problem here: https://github.com/django/django/pull/12991 |
37 | | |
38 | | With that testcase, on my system (mariadb 5.5.5-10.3.22-MariaDB-0ubuntu0.19.10.1, CEST/UTC+0200 timezone), I see that: |
39 | | - With sqlite and `USE_TZ=False`: fails because `Now()` is in UTC and Django uses its configured `TIME_ZONE` (`America/Chicago`). |
40 | | - With sqlite and `USE_TZ=True`: works, since `Now()` is in UTC and Django defaults to UTC. |
41 | | - With sqlite and `USE_TZ=True` and database `TIME_ZONE=Europe/Amsterdam`: fails, since `Now()` is in UTC and Django now uses `Europe/Amsterdam` (for this, I set `TIME_ZONE` in the `DATABASES` of my settings manually, not sure if I could do that inside a testcase). |
42 | | - With Mysql and `USE_TZ=True`: fails, since Mysql uses the system timezone (UTC+0200) and Django uses UTC. |
43 | | - With Mysql and `USE_TZ=False`: fails, since Mysql uses the system timezone (UTC+0200) and Django uses its configured `TIME_ZONE` (`America/Chicago`). |
44 | | |
45 | | See the pullrequest for detailed test output, including some debug prints that help confirm all of the above observations. |
46 | | |