Skip to content

Commit 5f895d9

Browse files
committed
Correct minute comparison to month for DateTime.nth_of_month()
1 parent 6df9baf commit 5f895d9

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

pendulum/datetime.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1256,11 +1256,11 @@ def _nth_of_month(self, nth, day_of_week):
12561256
return self.first_of("month", day_of_week)
12571257

12581258
dt = self.first_of("month")
1259-
check = dt.format("%Y-%m")
1259+
check = dt.format("%Y-%M")
12601260
for i in range(nth - (1 if dt.day_of_week == day_of_week else 0)):
12611261
dt = dt.next(day_of_week)
12621262

1263-
if dt.format("%Y-%m") == check:
1263+
if dt.format("%Y-%M") == check:
12641264
return self.set(day=dt.day).start_of("day")
12651265

12661266
return False

0 commit comments

Comments
 (0)