Skip to content

Commit

Permalink
fix: week doesn't work for sqlite
Browse files Browse the repository at this point in the history
  • Loading branch information
sakanjo committed Mar 29, 2024
1 parent 4241c03 commit ad54ee4
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 2 deletions.
2 changes: 1 addition & 1 deletion src/Metrics/Trend.php
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ protected function getExpression(): string
'year' => "strftime('%Y', $dateColumn)",
'month' => "strftime('%Y-%m', $dateColumn)",
'week' => "strftime('%Y-', $dateColumn) ||
( strftime('%W', $dateColumn) + (1 - strftime('%W', strftime('%Y', $dateColumn) || '-01-04')) )",
printf('%02d', strftime('%W', $dateColumn) + (1 - strftime('%W', strftime('%Y', $dateColumn) || '-01-04')) )",
'day' => "strftime('%Y-%m-%d', $dateColumn)",
'hour' => "strftime('%Y-%m-%d %H:00', $dateColumn)",
'minute' => "strftime('%Y-%m-%d %H:%M:00', $dateColumn)",
Expand Down
1 change: 0 additions & 1 deletion tests/src/Enums/RangeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,6 @@
['created_at' => Date::now()->yesterday()], // This one
['created_at' => Date::now()->subDays(2)], // This one
['created_at' => Date::now()->startOfQuarter()->addMinute()], // This one
['created_at' => Date::now()->subMonth()->subMinute()],
);

User::factory()
Expand Down

0 comments on commit ad54ee4

Please sign in to comment.