-
-
Notifications
You must be signed in to change notification settings - Fork 168
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
DATE-TIME property formatting #75
Comments
That's a bug in Calendar.app, in that case. VALUE=DATE-TIME just specifies what type the value has, and it can be DATE or DATE-TIME. DATE-TIME is default though, so it doesn't need to be specified, but that Calendar.app doesn't like it being specified is definitely a bug. I guess logic could be added to skip VALUE= when it is DATE-TIME, though. |
This was my mistake. There was a differently problem (caused by my code) that was producing bad DATE-TIME values. But that aside, it does seem like a nice improvement to skip |
虽然同时带时区(TZID)和类型(VALUE)也符合标准,但是有一些日历软件对这种写法不支持(它们的锅)…… 见 collective/icalendar#75 。
同时带时区(TZID)和类型(VALUE)也符合 RFC 5545,有一些日历软件对这种写法不支持。 见 collective/icalendar#75 。
I use this workaround from icalendar import vDDDTypes
from datetime import datetime
def add_datetime(component, name: str, time: datetime):
vdatetime: vDDDTypes = vDDDTypes(time)
if 'VALUE' in vdatetime.params and 'TZID' in vdatetime.params:
vdatetime.params.pop('VALUE')
component.add(name, vdatetime)
...
from icalendar import Event
from datetime import timedelta, timezone
tz = datetime(2021,1,1,tzinfo=tz)
event = Event()
add_datetime(event, 'DTEND', datetime(2021,1,2,3,4,5,tzinfo=timezone(timedelta(hours=8), "Asia/Shanghai")))
print(event.to_ical().decode())
|
I'm not clear on why
vDatetime
properties (such asDTSTART
) use theVALUE=DATE-TIME:
syntax:RFC 5545 Section 3.3.5 describes a simpler (and more commonly used?) Date-Time format:
Mac OS X's Calendar.app doesn't appear to like the former but will accept the latter.
The text was updated successfully, but these errors were encountered: