So recently https://gerrit.wikimedia.org/r/15746 was merged. It implements a pretty timestamp function. Yet it was somehow completely ignored that we actually have an MWTimestamp class made specifically for timestamp objects in MediaWiki.
*--* *Tyler Romeo* Stevens Institute of Technology, Class of 2015 Major in Computer Science www.whizkidztech.com | tylerromeo@gmail.com
On 25 October 2012 07:07, Tyler Romeo tylerromeo@gmail.com wrote:
So recently https://gerrit.wikimedia.org/r/15746 was merged. It implements a pretty timestamp function. Yet it was somehow completely ignored that we actually have an MWTimestamp class made specifically for timestamp objects in MediaWiki.
…and its getHumanTimestamp is implemented in an unlocalizable way, see http://translatewiki.net/wiki/Thread:Support/ago_%28%22$1_ago%22%29_cannot_w...
Replace the implementation of getHumanTimestamp with a call to Language::prettyTimestamp() and we are done, aren’t we? The language-specific user-friendly formatting belongs to the language class, anyway. And I am not sure what should have prettyTimestamp() done differently – is wfTimestamp deprecated in favor of MWTimestamp, or what?
-- [[cs:User:Mormegil | Petr Kadlec]]
Le 25/10/12 07:07, Tyler Romeo a écrit :
So recently https://gerrit.wikimedia.org/r/15746 was merged. It implements a pretty timestamp function. Yet it was somehow completely ignored that we actually have an MWTimestamp class made specifically for timestamp objects in MediaWiki.
Hello,
There are a few issues with it such as: - methods having optional parameters before required one - we have to pass a User object - the whole prettyTimestamp() is very confusing
Note that change 15746 has been written before the introduction of MWTimestamp.
I would prefer we revert that change and improve it, possibly using PHP DateInterval and definitely with MWTimestamp.
cheers,
On 25 October 2012 08:07, Tyler Romeo tylerromeo@gmail.com wrote:
So recently https://gerrit.wikimedia.org/r/15746 was merged. It implements a pretty timestamp function. Yet it was somehow completely ignored that we actually have an MWTimestamp class made specifically for timestamp objects in MediaWiki.
It does use wfTimestamp in many places.
If you are saying that the new functionality should be in the MWTimestamp class, then I disagree. wfTimestamp and MWTimestamp have never* contained anything else but code which parses and formats timestamps in various different formats used in databases, http protocol, image files, etc. This is clearly visible from the design of the class, it doesn't take any kind of context for the language or user to affect the formatting
Language class has always been responsible for formatting time and date expressions for users.
* Well, not until someone added getHumanTimestamp which I guess should be deprecated now.
-Niklas
wikitech-l@lists.wikimedia.org