[erlang-patches] week number support

Imre Horvath <>
Wed Dec 1 15:56:46 CET 2010


Dear Håkan!

Yes, you are right, I found the same while doing my research. There are
several different methods to calculate the week number. That's the reason I
also did not wanted to put it into the calendar module. Same like you. I
specifically needed the ISO Week Number, that's why I implemented it and put
it into a separate module the iso_8601.erl This module currently contains
only the implementation for the ISO Week Date, not more. Later it can be
extended to cover more parts of the standard.

What I had in mind is that OTP could include support for the ISO 8601 and
this could be a initial partial implementation. But it's up to the OTP Team
to decide if they want to include this in some form or not.

Support for calculating other week numbers is out of scope of my
contribution.

Best regards,
Imre


2010/12/1 Håkan Mattsson <>

> On Tue, Nov 30, 2010 at 9:19 PM, Imre Horvath <>
> wrote:
> > Dear Erlang/OTP Team!
> >
> > I have started a project on GitHub 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. It's based
> > on the calendar module and was tested successfully with eunit.
> >
> > Though currently it's not in a fork of erlang/otp but in a separate
> repository
> > https://github.com/imrehorvath/iso_8601_erl you might want to consider
> including it into OTP
> > if you think it would be useful!
>
> The Eflex application does also implement the algorithm in ISO8601 to
> calculate week numbers.
> Given a date it returns the week number (and the actual year that the
> week belongs to).
> See eflex_lib:week_of_the_year/1 in
> https://github.com/hawk/eflex/blob/master/src/eflex_lib.erl
>
> When I initially wrote Eflex my intention was to include THE week
> calculation algorithm in the
> calandar module, but when I detected that ISO8601 just was one of many
> algorithms I
> dropped that idea. Different parts of the world uses different week
> numbering algorithms.
> There are several different just in Europe.
>
> /Håkan
>


More information about the erlang-patches mailing list