Skip to content

Commit 74d5376

Browse files
jspricketbabej
authored andcommitted
Avoid offset error in taskwarrior DST calculation
taskwarrior seems to have a problem with time zones with daylight saving time when doing calculations: $ TZ=UTC task calc "eoy - 4 months" 2022-09-02T23:59:59 $ TZ=Europe/Berlin task calc "eoy - 4 months" 2022-09-03T00:59:59 The old pytz code did the same and computed 2022-09-03T00:59:59 whereas the new zoneinfo version computes 2022-09-02T23:59:59. Instead of working around taskwarrior this changes the test to be outside of the DST.
1 parent 0307266 commit 74d5376

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

tasklib/tests.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1267,7 +1267,7 @@ def test_complex_eoy_conversion(self):
12671267
else:
12681268
return
12691269

1270-
t = Task(self.tw, description='test task', due='eoy - 4 months')
1270+
t = Task(self.tw, description='test task', due='eoy - 2 months')
12711271
now = datetime.datetime.now().replace(tzinfo=local_zone)
12721272
due_date = datetime.datetime(
12731273
year=now.year,
@@ -1277,7 +1277,7 @@ def test_complex_eoy_conversion(self):
12771277
minute=59,
12781278
second=59,
12791279
tzinfo=local_zone
1280-
) - datetime.timedelta(0, 4 * 30 * 86400)
1280+
) - datetime.timedelta(0, 2 * 30 * 86400)
12811281
if self.tw.version >= '2.5.2' and self.tw.version < '2.6.0':
12821282
due_date = datetime.datetime(
12831283
year=now.year+1,
@@ -1287,7 +1287,7 @@ def test_complex_eoy_conversion(self):
12871287
minute=0,
12881288
second=0,
12891289
tzinfo=local_zone
1290-
) - datetime.timedelta(0, 4 * 30 * 86400)
1290+
) - datetime.timedelta(0, 2 * 30 * 86400)
12911291
self.assertEqual(due_date, t['due'])
12921292

12931293
def test_filtering_with_string_datetime(self):

0 commit comments

Comments
 (0)