Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
python-calendarweek
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
AlekSIS®
Libraries
python-calendarweek
Commits
ae287128
Commit
ae287128
authored
4 years ago
by
Jonathan Weth
Browse files
Options
Downloads
Patches
Plain Diff
Add class method which gets the last week of a year
parent
1871c8c1
No related branches found
Branches containing commit
No related tags found
1 merge request
!7
Resolve "Introduce function to get the last week of a year"
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
calendarweek/calendarweek.py
+7
-0
7 additions, 0 deletions
calendarweek/calendarweek.py
with
7 additions
and
0 deletions
calendarweek/calendarweek.py
+
7
−
0
View file @
ae287128
...
@@ -94,6 +94,13 @@ class CalendarWeek:
...
@@ -94,6 +94,13 @@ class CalendarWeek:
return
weeks
return
weeks
@classmethod
def
get_last_week_of_year
(
cls
,
year
:
int
)
->
CalendarWeek
:
"""
Get the last week of a year.
"""
last_week
=
date
(
year
,
12
,
28
).
isocalendar
()[
1
]
return
cls
(
week
=
last_week
,
year
=
year
)
def
__post_init__
(
self
)
->
None
:
def
__post_init__
(
self
)
->
None
:
today
=
date
.
today
()
today
=
date
.
today
()
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment