Page MenuHomePhabricator

Mediaviewer is still providing the wrong date
Closed, DuplicatePublicBUG REPORT

Description

Steps to Reproduce:

  1. Set your system time zone to US Eastern.
  2. Click on this link and observe the creation date as 2011-11-10: File:Monkey Hill.jpg.
  3. Click on this link and observe the creation date as 2011-11-09: https://es.wikipedia.org/wiki/Monkey_Hill?debug=true#/media/Archivo:Monkey_Hill.jpg

Actual Results: Creation date is 9 de noviembre de 2011

Expected Results: Creation date is 10 de noviembre de 2011

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());

FYI I plan to insert a custom patch on English Wikipedia. It should be forward compatible with any changes you make. Feel free to let me know on my talk page when this is in production and I will remove my own patch.

Thank you!

Event Timeline

  • that should say "add the following line" not "edit"
Demian subscribed.
  • that should say "add the following line" not "edit"

I've edited the description with that and a github link to the line.

In an embarrassing twist, I didn't properly test the code I fixed before I added it here.

Line 815 should read:

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

Tip: run the basic tests before submitting the patch. In MediaViewer:

npm install grunt
grunt test

Stylelint will ask you to add spaces inside the parenthesis... it's quite strict on following the style guide.
Like so:

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

Hope I saved you a patch-round ;-)