You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It was observed by @twentylemon that the calculation for the time duckbot was alive (found here) has a potential problem since year is a parameter for the special days list but the now calculation (found here) does not make use of the year.
So what I mean here for year, this method mutates this class, adding dates to some internal map like {"2020-01-01": ["New Year's"]}. This method is lazily called when you ask for a date in a particular year.
So let's imagine a typical use case.
days=holidays.get(today_in_2022)
# ... the next daydays=holidays.get(tomorrow_in_2022)
The first call ends up populating the special days for 2022. DuckBot's inception day gets some value like "I'm n seconds old". In the second call, there's no need to populate the days again, so it is not called. Say tomorrow is DuckBot's special day, we end up saying "I'm n seconds old", but it's actually n+1 day seconds. now() is not recalculated.
DuckBot currently turns off every day, but already was not the case in the past, so we can't rely on _populate being called daily. We also can't force call it, since self[date] = x actually appends to the internal list of days the class keeps. now() needs to somehow be based on the year. We could just say datetime(year, 12, 3, 7, 0), but that also loses accuracy. Not sure what the best approach is here.
The text was updated successfully, but these errors were encountered:
From #640 and #641.
It was observed by @twentylemon that the calculation for the time duckbot was alive (found here) has a potential problem since
year
is a parameter for the special days list but thenow
calculation (found here) does not make use of theyear
.As additionally noted by @twentylemon:
The text was updated successfully, but these errors were encountered: