Skip to content

Commit

Permalink
Merge pull request #49 from stephanus-tantiono/patch-1
Browse files Browse the repository at this point in the history
Allow Closure at min and max date
  • Loading branch information
coolsam726 authored Mar 21, 2024
2 parents 5ad16ea + f6a69bb commit e255ae1
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/Forms/Components/Flatpickr.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
use Filament\Forms\Components\Contracts;
use Filament\Forms\Components\Field;
use Filament\Support\Concerns\HasExtraAlpineAttributes;
use Closure;

class Flatpickr extends Field implements Contracts\CanBeLengthConstrained, Contracts\HasAffixActions
{
Expand Down Expand Up @@ -85,9 +86,9 @@ class Flatpickr extends Field implements Contracts\CanBeLengthConstrained, Contr

protected bool $inline = false;

protected Carbon|string|null $maxDate = null;
protected Carbon|string|null|Closure $maxDate = null;

protected Carbon|string|null $minDate = null;
protected Carbon|string|null|Closure $minDate = null;

protected ?string $maxTime = null;

Expand Down Expand Up @@ -486,7 +487,7 @@ public function getMaxDate(): Carbon|string|null
return $this->maxDate;
}

public function maxDate(Carbon|string|null $maxDate = 'now'): static
public function maxDate(Carbon|string|null|Closure $maxDate = 'now'): static
{
$this->maxDate = $maxDate ? Carbon::parse($maxDate) : $maxDate;

Expand All @@ -498,7 +499,7 @@ public function getMinDate(): Carbon|string|null
return $this->minDate;
}

public function minDate(Carbon|string|null $minDate): static
public function minDate(Carbon|string|null $minDate|Closure): static
{
$this->minDate = $minDate ? Carbon::parse($minDate) : $minDate;

Expand Down

0 comments on commit e255ae1

Please sign in to comment.