Timezone handling is not implemented and mostly derived from parent classes in both widget and formatter. This does not mean it is present or if it even works. This issue is to test the timezone support and fix the gaps.

Issue fork taarikh-2934074

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

hussainweb created an issue. See original summary.

hussainweb’s picture

Status: Active » Needs work

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.

hussainweb’s picture

Status: Needs work » Fixed

Merged

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.