Page MenuHomePhabricator

Extension:Media Viewer shows the date before as the date "Created"
Closed, ResolvedPublic

Description

For some reason, Media Viewer shows the wrong date as the date of creation.

In this example, I am absolutely sure of the date of creation. I also uploaded the file minutes after taking it while still sitting the same room. The image, File:Open Hearing with Dr. Fiona Hill and David Holmes.jpg, was created and uploaded on 21 November 2019. However, Media Viewer shows 20 November 2019.

Screenshot 2020-01-19 at 2.02.28 PM.png (647×1 px, 899 KB)

Event Timeline

I am seeing Created: 21 November 2019 on Commons and as well as on three different Wikipedias. I am using Chrome browser.

Screen Shot 2020-01-20 at 6.35.08 AM.png (200×1 px, 117 KB)

@Coffeeandcrumbs : What are your account settings under Preferences > Appearance > Time offset?

@Coffeeandcrumbs : What are your account settings under Preferences > Appearance > Time offset?

It is "Use wiki default (UTC)".

Proposed fix by @Magog_the_Ogre in T245919: Mediaviewer is still providing the wrong date:

Cause: the fix for T58794 doesn't take into account time zones.
Fix: Add the following line before mmv.ui.metadataPanel.js Line 815:

date.setMinutes(date.getMinutes() + date.getTimezoneOffset());

Change 574602 had a related patch set uploaded (by Jforrester; owner: Jforrester):
[mediawiki/extensions/MultimediaViewer@master] metadataPanel.formatDate: Account for timezoneness

https://gerrit.wikimedia.org/r/574602

While i think it is probably better to assume UTC (as theoretically, everything is in UTC), technically that is probably often not true. The creationdate specifically is often local to the creator, not to 'our' timezone.

I also note that CommonsMetadata extension is dropping timezone info from the uploaddatetime param. This info (Z aka UTC) IS present in our imageinfo, but dropped from the extmetadata fields.

"imageinfo": [
                    {
                        "timestamp": "2019-11-21T14:43:05Z",
.....
                        "extmetadata": {
                            "DateTime": {
                                "value": "2019-11-21 14:43:05",
                                "source": "mediawiki-metadata",
                                "hidden": ""
                            },
                            "DateTimeOriginal": {
                                "value": "2019-11-21",
                                "source": "commons-desc-page"
                            },

when the source is mediawiki-metadata, we probably should just pass the timezone info...

While i think it is probably better to assume UTC (as theoretically, everything is in UTC), technically that is probably often not true. The creationdate specifically is often local to the creator, not to 'our' timezone.

It doesn't really matter what timezone it is in. What matters is that it should be printed in the timezone in which it is parsed (ie. the day should not change). Too bad Javascript doesn't really make it deterministic in what timezone a date gets started...

I also note that CommonsMetadata extension is dropping timezone info from the uploaddatetime param. This info (Z aka UTC) IS present in our imageinfo, but dropped from the extmetadata fields.

CommonsMetadata uses TS_DB. TS_ISO_8601 would certainly be more correct. I think the intent was to use something that looks decent even if the client does not parse it and it's just displayed as is, but probably not a good tradeoff.

Change 574602 merged by jenkins-bot:
[mediawiki/extensions/MultimediaViewer@master] metadataPanel.formatDate: Account for timezoneness

https://gerrit.wikimedia.org/r/574602

This appears to have been fixed. Is there any reason why it is still open?

Thanks for catching this. Patch merged, indeed.