Skip to content

Conversation

@wilbertom
Copy link

Hey, I have some Python scripts I am rewriting in Nim. They make use of the week of year while formatting datetimes into strings.

Here I'm porting that functionality. I understand if its not desired in Nim though.

Here are some references where I got some of the code from and other people requiring it:

https://forum.nim-lang.org/t/6320
https://en.wikipedia.org/wiki/ISO_week_date#Calculating_the_week_number_from_a_month_and_day_of_the_month_or_ordinal_date

I debated making YearWeekRange be 1..53 but went with 0..52 to match Python.

Its worth pointing out this is my first time writing Nim and don't know the internals of DateTime so a strong code review is recommended.

@ringabout
Copy link
Member

Hello, @wilbertom thanks for making this PR, see also #17223

@wilbertom
Copy link
Author

Hey @xflywind , totally missed that, thank you for pointing me to it.

I'm glad someone else is thinking about this.

I think something missing on #17223 is format/parse support but, that can be added easily once that other PR is merged.

@wilbertom wilbertom closed this Dec 13, 2021
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

Successfully merging this pull request may close these issues.

2 participants