cms icon indicating copy to clipboard operation
cms copied to clipboard

Date field doesn't use APP_TIMEZONE

Open stephenmeehanuk opened this issue 4 months ago • 3 comments

Bug description

In my .env I've set APP_TIMEZONE=America/New_York

When I enable the timepicker, entries show my local time UK, not America/New_York

These two variables use the timezone from the .env

  • {{ now | format:"H:i:s" }}
  • {{ updated_at | format:"Y-m-d H:i:s"}}

But this variable uses my local (Valet) timezone

  • {{ date | format:"Y-m-d H:i:s"}}

Is this a bug? Or is there something else I need to configure to get {{ date | format:"Y-m-d H:i:s"}} to use APP_TIMEZONE ?

How to reproduce

  • Run the site locally
  • Add a timepicker to an entry blueprint
  • Set APP_TIMEZONE to a different timezone than the one you're in
  • Compare these variables
  • {{ now | format:"H:i:s" }}
  • {{ updated_at | format:"Y-m-d H:i:s"}}
  • {{ date | format:"Y-m-d H:i:s"}}
  • I would expect them to pull the date from APP_TIMEZONE but {{ date | format:"Y-m-d H:i:s"}} doesn't

Logs

No response

Environment

Environment
Application Name: Statamic
Laravel Version: 11.22.0
PHP Version: 8.3.8
Composer Version: 2.6.5
Environment: local
Debug Mode: OFF
URL: demo.test
Maintenance Mode: OFF
Timezone: America/New_York
Locale: en

Cache
Config: NOT CACHED
Events: NOT CACHED
Routes: NOT CACHED
Views: CACHED

Drivers
Broadcasting: log
Cache: redis
Database: sqlite
Logs: stack / single
Mail: log
Queue: redis
Session: file

Livewire
Livewire: v3.5.6

Statamic
Addons: 5
Sites: 1
Stache Watcher: Enabled
Static Caching: Disabled
Version: 5.24.0 PRO

Statamic Addons
jonassiewertsen/statamic-jobs: 1.5.0
jonassiewertsen/statamic-live-search: 2.1.1
jonassiewertsen/statamic-livewire: 3.6.0
statamic/collaboration: 1.0.0
visuellverstehen/statamic-anchor-navigation: 1.0.0

Installation

Fresh statamic/statamic site via CLI

Additional details

No response

stephenmeehanuk avatar Oct 03 '24 09:10 stephenmeehanuk