>
> I think you can modify code to work correctly as long as it does not change 
> start and end date generated in period table. DHIS weeks start at Sunday and 
> end by Saturday, at least in Mozambique database, how did you come to Monday 
> - Sunday?
>
> regards,
> murod
>

>From WeeklyPeriodType.java in dhis-api (excuse all the ^M's):

 // ---------------------------------------------------------------------^M
 // Generate weeks^M
 // ---------------------------------------------------------------------^M
^M
        cal.set( Calendar.WEEK_OF_YEAR, 1 );^M
        cal.set( Calendar.DAY_OF_WEEK, Calendar.MONDAY );^M
^M
        int firstWeek = cal.get( Calendar.WEEK_OF_YEAR );^M
^M
        ArrayList<Period> weeks = new ArrayList<Period>();^M
^M
        Date startDate = cal.getTime();^M
        cal.add( Calendar.DAY_OF_YEAR, 6 );^M
        weeks.add( new Period( this, startDate, cal.getTime() ) );^M
        cal.add( Calendar.DAY_OF_YEAR, 1 );^M
^M
        while ( cal.get( Calendar.WEEK_OF_YEAR ) != firstWeek )^M
        {^M
            startDate = cal.getTime();^M
            cal.add( Calendar.DAY_OF_YEAR, 6 );^M
            weeks.add( new Period( this, startDate, cal.getTime() ) );^M
            cal.add( Calendar.DAY_OF_YEAR, 1 );^M
        }^M


So you see - cal.set( Calendar.DAY_OF_WEEK, Calendar.MONDAY );.  All
weekly periods start on a Monday.  I've dumped these and verified.

Or is the period table being generated from somewhere else?

Regards
Bob

_______________________________________________
Mailing list: https://launchpad.net/~dhis2-devs
Post to     : dhis2-devs@lists.launchpad.net
Unsubscribe : https://launchpad.net/~dhis2-devs
More help   : https://help.launchpad.net/ListHelp

Reply via email to