Make DateField timezone-aware
As reported by different users in the community** the fact that the created_on
and the last_modified
fields are aware of the timezone while the DateField
save datetimes in UTC it's confusing, especially when there is the need to do some basic operations in a formula field between the twos.
Steps to reproduce, considering a different timezone from UTC (let's say UTC+5):
- Add a "Last modified" or "Created on" field to a table, notice that the field context shows the correct timezone in the options.
- Add a DateTime field including time. Notice there is no information related to the timezone.
- Add dates in the DateTime field, and notice that the "Last modified" cells are automatically updated in the current timezone.
- Look at the data returned from the server (using the browser developer tools or making the API request) and notice that all the dates are in UTC, but while the "Last modified" ones are adjusted with the correct timezone in the frontend, the "Datefield" dates are not.
- create a formula field that calculates the difference between the dates, and notice that the operation is calculated between the UTC dates. It's different from what a user might expect looking at the frontend data.
** Links to the discussions:
Edited by Davide Silvestri