Skip to content

Commit

Permalink
fix(week-number-calculation): if year start day same as selected star…
Browse files Browse the repository at this point in the history
…t day
  • Loading branch information
Mohammad Taha authored and AhsanAyaz committed Mar 18, 2024
1 parent ba99b78 commit 8e0ca5c
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 9 deletions.
42 changes: 34 additions & 8 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export class WeekNumberPipe implements PipeTransform {

// find out the distance from the first week's first day
const roundFigure = ((currentWeekStartDate.getTime() - firstWeekFirstDate.getTime()) / 86400000);
result = (roundFigure % 7 === 0) ? roundFigure / 7 : 1 + Math.round(roundFigure / 7);
result = (roundFigure % 7 === 0) ? roundFigure / 7 + 1 : 1 + Math.round(roundFigure / 7);
if (result <= 0) {
result = weeksInYear + result;
}
Expand Down

0 comments on commit 8e0ca5c

Please sign in to comment.