Since MWTimestamp::getHumanTimestamp just makes a pretty
timestamp, and not a purely relative one, this commit adds
MWTimestamp::getRelativeTimestamp, which does just that.
Change-Id: I8b3e3fc6eeb4afd58f85fa7d05b5ea1a51b0afb6
Also removed some unnecessary ones. I think I've caught them all.
The spaceless version already appears in core ~300 times (after
accounting for false positives when grepping). Some consistency would
be nice.
Change-Id: I607655b5f4366e66dc78730d5fd2f57ed8776cae
Added a MWTimestamp::format method to format a timestamp object in the
given pattern. This avoids date(), which needs the local time
zone corretly set on the server, which is assumed at the moment in
Setup.php
Added MWTimestamp::getInstance for gmdate() and
MWTimestamp::getLocalInstance for date() to create a MWTimestamp object
and use it as inline statement.
Also MWTimestamp::setTimezone and MWTimestamp::getTimzone was added for
timezone handling.
Change-Id: I812aa013be2f4380e0cf10dc465202756fe8347b
The variable is called $wgLocalTZoffset, with lowercase O.
And php variable names are case-sensitive.
This commit is a simple
sed -i 's/wgLocalTZOffset/wgLocalTZoffset/' includes/Timestamp.php
Change-Id: Iddf9b363c9ddc95938ba8b5e0c134d9ec734109c
Changed logic in MWTimestamp::getHumanTimestamp so that
all the message and formatting was offloaded into the
Language class, keeping only actual timestamp logic in
the MWTimestamp class.
Also added a hook so extensions can override the
human timestamp format.
Change-Id: Ie667088010e24eb6cb569f9e8e8e2553005223eb
* Removed spaces around array index
* Removed double spaces or added spaces to begin or end of function
calls, method signature, conditions or foreachs
* Added braces to one-line ifs
* Changed multi line conditions to one line conditions
* Realigned some arrays
Change-Id: Ia04d2a99d663b07101013c2d53b3b2e872fd9cc3
Doxygen expects parameter types to come before the
parameter name in @param tags. Used a quick regex
to switch everything around where possible. This
only fixes cases where a primitve variable (or a
primitive followed by other types) is the variable
type. Other cases will need to be fixed manually.
Change-Id: Ic59fd20856eb0489d70f3469a56ebce0efb3db13
Now if the difference between $now and $then is >= 30 days, "X months
ago" or "X years ago" is returned.
Month is defined as 30 days, but it shouldn't cause problems in this
case. The "X time ago" messages are approximate anyway.
Change-Id: I228a11e23783484b64c29db94c3607a415fa81a8
Figured since a JS Timestamp class was being implemented
it might be appropriate to create a complementary PHP
Timestamp class. Much of code is taken from wfTimestamp().
Note: Another change (I53dcf547) is attempting a related
issue. Not sure how much of scope overlap there is.
Change-Id: I68eb9f27eebe80df757187f634392e1bcba5551f
Signed-off-by: Tyler Romeo <tylerromeo@gmail.com>