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

Cannot add Duration to or set time zone of truncated TimePoint #168

Open
MetRonnie opened this issue Jun 17, 2020 · 0 comments
Open

Cannot add Duration to or set time zone of truncated TimePoint #168

MetRonnie opened this issue Jun 17, 2020 · 0 comments
Assignees
Labels
Milestone

Comments

@MetRonnie
Copy link
Contributor

MetRonnie commented Jun 17, 2020

Possibly related to #80

>>> A = TimePoint(day_of_month=30, hour_of_day=9)
---30T09Z
>>> A + Duration(hours=2)
metomi/isodatetime/data.py in __add__(self, other, no_copy)
   1323         if duration.hours:
   1324             new.hour_of_day += duration.hours
-> 1325             new.tick_over()
   1326         if duration.days:
   1327             if new.get_is_calendar_date():

metomi/isodatetime/data.py in tick_over(self, check_changes)
   1651             self.day_of_week = days + 1
   1652         if self.day_of_month is not None:
-> 1653             self._tick_over_day_of_month()
   1654         if self.day_of_year is not None:
   1655             while self.day_of_year < 1:

metomi/isodatetime/data.py in _tick_over_day_of_month(self)
   1711                 self.day_of_month = day
   1712         else:
-> 1713             month_index = (self.month_of_year - 1) % CALENDAR.MONTHS_IN_YEAR
   1714             if get_is_leap_year(self.year):
   1715                 max_day_in_month = CALENDAR.DAYS_IN_MONTHS_LEAP[month_index]

TypeError: unsupported operand type(s) for -: 'NoneType' and 'int'

This bug also means I get the same error for A.set_time_zone()

Tested @ 4bbc372

@MetRonnie MetRonnie added the bug label Jun 17, 2020
@MetRonnie MetRonnie added this to the 2.1 milestone Jul 8, 2020
@MetRonnie MetRonnie self-assigned this Jan 31, 2022
@MetRonnie MetRonnie modified the milestones: 2.1, 2.2 Mar 30, 2022
@MetRonnie MetRonnie modified the milestones: 3.1.0, 3.2.0 Oct 4, 2023
@MetRonnie MetRonnie modified the milestones: 3.2.0, 3.x Jan 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant