Skip to content
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

Creating Events from 'date's should yield all-day Events #342

Open
N-Coder opened this issue Jun 14, 2022 · 0 comments
Open

Creating Events from 'date's should yield all-day Events #342

N-Coder opened this issue Jun 14, 2022 · 0 comments

Comments

@N-Coder
Copy link
Member

N-Coder commented Jun 14, 2022

I guess these are not really all-day events as they simply start at noon and end in the same instant. Would it be easier to mix different event types in the same Calendar (i.e. all-day, multi-day all-day, no specified end, fixed end or duration, maybe even with/without timezones?) and then thoroughly test that calendar?

Note: We could also infer that an Event should be all-day if its created from dates instead of datetimes, but currently the ensure_datetime here silently sets the time to midnight if its missing and ignores this distinction. Something like the following might fix that but needs further testing.

if (begin is not None or end is not None or duration is not None) and "timespan" in kwargs:
    raise ValueError("can't specify explicit timespan together with any of begin, end or duration")
timespan = kwargs.pop("timespan", EventTimespan(ensure_datetime(begin), ensure_datetime(end), ensure_timedelta(duration)))
if isinstance(begin, date) and not timespan.get_effective_duration().seconds:  # TODO we should also drop microseconds to be able to ignore them here
    timespan = timespan.make_all_day()
super(Event, self).__init__(timespan, summary, *args, **kwargs)

Originally posted by @N-Coder in #325 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant