Last modified: 2014-06-26 22:40:31 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T68635, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 66635 - MultimediaViewer: Usage of non-standard date format parsing with Moment.js is deprecated
MultimediaViewer: Usage of non-standard date format parsing with Moment.js is...
Status: RESOLVED WONTFIX
Product: MediaWiki extensions
Classification: Unclassified
MultimediaViewer (Other open bugs)
unspecified
All All
: High normal (vote)
: ---
Assigned To: Nobody - You can work on this!
:
Depends on:
Blocks: code_quality
  Show dependency treegraph
 
Reported: 2014-06-15 12:00 UTC by Krinkle
Modified: 2014-06-26 22:40 UTC (History)
4 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description Krinkle 2014-06-15 12:00:00 UTC
Opening https://commons.wikimedia.org/w/index.php?title=File:Daemonicus_LOGO.jpg#mediaviewer/File:Daemonicus_LOGO.jpg logs to the console: 

> Deprecation warning: moment construction falls back to js Date. This is discouraged and will be removed in upcoming major release. Please refer to https://github.com/moment/moment/issues/1407 for more info.
Comment 1 Tisza Gergő 2014-06-15 19:20:43 UTC
We use moment to try to format the date string consistently but fall back to showing the original string if it that fails, so changes in how moment's date parsing is implemented do not matter much. As for the warning itself, there doesn't seem to be a way to suppress it when you we handing an unknown string to moment. So as far as I can see this is a WONTFIX.
Comment 2 Mormegil 2014-06-19 09:15:58 UTC
(In reply to Tisza Gergő from comment #1)
> As for the warning itself,
> there doesn't seem to be a way to suppress it when you we handing an unknown
> string to moment. So as far as I can see this is a WONTFIX.

The documented [1] way to parse a date string with a user-defined fallback when the string is not properly ISO-formatted, is to override moment.createFromInputFallback.

The current functionality allowing to do moment('4 3 2000') and expecting a “useful” result is deprecated and possibly will be removed in a future version, so I don’t see how WONTFIXing this could work.

[1] https://github.com/moment/moment/issues/1407#issuecomment-41620885
Comment 3 Tisza Gergő 2014-06-19 17:46:02 UTC
(In reply to Mormegil from comment #2)
> The current functionality allowing to do moment('4 3 2000') and expecting a
> “useful” result is deprecated and possibly will be removed in a future
> version, so I don’t see how WONTFIXing this could work.

As I said, when moment cannot parse the string, we just show it as-is, so changes in what formats moment exactly accepts don't really affect MediaViewer. Users will see dates formatted in non-standard ways more often, on the other hand false positives (e.g. dd/mm/yyyy parsed as mm/dd/yyyy) and issues like bug 56794 will go away. On the whole I'm not sure this will be a bad thing.
Comment 4 Tisza Gergő 2014-06-26 22:40:31 UTC
Closing per above. If the presence of the warning itself is a problem, please reopen and we'll figure out some workaround.

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links