statamic / cms

The core Laravel CMS Composer package
https://statamic.com
Other
3.7k stars 508 forks source link

TimeFieldtype does not track client timezones #8339

Open AntonCooper opened 1 year ago

AntonCooper commented 1 year ago

Bug description

The built in date field does not handle client timezone. This results in incorrect dates being set for an entry.

How to reproduce

Logs

No response

Environment

Environment
Application Name: xxx
Laravel Version: 9.52.7
PHP Version: 8.2.5
Composer Version: 2.5.7
Environment: local
Debug Mode: ENABLED
URL: xxx
Maintenance Mode: OFF

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

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

Statamic
Addons: 7
Antlers: runtime
Stache Watcher: Disabled
Static Caching: half
Version: 4.7.0 PRO

Statamic Addons
jacksleight/statamic-bard-mutator: 2.3.0
jacksleight/statamic-bard-texstyle: 3.1.3
jacksleight/statamic-distill: 0.4.2
mitydigital/feedamic: 2.2.5
statamic/collaboration: 0.6.0
statamic/eloquent-driver: 2.1.0
transformstudios/review: 4.1.0

Installation

Existing Laravel app

Antlers Parser

None

Additional details

No response

jonassiewertsen commented 1 year ago

We are working the Timestamps (Format U).

Does this resolve your bug @AntonCooper ? I am not sure, as I can't see your configs for the fieldtype.

https://github.com/statamic/cms/pull/8636

AntonCooper commented 1 year ago

Pretty sure this wont fix this issue - it's still not contextualising the timezone which the user is in. The date being passed in will be the correct time in the user's timezone (which might be different to the application timezone). The date which is sent to the server will either need to be converted to UTC before it's sent, or, the timezone of the client needs to be passed through with the datetime.