Closed trippo closed 2 years ago
This is the error? Cannot assign string to property App\Http\Livewire\Testing::$datetime of type ?Carbon\Carbon
Typed property App\Http\Livewire\Admin\Actions\CreateShopEntry::$dateTest must be an instance of Carbon\Carbon or null, string used
I'll think of a solution to do this treatment in livewire middleware, convert the string into an instance of carbon This will be very useful
There is also another problem with dateTime component:
If you use a carbon date inside an eloquent for livewire model, you obtain an alpine error:
Livewire Entangle Error: Livewire property 'shopEntry.entered_at' cannot be found
But the value is setted on mount function like this:
$this->shopEntry->entered_at = now()->roundMinute(10);
I tried to format carbon with toIso8601String or others formats without success
You have a validation rule to binding directly to model property?
https://laravel-livewire.com/docs/2.x/properties#binding-models
You are right... there is not error with rule
There is another problem: I'm on Rome(UTC+2) timezone and if I pass "2021-06-16 19:50:00" to DateTime picker i see on the frontend
16/06/2021 17:50
with these params
display-format="DD/MM/YYYY HH:mm"
parse-format="YYYY-MM-DD hh:mm:ss"
and with or without without-timezone
Can you give more information? I tried here and I couldn't reproduce
Your laravel timezone config is Europe/Rome?
Can you show me your component data using alpinejs tools?
There is also another little ui problem with time picker.. If you have a modal with blur like
and open a datetime picker
it create a space at the bottom of the page
Can you give more information? I tried here and I couldn't reproduce
Your laravel timezone config is Europe/Rome?
Can you show me your component data using alpinejs tools?
This problem there is also with select (not native) on a modal when you open the select
The modal bug has been fixed
There is another problem: I'm on Rome(UTC+2) timezone and if I pass "2021-06-16 19:50:00" to DateTime picker i see on the frontend
16/06/2021 17:50
with these params
display-format="DD/MM/YYYY HH:mm" parse-format="YYYY-MM-DD hh:mm:ss"
and with or without
without-timezone
If this still persists, create a new issue to this bug
Modal fixed. Leave open for Carbon
@trippo The livewire community helped me find a solution to this.
https://github.com/livewire/livewire/discussions/3370
public function updatingDate(&$date)
{
$date = Carbon::parse($date);
}
Work like a charme
Actually, the Datetime Picker component doesn't accept Carbon\Carbon type as livewire model, but it could be convenient on many occasions.