Skip to content

Commit

Permalink
fix: make nextYearStartDate use the offset of the weekly type
Browse files Browse the repository at this point in the history
  • Loading branch information
tokland committed Jan 14, 2025
1 parent 21cbd23 commit 0a79460
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -758,7 +758,7 @@ $.extend( dhis2.period.WeeklyWednesdayGenerator.prototype, {
var periods = [];

var startDate = dhis2.period.getStartDateOfYear( this.calendar, year, 3 );
var nextYearStartDate = Date.parse( dhis2.period.getStartDateOfYear( this.calendar, year + 1, 1 ) );
var nextYearStartDate = Date.parse( dhis2.period.getStartDateOfYear( this.calendar, year + 1, 3 ) );

// no reliable way to figure out number of weeks in a year (can differ in different calendars)
// goes up to 200, but break when week is back to 1
Expand Down Expand Up @@ -815,7 +815,7 @@ $.extend( dhis2.period.WeeklyThursdayGenerator.prototype, {
var periods = [];

var startDate = dhis2.period.getStartDateOfYear( this.calendar, year, 4 );
var nextYearStartDate = Date.parse( dhis2.period.getStartDateOfYear( this.calendar, year + 1, 1 ) );
var nextYearStartDate = Date.parse( dhis2.period.getStartDateOfYear( this.calendar, year + 1, 4 ) );

// no reliable way to figure out number of weeks in a year (can differ in different calendars)
// goes up to 200, but break when week is back to 1
Expand Down Expand Up @@ -874,7 +874,7 @@ $.extend( dhis2.period.WeeklySaturdayGenerator.prototype, {
var periods = [];

var startDate = dhis2.period.getStartDateOfYear( this.calendar, year, 6 );
var nextYearStartDate = Date.parse( dhis2.period.getStartDateOfYear( this.calendar, year + 1, 1 ) );
var nextYearStartDate = Date.parse( dhis2.period.getStartDateOfYear( this.calendar, year + 1, 6 ) );

// no reliable way to figure out number of weeks in a year (can differ in different calendars)
// goes up to 200, but break when week is back to 1
Expand Down Expand Up @@ -933,7 +933,7 @@ $.extend( dhis2.period.WeeklySundayGenerator.prototype, {
var periods = [];

var startDate = dhis2.period.getStartDateOfYear( this.calendar, year, 7 );
var nextYearStartDate = Date.parse( dhis2.period.getStartDateOfYear( this.calendar, year + 1, 1 ) );
var nextYearStartDate = Date.parse( dhis2.period.getStartDateOfYear( this.calendar, year + 1, 7 ) );

// no reliable way to figure out number of weeks in a year (can differ in different calendars)
// goes up to 200, but break when week is back to 1
Expand Down

0 comments on commit 0a79460

Please sign in to comment.