# week periods calculation

**URL:** <https://community.dhis2.org/t/week-periods-calculation/1710>\
**Category:** Support - Assistance technique\
**Created:** [12 October 2013 19:55 UTC](https://community.dhis2.org/t/week-periods-calculation/1710 "2013-10-12T19:55:58Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Paulo\_Gracio1](https://dhis2.b-cdn.net/letter_avatar_proxy/v4/letter/p/76d3ee/32.png) [@Paulo\_Gracio1](https://community.dhis2.org/u/Paulo_Gracio1)\
**Post date:** [12 October 2013 19:55 UTC](https://community.dhis2.org/t/week-periods-calculation/1710/1 "2013-10-12T19:55:58Z")

</div>

Hi all,

As far as I know week periods are being calculated following ISO 8601.

Please see attachment, W53 2008-12-29 2009-01-04 is not according to ISO 8601 once 2008 only has 52 weeks. In 2009, for the same period we have W1 2008-12-29 2009-01-04. Is this correct?

Regards,

**Paulo Grácio**  
**Technical Manager**  
(+258) 822 544 603

Skype: paulojrgracio

[**Critical Software Mozambique**](http://www.criticalsoftware.co.uk/)  
**Dependable Technologies for Critical Systems**

Critical Software Mozambique is a subsidiary of [Critical Software, a CMMI® Level 5 rated Company](http://cmmiinstitute.com/)  
CMMI® is registered in the USPTO by [CMU](http://www.cmu.edu/)

Rua Pereira Marinho, 179  
Bairro de Sommerchield  
Maputo  
Moçambique  
Phone: (+258) 214 951 45  
Fax: (+258) 214 951 46

DISCLAIMER: This message is confidential and may contain privileged information. It is for use only by the people or entities to whom it is addressed. If you are not an intended recipient, you should not disclose, distribute, copy, print, rely on or otherwise make use of this message. If an addressing or transmission error has misdirected it to you we would be grateful if you would please notify the sender by return, before deleting it from your system.

![image](https://dhis2.b-cdn.net/images/transparent.png)

---

<div class="post-metadata">

**Author:** ![bobj](https://dhis2.b-cdn.net/user_avatar/community.dhis2.org/bobj/32/33033_2.png) [@bobj](https://community.dhis2.org/u/bobj)\
**Post date:** [12 October 2013 22:40 UTC](https://community.dhis2.org/t/week-periods-calculation/1710/2 "2013-10-12T22:40:07Z")

</div>

Hi Paulo

You are right this looks like a bug. The week of 2008-12-29 2009-01-04 should be the first week of 2009, not the last week of 2008, because the Thursday in that week falls in January not December.

Bob

> **···**
>
> On 12 October 2013 20:55, Paulo Grácio [pgracio@criticalsoftware.com](mailto:pgracio@criticalsoftware.com) wrote:
> 
> > Hi all,
> 
> > 
> 
> > As far as I know week periods are being calculated following ISO 8601.
> 
> > 
> 
> > Please see attachment, W53 2008-12-29 2009-01-04 is not according to ISO 8601 once 2008 only has 52 weeks. In 2009, for the same period we have W1 2008-12-29 2009-01-04. Is this correct?
> 
> > 
> 
> > Regards,
> 
> > **Paulo Grácio**
> > 
> > **Technical Manager**  
> > (+258) 822 544 603
> 
> > Skype: paulojrgracio
> 
> > [**Critical Software Mozambique**](http://www.criticalsoftware.co.uk/)
> > 
> > **Dependable Technologies for Critical Systems**
> 
> > Critical Software Mozambique is a subsidiary of [Critical Software, a CMMI® Level 5 rated Company](http://cmmiinstitute.com/)
> > 
> > CMMI® is registered in the USPTO by [CMU](http://www.cmu.edu/)
> 
> > Rua Pereira Marinho, 179  
> > Bairro de Sommerchield  
> > Maputo  
> > Moçambique  
> > Phone: (+258) 214 951 45
> > 
> > Fax: (+258) 214 951 46
> 
> > DISCLAIMER: This message is confidential and may contain privileged information. It is for use only by the people or entities to whom it is addressed. If you are not an intended recipient, you should not disclose, distribute, copy, print, rely on or otherwise make use of this message. If an addressing or transmission error has misdirected it to you we would be grateful if you would please notify the sender by return, before deleting it from your system.
> 
> > 
> 
> > * * *
> > 
> > Mailing list: [https://launchpad.net/~dhis2-devs](https://launchpad.net/~dhis2-devs)
> > 
> > Post to : [dhis2-devs@lists.launchpad.net](mailto:dhis2-devs@lists.launchpad.net)
> > 
> > Unsubscribe : [https://launchpad.net/~dhis2-devs](https://launchpad.net/~dhis2-devs)
> > 
> > More help : [https://help.launchpad.net/ListHelp](https://help.launchpad.net/ListHelp)

---

<div class="post-metadata">

**Author:** ![jason](https://dhis2.b-cdn.net/user_avatar/community.dhis2.org/jason/32/32739_2.png) [@jason](https://community.dhis2.org/u/jason)\
**Post date:** [13 October 2013 05:23 UTC](https://community.dhis2.org/t/week-periods-calculation/1710/3 "2013-10-13T05:23:36Z")

</div>

I think this may actually be a bug in the JavaScript for the dropdown. I think we had seen this previously for these last weeks of the year, but in the period table there is actually only one period for this period. See below from our period table which results from the following SQL statement.

zm\_dhis2\_nmcc=# SELECT \* FROM period where periodtypeid = (SELECT periodtypeid from periodtype where name = ‘Weekly’) AND startdate \>=‘2008-12-29’::date ORDER BY startdate LIMIT 2;

periodid | periodtypeid | startdate | enddate

> **···**
>
> On Sat, Oct 12, 2013 at 8:55 PM, Paulo Grácio [pgracio@criticalsoftware.com](mailto:pgracio@criticalsoftware.com) wrote:
> 
> > Hi all,
> 
> > 
> 
> > As far as I know week periods are being calculated following ISO 8601.
> 
> > 
> 
> > Please see attachment, W53 2008-12-29 2009-01-04 is not according to ISO 8601 once 2008 only has 52 weeks. In 2009, for the same period we have W1 2008-12-29 2009-01-04. Is this correct?
> 
> > 
> 
> > Regards,
> 
> > **Paulo Grácio**
> > 
> > **Technical Manager**  
> > (+258) 822 544 603
> 
> > Skype: paulojrgracio
> 
> > [**Critical Software Mozambique**](http://www.criticalsoftware.co.uk/)
> > 
> > **Dependable Technologies for Critical Systems**
> 
> > Critical Software Mozambique is a subsidiary of [Critical Software, a CMMI® Level 5 rated Company](http://cmmiinstitute.com/)
> > 
> > CMMI® is registered in the USPTO by [CMU](http://www.cmu.edu/)
> 
> > Rua Pereira Marinho, 179  
> > Bairro de Sommerchield  
> > Maputo  
> > Moçambique  
> > Phone: (+258) 214 951 45
> > 
> > Fax: (+258) 214 951 46
> 
> > DISCLAIMER: This message is confidential and may contain privileged information. It is for use only by the people or entities to whom it is addressed. If you are not an intended recipient, you should not disclose, distribute, copy, print, rely on or otherwise make use of this message. If an addressing or transmission error has misdirected it to you we would be grateful if you would please notify the sender by return, before deleting it from your system.
> 
> > 
> 
> > * * *
> > 
> > Mailing list: [https://launchpad.net/~dhis2-devs](https://launchpad.net/~dhis2-devs)
> > 
> > Post to : [dhis2-devs@lists.launchpad.net](mailto:dhis2-devs@lists.launchpad.net)
> > 
> > Unsubscribe : [https://launchpad.net/~dhis2-devs](https://launchpad.net/~dhis2-devs)
> > 
> > More help : [https://help.launchpad.net/ListHelp](https://help.launchpad.net/ListHelp)

---

<div class="post-metadata">

**Author:** ![Lars](https://dhis2.b-cdn.net/user_avatar/community.dhis2.org/lars/32/34166_2.png) [@Lars](https://community.dhis2.org/u/Lars)\
**Post date:** [21 October 2013 14:13 UTC](https://community.dhis2.org/t/week-periods-calculation/1710/4 "2013-10-21T14:13:19Z")

</div>

Fixed in r 12779 in trunk, 2.13 and 2.12.

Lars
