This project was started because I needed the ISO Week Number for a given date and I wanted it in Erlang. Since the calendar module in the stdlib-1.17.1 application of Erlang/OTP R14B did not provide this functionality, I decided to write it myself.
The following rules are used:
- Week 01 is the week with the year's first Thursday in it.
- Weeks start with Monday.
- Monday is assigned the number 1.
- Weeks ranges from 01 to 52 or 53 within a year.
The module iso_8601.erl currently contains functions for computing the week number only. The standard covers far more than this. This module can be extended later, for now I needed only this.
The implementation is based on the calendar module of the stdlib application of Erlang/OTP.
The implementation was tested successfully with eunit using the tests file.
2010, 11, 19 -> "2010-W46-5" 2004, 12, 31 -> "2004-W53-5" 2000, 01, 01 -> "1999-W52-6"
Where the format "YYYY-Www-D" is used.
- ISO Week Date Calendar is a nice calendar.
- ISO Week Date on Wikipedia contains some explanation.