Skip to content

Commit d78b4c4

Browse files
author
Sébastien Eustace
committed
Merge branch 'altendky-356-altendky-nth_of_month_outside_scope'
2 parents 8839568 + 979c26f commit d78b4c4

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

pendulum/datetime.py

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

12701270
dt = self.first_of("month")
1271-
check = dt.format("%Y-%m")
1271+
check = dt.format("%Y-%M")
12721272
for i in range(nth - (1 if dt.day_of_week == day_of_week else 0)):
12731273
dt = dt.next(day_of_week)
12741274

1275-
if dt.format("%Y-%m") == check:
1275+
if dt.format("%Y-%M") == check:
12761276
return self.set(day=dt.day).start_of("day")
12771277

12781278
return False

tests/date/test_day_of_week_modifiers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ def test_last_friday_of_month():
111111

112112

113113
def test_nth_of_month_outside_scope():
114-
d = pendulum.date(1975, 12, 5)
114+
d = pendulum.date(1975, 6, 5)
115115

116116
with pytest.raises(PendulumException):
117117
d.nth_of("month", 6, pendulum.MONDAY)

tests/datetime/test_day_of_week_modifiers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ def test_last_friday_of_month():
127127

128128

129129
def test_nth_of_month_outside_scope():
130-
d = pendulum.datetime(1975, 12, 5)
130+
d = pendulum.datetime(1975, 6, 5)
131131

132132
with pytest.raises(PendulumException):
133133
d.nth_of("month", 6, pendulum.MONDAY)

0 commit comments

Comments
 (0)