Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions database/factories/TaskFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ class TaskFactory extends Factory
*/
public function definition(): array
{
$this->faker->languageCode('da_DK');
$this->faker->locale('da_DK');

return [
'name' => fake()->name(),
Expand Down
20 changes: 10 additions & 10 deletions src/Models/Task.php
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ public function scopeOverdue($query): mixed
*/
public function scopeDueToday($query): mixed
{
return $query->where('due_date', now()->format('Y-m-d'));
return $query->whereDate('due_date', '=', now());
}

/**
Expand All @@ -117,7 +117,7 @@ public function scopeDueToday($query): mixed
*/
public function scopeDueTomorrow($query): mixed
{
return $query->where('due_date', now()->addDay()->format('Y-m-d'));
return $query->whereDate('due_date', '=', now()->addDay());
}

/**
Expand All @@ -126,7 +126,7 @@ public function scopeDueTomorrow($query): mixed
*/
public function scopeDueThisWeek($query): mixed
{
return $query->whereBetween('due_date', [now()->startOfWeek()->format('Y-m-d'), now()->endOfWeek()->format('Y-m-d')]);
return $query->whereBetween('due_date', [now()->startOfWeek(), now()->endOfWeek()]);
}

/**
Expand All @@ -135,7 +135,7 @@ public function scopeDueThisWeek($query): mixed
*/
public function scopeDueNextWeek($query): mixed
{
return $query->whereBetween('due_date', [now()->addWeek()->startOfWeek()->format('Y-m-d'), now()->addWeek()->endOfWeek()->format('Y-m-d')]);
return $query->whereBetween('due_date', [now()->addWeek()->startOfWeek(), now()->addWeek()->endOfWeek()]);
}

/**
Expand All @@ -144,7 +144,7 @@ public function scopeDueNextWeek($query): mixed
*/
public function scopeDueThisMonth($query): mixed
{
return $query->whereBetween('due_date', [now()->startOfMonth()->format('Y-m-d'), now()->endOfMonth()->format('Y-m-d')]);
return $query->whereBetween('due_date', [now()->startOfMonth(), now()->endOfMonth()]);
}

/**
Expand All @@ -153,7 +153,7 @@ public function scopeDueThisMonth($query): mixed
*/
public function scopeDueNextMonth($query): mixed
{
return $query->whereBetween('due_date', [now()->addMonth()->startOfMonth()->format('Y-m-d'), now()->addMonth()->endOfMonth()->format('Y-m-d')]);
return $query->whereBetween('due_date', [now()->addMonth()->startOfMonth(), now()->addMonth()->endOfMonth()]);
}

/**
Expand All @@ -162,7 +162,7 @@ public function scopeDueNextMonth($query): mixed
*/
public function scopeDueThisYear($query): mixed
{
return $query->whereBetween('due_date', [now()->startOfYear()->format('Y-m-d'), now()->endOfYear()->format('Y-m-d')]);
return $query->whereBetween('due_date', [now()->startOfYear(), now()->endOfYear()]);
}

/**
Expand All @@ -171,7 +171,7 @@ public function scopeDueThisYear($query): mixed
*/
public function scopeDueNextYear($query): mixed
{
return $query->whereBetween('due_date', [now()->addYear()->startOfYear()->format('Y-m-d'), now()->addYear()->endOfYear()->format('Y-m-d')]);
return $query->whereBetween('due_date', [now()->addYear()->startOfYear(), now()->addYear()->endOfYear()]);
}

/**
Expand Down Expand Up @@ -252,7 +252,7 @@ public function scopeDueOnOrBetween($query, $from, $to): mixed
*/
public function scopeDueOnOrBeforeToday($query): mixed
{
return $query->where('due_date', '<=', now()->format('Y-m-d'));
return $query->whereDate('due_date', '<=', now());
}

/**
Expand All @@ -261,7 +261,7 @@ public function scopeDueOnOrBeforeToday($query): mixed
*/
public function scopeDueOnOrAfterToday($query): mixed
{
return $query->where('due_date', '>=', now()->format('Y-m-d'));
return $query->whereDate('due_date', '>=', now());
}

/**
Expand Down
Loading