Comments (3)
thanks for the bug report @atleta
What would be super helpful if you have the time is to write up a failing test case and add it to https://github.com/mfogel/django-timezone-field/blob/master/tests/tests.py#L485-L575. Either as a PR or just a block of code on this ticket. If you don't have time I will get to this as soon as I can, but it'll be a few days at best
#71 is probably the same issue
from django-timezone-field.
@mfogel I've looked into the code on github and it turns out that you have already fixed it here:
And this seems to fix the issue (I haven't tested it)
Interesting enough, when testing the bogus (4.1.1) version in the console with a trivial test case (see below) it gives the NonExistentTimeError. I.e. a different one than what I have seen when trying to run e.g. manage shell
(or runserver
). But the issue was the same.
with freeze_time('2021-03-28 01:44:14.162132'):
TimeZoneField(default='UTC', choices_display='WITH_GMT_OFFSET')
or even
with freeze_time('2021-03-28 01:44:14.162132'):
class M(models.Model):
TimeZoneField(default='UTC', choices_display='WITH_GMT_OFFSET')
Anway, regarding your fix (see above): the replace and the substraction is unnecessary. You could simply use: delta = now_tz.utcoffset()
. Which also means that you can probably merge it with the line above. It won't cause a problem due to what I have said above and it's more expressive.
from django-timezone-field.
Anway, regarding your fix (see above): the replace and the subtraction is unnecessary. You could simply use: delta = now_tz.utcoffset().
Please feel free to give it a go! Make sure the tests still pass, and if they do, then please file a pull request.
Sounds like this bug is a duplicate of #70 which affected v4.1.1
and was fixed in 37249c6 for v4.1.2
. If that's not right and you are seeing this bug with version v4.1.2
then please reopen.
from django-timezone-field.
Related Issues (20)
- Support Django 4.2 HOT 2
- Django <= 3.X defaults to using ZoneInfoBackend instead of PYTZBackend HOT 2
- use_pytz=True doesn't seem to be default on django 3.2.21 HOT 1
- Django 5.0 support HOT 4
- Using the "Factory" timezone on systems that use the system zoneinfo database can cause problems HOT 1
- sorting list of timezones on ModelForm? HOT 1
- Great
- Does not support Django5 - This blocks upgrades HOT 6
- Requested setting USE_DEPRECATED_PYTZ, but settings are not configured.
- How to convert timezone name to Coordinated Universal Time (UTC)
- 5.0 - No time zone found with key Pacific/Kanto HOT 4
- Translate list items based on current locale HOT 1
- System timezones or installed tzdata may not cover pytz.common_timezones HOT 5
- `TimeZoneSerializerField` does not handle the empty string case
- python3.10 support HOT 1
- Version 5.0 drops Django 3.1 support, but can be installed alongside it
- Help to fix 'Pacific/Fiji' timezone ValueError: Extraneous characters at end of TZ string HOT 1
- PYTZ 2022.2 Update Issues HOT 7
- KeyError: "choices" during migration after upgrading to 5.0 HOT 4
- Use `zoneinfo.available_timezones` instead of `pytz.common_timezones` converted to `ZoneInfo` HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from django-timezone-field.