Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

weeks_of_year starts with 1 in 2027 #10

Open
markus-seidl opened this issue Dec 8, 2024 · 2 comments
Open

weeks_of_year starts with 1 in 2027 #10

markus-seidl opened this issue Dec 8, 2024 · 2 comments

Comments

@markus-seidl
Copy link

markus-seidl commented Dec 8, 2024

If the function should iterate over all weeks in a year, than sometimes it should start with the week 53, for example in 2027.

I guess something like this?

 temp_first_of_year = date(self.year, 1, 1).isocalendar()[:2]

if temp_first_of_year[0] != self.year:
   # start with week 53
@markus-seidl markus-seidl changed the title weeks_of_year starts with 1 weeks_of_year starts with 1 in 2027 Dec 8, 2024
@markus-seidl
Copy link
Author

I guess a year also sometimes ends with week "1" which is next year?

@gisle
Copy link
Owner

gisle commented Dec 8, 2024

The documentation states that the first week of the year is the first week with at least 4 days in that year. For 2027 the first week starts on Monday 2027-01-04. There might be room for improvement in the documentation of it's not clear what weeks_of_year() it supposed to mean.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants