Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
devajmeireles committed Mar 8, 2024
1 parent 4d73e21 commit bbf71bd
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 8 deletions.
5 changes: 4 additions & 1 deletion app/Enums/Examples/Form/Date.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,14 @@ class Date
HTML;

public const CREATE_FROM_FORMAT = <<<'HTML'
// Your current date
$date = '20/02/2024'; // 20/02/2024
// Formatting
$date = now()->createFromFormat('d/m/Y', $date)->format('Y-m-d');
echo $date; // 2024-02-20
// Same date, but now in the correct format
$date; // 2024-02-20
HTML;

public const HELPERS = <<<'HTML'
Expand Down
6 changes: 3 additions & 3 deletions resources/views/documentation/form/date.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@
</ul>
</x-warning>
<p class="mt-2">
Regardless of the format of your date, to send it to the component you
must follow the pattern <x-block>YYYY-MM-DD</x-block>. Therefore, if your date is different
from <x-block>YYYY-MM-DD</x-block>, the correct thing to do is to use Carbon's <x-block>createFromFormat</x-block>.
Regardless of the format of the date, to send the date to the component you
must follow the pattern <x-block>YYYY-MM-DD</x-block>. If the date are using a format different
than <x-block>YYYY-MM-DD</x-block>, the correct thing to do is to use Carbon's <x-block>createFromFormat</x-block>.
Let's take a look at an example considering the Brazilian date format:
</p>
<x-code :contents="$createFromFormat" />
Expand Down
9 changes: 8 additions & 1 deletion resources/views/livewire/welcome/table.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public function notify(string $user): void
$user = explode(' ', $user)[0];
$this->toast()
->error("Naaah!", "{$user} can't leave Laravel team! 😝")
->error("Naaah!", "{$user} can't leave the Laravel team! 😝")
->send();
}
}; ?>
Expand All @@ -51,8 +51,15 @@ public function notify(string $user): void
:$sort
filter
paginate
loading
:quantity="[2,5,7]"
id="users">
@interact('column_name', $user)
<div class="flex items-center gap-2">
<img src="https://unavatar.io/github/{{ $user->username }}" alt="{{ $user->name }}" class="w-8 h-8 rounded-full"/>
{{ $user->name }}
</div>
@endinteract
@interact('column_action', $user)
<x-button.circle color="red"
icon="trash"
Expand Down
6 changes: 3 additions & 3 deletions resources/views/welcome.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -290,9 +290,9 @@ class="h-full antialiased"
<div class="flex flex-col">
<dd class="mt-4 text-base leading-7 text-gray-300 space-y-2">
@php($now = now()->format('Y-m-d'))
<x-date label="Normal" name="normal" :value="$now" format="DD, MMMM, YYYY" />
<x-date label="Range" range name="range" :value="[$now, now()->addWeek()->format('Y-m-d')]" format="DD, MMMM, YYYY" />
<x-date label="Multiple" multiple name="multiple" :value="[$now, now()->addDay()->format('Y-m-d')]" format="DD, MMMM, YYYY" />
<x-date label="Normal" name="normal" :value="$now" format="MMMM, DD, YYYY" />
<x-date label="Range" range name="range" :value="[$now, now()->addWeek()->format('Y-m-d')]" format="MMMM, DD, YYYY" />
<x-date label="Multiple" multiple name="multiple" :value="[$now, now()->addDay()->format('Y-m-d')]" format="MMMM, DD, YYYY" />
</dd>
</div>
</dl>
Expand Down

0 comments on commit bbf71bd

Please sign in to comment.