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
"seconds" => 1000, // 1000 milliseconds per second
"minutes" => 60, // 60 seconds per minute
"hours" => 60, // 60 minutes per hour
"seconds" => 1000, // 1000 milliseconds per second
"minutes" => 60, // 60 seconds per minute
"hours" => 60, // 60 minutes per hour
- "days" => 24 // 24 hours per day
+ "days" => 24, // 24 hours per day
+ "months" => 30, // approximately 30 days per month
+ "years" => 12, // 12 months per year
'minutes' => '{{PLURAL:$1|$1 minute|$1 minutes}}',
'hours' => '{{PLURAL:$1|$1 hour|$1 hours}}',
'days' => '{{PLURAL:$1|$1 day|$1 days}}',
'minutes' => '{{PLURAL:$1|$1 minute|$1 minutes}}',
'hours' => '{{PLURAL:$1|$1 hour|$1 hours}}',
'days' => '{{PLURAL:$1|$1 day|$1 days}}',
+'months' => '{{PLURAL:$1|$1 month|$1 months}}',
+'years' => '{{PLURAL:$1|$1 year|$1 years}}',
'ago' => '$1 ago',
'just-now' => 'just now',
'ago' => '$1 ago',
'just-now' => 'just now',
Part of variable $1 in {{msg-mw|Ago}}
{{Identical|Day}}',
Part of variable $1 in {{msg-mw|Ago}}
{{Identical|Day}}',
+'months' => 'Full word for "months". $1 is the number of months.
+
+Part of variable $1 in {{msg-mw|Ago}}',
+'years' => 'Full word for "years". $1 is the number of years.
+
+Part of variable $1 in {{msg-mw|Ago}}',
'ago' => 'Phrase for indicating how long ago something happened. $1 is something like "3 days 10 hours", taken from these messages:
*{{msg-mw|Seconds}}
*{{msg-mw|Minutes}}
*{{msg-mw|Hours}}
'ago' => 'Phrase for indicating how long ago something happened. $1 is something like "3 days 10 hours", taken from these messages:
*{{msg-mw|Seconds}}
*{{msg-mw|Minutes}}
*{{msg-mw|Hours}}
+*{{msg-mw|Days}}
+*{{msg-mw|Months}}
+*{{msg-mw|Years}}',
+
'just-now' => 'Phrase for indicating something happened just now.',
# Bad image list
'just-now' => 'Phrase for indicating something happened just now.',
# Bad image list
'minutes',
'hours',
'days',
'minutes',
'hours',
'days',
function testHumanOutput() {
$timestamp = new MWTimestamp( time() - 3600 );
$this->assertEquals( "1 hour ago", $timestamp->getHumanTimestamp()->inLanguage( 'en' )->text() );
function testHumanOutput() {
$timestamp = new MWTimestamp( time() - 3600 );
$this->assertEquals( "1 hour ago", $timestamp->getHumanTimestamp()->inLanguage( 'en' )->text() );
+ $timestamp = new MWTimestamp( time() - 5184000 );
+ $this->assertEquals( "2 months ago", $timestamp->getHumanTimestamp()->inLanguage( 'en' )->text() );
+ $timestamp = new MWTimestamp( time() - 31536000 );
+ $this->assertEquals( "1 year ago", $timestamp->getHumanTimestamp()->inLanguage( 'en' )->text() );