A fresh test with Drupal 9 and 10 showed that timezones are not handled corre...

Contribution Date
Technology
Contribution Project
Contribution Details

A fresh test with Drupal 9 and 10 showed that timezones are not handled correctly. When saving a "Date only" field, the actual date written to the database is a day earlier (as I am in Eastern timezone and Drupal converts the date to UTC). For example, today is 4th Jumadil Ula and 16th November; saving this date will store 7 PM 15th November. The time is discarded and only 15th November is stored. On the next load of the edit page, it will convert 15th November to 3rd Jumadil Ula. Saving this will store 14th November and the drift repeats.

The problem is that the date form element we have handles the date conversion and it returns a string after formatting the timestamp with Drupal API. Of course, the timezone conversion happens here. Therefore, the date form element (TaarikhDate.php) should set the timezone before returning the formatted string.

Contribution Author
Files count
0
Patches count
0