Content deleted Content added
PleaseStand (talk | contribs) fix IP address detection |
PleaseStand (talk | contribs) m use whole message keys in buildDurationMessage() |
||
Line 117:
items.push( mw.message(
'ps-userinfo-registration',
buildDurationMessage(
info.gender
).parse() );
Line 135:
items.push( mw.message(
'ps-userinfo-lastedited',
buildDurationMessage(
info.name
).parse() );
Line 195:
/**
* Convert a duration to a message object.
* @param {Date} start The duration's start
* @param {Date} end The duration's end
* @return {mediaWiki.Message}
*/
function buildDurationMessage(
var age = ( end - start ) / 1000; // start with seconds
if ( age < 60 ) {
return mw.message(
}
age /= 60; // convert to minutes
if ( age < 60 ) {
return mw.message(
}
age /= 60; // convert to hours
if ( age < 24 ) {
return mw.message(
}
age /= 24; // convert to days
if ( age < 7 ) {
return mw.message(
}
age /= 7; // convert to weeks
if ( age < 4.3481 ) {
return mw.message(
}
age /= 4.3481; // convert to months
if ( age < 12 ) {
return mw.message(
}
Line 234 ⟶ 233:
var years = Math.floor( age / 12 ), months = Math.floor( age % 12 );
if ( months ) {
return mw.message(
}
return mw.message(
}
|