Skip to content

Commit

Permalink
Add todo
Browse files Browse the repository at this point in the history
  • Loading branch information
yepzdk committed May 3, 2024
1 parent 1a87f2d commit 3df3ebe
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/Service/LeantimeApiService.php
Original file line number Diff line number Diff line change
Expand Up @@ -379,6 +379,8 @@ public function getPlanningDataWeeks(): PlanningData
$currentYear = (int) (new \DateTime())->format('Y');
$currentWeek = (int) (new \DateTime())->format('W');

// TODO: How to handle 53 weeks
// A year can actually have 53 weeks (cf. https://en.wikipedia.org/wiki/ISO_week_date#Weeks_per_year), and the year 2026 (in the near future is one of them), so this should be rewritten to iterate over all weeks in the year (or use https://stackoverflow.com/a/21480444).
for ($weekNumber = 1; $weekNumber <= 52; ++$weekNumber) {
$date = (new \DateTime())->setISODate($currentYear, $weekNumber);
$week = (int) $date->format('W'); // Cast as int to remove leading zero.
Expand Down

0 comments on commit 3df3ebe

Please sign in to comment.