Skip to content

Commit 1f53844

Browse files
pythongh-103822: [Calendar] change return value to enum for day and month APIs (pythonGH-103827)
1 parent 587f2f0 commit 1f53844

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

Lib/calendar.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,6 @@ class Day(IntEnum):
8383
SUNDAY = 6
8484

8585

86-
8786
# Number of days per month (except for February in leap years)
8887
mdays = [0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]
8988

@@ -156,7 +155,7 @@ def weekday(year, month, day):
156155
"""Return weekday (0-6 ~ Mon-Sun) for year, month (1-12), day (1-31)."""
157156
if not datetime.MINYEAR <= year <= datetime.MAXYEAR:
158157
year = 2000 + year % 400
159-
return datetime.date(year, month, day).weekday()
158+
return Day(datetime.date(year, month, day).weekday())
160159

161160

162161
def monthrange(year, month):
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Update the return type of ``weekday`` to the newly added Day attribute

0 commit comments

Comments
 (0)