Page MenuHomePhabricator

Media Viewer uses excess precision for date
Open, LowPublicBUG REPORT

Description

Steps to reproduce

  1. Specify the |date= parameter in the information template with year- or month-precision ISO 8601 format. Example
  2. Notice that the output HTML correctly uses the appropriate precision: <time class="dtstart" datetime="2008-02" lang="en" dir="ltr" style="white-space:nowrap">February 2008</time>
  3. Press the Open in Media Viewer button, and look at the Created date.

Actual result

  1. It reports 1 February 2008, the first day of the month it was taken in (if the specified date had a precision of year, it’d report 1 January of that year).

Expected result

  1. It reports February 2008, without specifying a day.

Notes

  • In MultimediaViewer, newFromImageInfo() preserves the date as is (it doesn't add a day when a day isn't provided). However, formatDate() calls JavaScript's native Date constructor, which adds the missing day.

Requirements:

  • Dates are preserved as is. When a month-year date is provided, do not reformat the date with a numeric day.
  • Add a test, such as a missing day in the date

Event Timeline

Note that this is not a new problem, I just took the time to report it now.

I’m not sure if it happens at the metadata extraction (CommonsMetadata) or on display (MediaViewer), so I tagged both.

HSwan-WMF raised the priority of this task from Low to Medium.

There are a bunch of MediaViewer things that need maintenance, but with current experiments and future work the path is unclear. We anticipate making future changes in this area next year and will look at this then.

HSwan-WMF lowered the priority of this task from Medium to Low.Wed, Dec 3, 5:45 PM