Some week-of-year procs for use with the times library

2020-05-12 Thread cmc
I was in need of week-of-year procs but couldn't find any so I wrote them. 
Putting them here for now because they aren't librarified enough yet to be 
packaged- no unit tests or docs yet.

[https://play.nim-lang.org/#ix=2lN4](https://play.nim-lang.org/#ix=2lN4)

Implements algorithms adapted from: 
[https://en.wikipedia.org/wiki/ISO_week_date#Calculating_the_week_number_from_a_month_and_day_of_the_month_or_ordinal_date](https://en.wikipedia.org/wiki/ISO_week_date#Calculating_the_week_number_from_a_month_and_day_of_the_month_or_ordinal_date)

yearweek values (week-of-year value) correspond to **ISO 8601 week value minus 
1** , similar to how day-of-year and day-of-week are handled in the times 
module.

Hope this is useful!


Re: Some week-of-year procs for use with the times library

2020-05-14 Thread treeform
I like this I have weekday, but I don't have week of the year in my library, I 
should add it.

[https://github.com/treeform/chrono/blob/master/src/chrono/calendars.nim#L224](https://github.com/treeform/chrono/blob/master/src/chrono/calendars.nim#L224)