Skip to content

Conversation

@bsipocz
Copy link
Member

@bsipocz bsipocz commented Jul 29, 2025

This made sense while doing the fixes for scientific-python/scientific-python.org#782, but also I separated it out as it may or may not be necessary.

@bsipocz bsipocz added the type: Bug fix Something isn't working label Jul 29, 2025
@codecov
Copy link

codecov bot commented Jul 29, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 95.00%. Comparing base (b0176a1) to head (344bdf0).
⚠️ Report is 28 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #116      +/-   ##
==========================================
- Coverage   95.41%   95.00%   -0.42%     
==========================================
  Files           1        1              
  Lines         109      120      +11     
==========================================
+ Hits          104      114      +10     
- Misses          5        6       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@bsipocz bsipocz added this to the 0.3 milestone Sep 7, 2025
yaml2ics.py Outdated

def event_from_yaml(event_yaml: dict, tz: datetime.tzinfo = None) -> ics.Event:
def event_from_yaml(
event_yaml: dict, tz: datetime.tzinfo = dateutil.tz.UTC
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think either change the default, or change the handling below, but not both.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel it makes most sense to change the default here, and then let the event timezone overwrite. Or it maybe cleaner to drop the tz kwarg altogether and rely only on the yaml and have a conditional?

    if "timezone" in d:
        tz = gettz(d.pop("timezone"))
    else:
        tz = dateutil.tz.UTC

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or, just break if the event_yaml does not have a timezone.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, after #125 this becomes the crux of the current PR. We should document this in the README.

# See RFC2445, 4.8.5 REcurrence Component Properties
# This function can be used to add a list of e.g. exception dates (EXDATE) or
# recurrence dates (RDATE) to a reoccurring event
def add_recurrence_property(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we make TZ required for now; this is for internal use anyway.

yaml2ics.py Outdated

def event_from_yaml(event_yaml: dict, tz: datetime.tzinfo = None) -> ics.Event:
def event_from_yaml(
event_yaml: dict, tz: datetime.tzinfo = dateutil.tz.UTC
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, after #125 this becomes the crux of the current PR. We should document this in the README.

@bsipocz bsipocz force-pushed the BUG_fix_default_tz branch from 7454841 to 765d473 Compare December 3, 2025 03:47
@bsipocz
Copy link
Member Author

bsipocz commented Dec 3, 2025

I have rebased this on top of your PR, and will double check how it works with the SP calendars. Once it looks all sensible I'll come back to add some documentation and follow-up on any remaining comment (but I think the only remaining relevant one is about the docs).

@stefanv stefanv changed the title BUG: defaulting to UTC tz rather than to None Default to UTC timezone Dec 4, 2025
@stefanv stefanv added type: Enhancement New feature or request and removed type: Bug fix Something isn't working labels Dec 4, 2025
@stefanv stefanv merged commit 2dbfc3b into scientific-python:main Dec 4, 2025
21 of 22 checks passed
@bsipocz
Copy link
Member Author

bsipocz commented Dec 4, 2025

This wasn't working yet, the UTC default is not propagated properly and we still had floating entries on the widget.

@bsipocz bsipocz deleted the BUG_fix_default_tz branch December 4, 2025 02:52
@stefanv
Copy link
Member

stefanv commented Dec 4, 2025

OK I will make a follow-up PR.

@stefanv
Copy link
Member

stefanv commented Dec 4, 2025

I just checked again, and I can confirm that UTC is propagated when no timezone is specified.

@bsipocz bsipocz restored the BUG_fix_default_tz branch December 4, 2025 22:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type: Enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants