Skip to content

[5.4] Fix double timezone conversion in Media Manager file dates#47433

Merged
muhme merged 3 commits intojoomla:5.4-devfrom
krishnagandhicode:Fix-29134-date
Apr 1, 2026
Merged

[5.4] Fix double timezone conversion in Media Manager file dates#47433
muhme merged 3 commits intojoomla:5.4-devfrom
krishnagandhicode:Fix-29134-date

Conversation

@krishnagandhicode
Copy link
Copy Markdown
Contributor

@krishnagandhicode krishnagandhicode commented Mar 20, 2026

Pull Request resolves #29134

  • I read the Generative AI policy and my contribution is either not created with the help of AI or is compatible with the policy and GNU/GPL 2 or later.

Summary of Changes

This PR fixes an issue where the Media Manager applies the user's timezone offset 2 times which results in incorrect "Date Created" and "Date Modified" times

In the local filesystem adapter, create_date_formatted and modified_date_formatted were generated using HTMLHelpr even though the date objects had already been adjusted to the configured timezone.
That caused the timezone conversion to be applied again in formatting, which produced shifted times confusion

The fix now formats the existing Date objects directly:
-create_date_formatted uses $createDate->format(Text::_('DATE_FORMAT_LC5'), true) and similarly for modified_date_formatted.

Testing Instructions

Go to System -> global Config -> under Server look for Location.
Change your Website Time Zone from UTC to a timezone with a some offset like for Asia/Kolkata (UTC+5:30), to make the bug visible.
image

now go to content -> media Upload an image and make sure to note your actual time.
now click on that i(info) button in top right and then click on the image you just uploaded - you get the details.

Actual result BEFORE applying this Pull Request

The "Date Created" time is shifted 2 times by the timezone offset . (e.g. as in my shared case if you set the timezone to UTC+5:30 now the timestamp will display exactly 11 hours ahead of UTC time instead of 5.5 hours).

image

In this SS as you can see that in my Windows Clock(bottom right) it UTC +5:30 : 16:30
and Joomla took the 11:00 UTC time, added the +5:30 offset once, and then added the +5:30 offset a second time, resulting in exactly 22:00)
as you see in the created Date : 22:00
I deliberately uploaded the file at exactly 16:30 IST(11:00 UTC, Kolkata) to make the math easy/clear : )

Expected result AFTER applying this Pull Request

The "Date Created" time reflects the time in whatever timezone is currently set in the Global Configuration - without any extra offsets

For my shared example: now it shows 16:30 (beacuse I uploaded it at 16:30 IST)
image

You can also test by uploading new images..

Link to documentations

Please select:

  • Documentation link for guide.joomla.org:

  • No documentation changes for guide.joomla.org needed

  • Pull Request link for manual.joomla.org:

  • No documentation changes for manual.joomla.org needed

@brianteeman
Copy link
Copy Markdown
Contributor

great spot!!

@exlemor
Copy link
Copy Markdown

exlemor commented Mar 20, 2026

I have tested this item ✅ successfully on 0cde490

I was able to successfully test this! :) Thanks and great find @krishnagandhicode!


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/47433.

@tecpromotion
Copy link
Copy Markdown
Contributor

I have tested this item ✅ successfully on 0cde490

Very nice catch! Thanks!


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/47433.

@tecpromotion tecpromotion removed the bug label Mar 20, 2026
@tecpromotion
Copy link
Copy Markdown
Contributor

RTC


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/47433.

@joomla-cms-bot joomla-cms-bot added the RTC This Pull Request is Ready To Commit label Mar 20, 2026
@muhme
Copy link
Copy Markdown
Contributor

muhme commented Apr 1, 2026

✅ Final test before merge with JBT

  • Set Website Time Zone to Berlin (actual +2h), seen the error before
  • Applied PR with Patch Tester, date & time are correct now

@muhme muhme merged commit c64e552 into joomla:5.4-dev Apr 1, 2026
70 checks passed
@joomla-cms-bot joomla-cms-bot removed the RTC This Pull Request is Ready To Commit label Apr 1, 2026
@muhme muhme added this to the Joomla! 5.4.5 milestone Apr 1, 2026
@muhme
Copy link
Copy Markdown
Contributor

muhme commented Apr 1, 2026

Thank you @krishnagandhicode for your contribution. Thank you @exlemor and @tecpromotion for testing.

@krishnagandhicode
Copy link
Copy Markdown
Contributor Author

Thanks for the merge, and thanks to everyone who helped with Testing.

@krishnagandhicode krishnagandhicode deleted the Fix-29134-date branch April 1, 2026 10:45
adarshdubey03 pushed a commit to adarshdubey03/joomla-cms that referenced this pull request Apr 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[4.0] Media Manager - Date Created is incorrect

6 participants