Closed ricardov03 closed 2 years ago
There's not enough information such as:
date
or datetime
Also, we already have the tests covered via https://github.com/laravel/nova-dusk-suite/blob/master/tests/Browser/DateFieldTest.php without the bug reported above.
p/s: You can grant access to me but I would think above requirements are critical info to debug the issue.
I am working on this later today. Thanks, @crynobone, for taking the time to check this.
Here's the requested information:
app timezone configuration
<?php
...
/*
|--------------------------------------------------------------------------
| Application Timezone
|--------------------------------------------------------------------------
|
| Here you may specify the default timezone for your application, which
| will be used by the PHP date and date-time functions. We have gone
| ahead and set this to a sensible default for you out of the box.
|
*/
'timezone' => 'UTC',
user timezone configuration In the NovaServiceProvider:
<?php
...
Nova::userTimezone(function (Request $request) {
return 'America/Santo_Domingo';
});
<?php
...
/**
* The attributes that should be cast to native types.
*
* @var array
*/
protected $casts = [
'id' => 'integer',
'user_id' => 'integer',
'account_id' => 'integer',
'supplier_id' => 'integer',
'date' => 'date',
];
Added America/Santo_Domingo
to the test suite and unable to reproduce the issue:
https://github.com/laravel/nova-dusk-suite/blob/master/tests/Browser/DateFieldTest.php
Let me try to replicate the issue in a clean Laravel + Nova installation. Thanks so much for the effort.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
@ricardov03 this is happening to me too. Did you find a way to fix this?
Did you migrate from v3 to v4?
Hello @dacastro4. I'm still facing this issue, but I haven't the time to replicate the problem for @crynobone . I'm not migrating, my project started from a clean Laravel installation with a clean Nova 4.
Thank you @ricardov03. I thought it was going to be some issues during upgrade migration but apparently it is just an issue with the conversion (?) logic of the Date field. We had our app since Nova 3 and we never had that issue before migrating.
@crynobone What I'm testing right now is a date column (not a timestamp, it has to have 00:00:00
as the time) and the app.timezone is UTC
as well
I have the same issue. The date of birth
attribute is 1968-11-21
but displays 1968-11-20
in Nova frontend. This happens when I use the Date
field without any other method.
Timezone is configured as Europe/Berlin
.
Using displayUsing
with $dateOfBirth?->format('Y-m-d')
gives me the correct date.
How is the Date
field value
attribute in the Vue component derived? I used displayUsing
as stated above (formatting Y-m-d
) and the Vue data looks like that:
Then without the displayUsing
Vue data looks as follow:
Just so you know, I made a custom Date field as a patch for now. The issue is definitely the frontend so i'm still trying to figure out what it is
Closing this as stale at the moment, feel free to create a new issue with a full reproducing repository for us to debug the issue.
Description:
Create a Resource with a Date field. After storing the resource, if you tried to edit the saved resource, the Date field shows a wrong date, specifically a day less from the stored one.
Detailed steps to reproduce the issue on a fresh Nova installation: