MediaWiki:Gadget-morebits.js: Difference between revisions
Content deleted Content added
Amorymeltzer (talk | contribs) Repo at 97b8143: Minor jsdoc fixes and cleanup |
Amorymeltzer (talk | contribs) Repo at f27c7b2: Make unitMap available through Morebits.date.unitMap |
||
Line 1,665:
return [match[5], month, match[3], match[1], match[2]];
}
/**
* methods.
*
* @memberof Morebits.date
* @type {object.<string, string>}
*/
Morebits.date.unitMap = {
};
Line 1,731 ⟶ 1,747:
*/
add: function(number, unit) {
unit = unit.toLowerCase(); // normalize
▲ // mapping time units with getter/setter function names
var unitMap =
▲ seconds: 'Seconds',
▲ minutes: 'Minutes',
▲ hours: 'Hours',
▲ days: 'Date',
▲ months: 'Month',
▲ years: 'FullYear'
▲ };
var unitNorm = unitMap[unit] || unitMap[unit + 's']; // so that both singular and plural forms work
if (unitNorm) {
|