-
-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Daylight aware repeats #48
Comments
If we can boil it down to a reproducible example, that could help. Can you show python code which creates the same object as datetime.now(TZ)? So we talk about the same object. |
Can you provide python code to create a datetime for these cases: 1 no event expected but one given, 2 one event expected but none given, 3 an event given and expected, 4 no event given and none expected. This will be enough to create reproducible tests. For clarity, you can answer like |
I would like to have tests to nail down the issue and find out where this error comes from. |
Thanks. This is quite some info. I will look into it. If you like, you are also invited to create test cases. Maybe that is a learning opportunity for you. |
Just here to say I did not forget nor am I ignoring this. I want to eventually get around to it, but I do not have the know how or the time right now as I am in the middle of exam season. |
I can help with the know-how. Just let me know when the time is ripe.
|
I also noticed something off in this regards. I had created many recurring events before Daylight change happened and some events are not retrieved depending on the start_time passed to between().
which generates this. Note that the 10:15 entry is lost when lookup is from 10:00
Debugging a bit into the within method confirmed this. I added
And got mixed time zone offsets
When the event was created, the offset was 5 hours but now it is 6 hours and so they get skipped. |
Hmm interesting. |
It looks related to these issues raised on dateutil/dateutil#641 Another example I stumbled upon and looks unlikely to be fixable easily: rru = dateutil.rrule.rrulestr("""DTSTART;TZID=Europe/Paris:20201010T153000
RRULE:FREQ=WEEKLY;WKST=MO;UNTIL=20201115T142959Z;BYDAY=SA,SU
"""
)
[d.astimezone(pytz.utc) for d in rru] outputs what is expected:
But now, using rru = dateutil.rrule.rrulestr("""
RRULE:FREQ=WEEKLY;WKST=MO;UNTIL=20201115T142959Z;BYDAY=SA,SU
""",
dtstart=pytz.timezone("Europe/Paris").localize(datetime.datetime(2020, 10, 10, 15, 30))
)
[d.astimezone(pytz.utc) for d in rru] outputs [datetime.datetime(2020, 10, 10, 13, 30, tzinfo=<UTC>),
datetime.datetime(2020, 10, 11, 13, 30, tzinfo=<UTC>),
datetime.datetime(2020, 10, 17, 13, 30, tzinfo=<UTC>),
datetime.datetime(2020, 10, 18, 13, 30, tzinfo=<UTC>),
datetime.datetime(2020, 10, 24, 13, 30, tzinfo=<UTC>),
datetime.datetime(2020, 10, 25, 13, 30, tzinfo=<UTC>),
datetime.datetime(2020, 10, 31, 13, 30, tzinfo=<UTC>),
datetime.datetime(2020, 11, 1, 13, 30, tzinfo=<UTC>),
datetime.datetime(2020, 11, 7, 13, 30, tzinfo=<UTC>),
datetime.datetime(2020, 11, 8, 13, 30, tzinfo=<UTC>),
datetime.datetime(2020, 11, 14, 13, 30, tzinfo=<UTC>),
datetime.datetime(2020, 11, 15, 13, 30, tzinfo=<UTC>)] which is wrong, both for the start times after the CEST to CET change and the last occurence is also incorrect. |
See also collective/icalendar#162 |
@iprak, you already added code. If you like to create a pull request which puts it into tests, this would be one step closer to implementing the expected behavior. Same for you @Cilyan, there is always the invitation. This template documents the steps to be taken for a test-driven implementation. I am happy to help and @ttmx already added some tests. At the same time, I live in an Eco-Community right now, Internet far away, so I am slow to respond and do not take much time on programming. |
I submitted a PR (#51). The calendar data and the code are both close to my actual usage. |
Does this fix the issue? I recall testing it some days ago and I still had the problem. |
The tests are running. That should fix the issue, then. We can re-open it. Also, be aware how to create a datetime object with the right time-zone: use tz.localize(dt) and not set it in the constructor. |
Hello!
My script just stopped working today, and I'm preeetty sure its due to daylight savings time.
This would be the ICS file I'm using https://termbin.com/pws2
And here are my scripts https://github.com/ttmx/auto-uni , running python 3.8.6 and the latest RIE module version.
The part that isn't working properly is line 47 of openlink.py
events = recurring_ical_events.of(cal).at(datetime.now(TZ))
Where it seems like either datetime.now is not returning daylight aware times, or the RIE module isn't processing them how I would expect it to,
Weirdly enough, the entire countdown.py works.
I'm sure this is something on my end that I am doing wrong, and thus, didn't mark this as a bug.
Would there be any chance you could help me fix this? Totally understand if it is outside the purpose of github issues.
Thank you!
The text was updated successfully, but these errors were encountered: