Skip to content

imrehorvath/iso_8601_erl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

iso_8601_erl

Introduction

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.

Rules

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.

Implementation

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.

Examples

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.

References

About

Partial implementation of ISO 8601 in Erlang

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages