Content deleted Content added
try adding spellout tests using the #time parser function |
No edit summary |
||
Line 42:
self:preprocess_equals('{{#invoke:TimeAgo/sandbox|main|{{#time: r | -4 years -14 days}}|magnitude=years|spellout=auto}}', 'four years ago')
self:preprocess_equals('{{#invoke:TimeAgo/sandbox|main|July 1 2009|magnitude=weeks|spellout=yes}}', weekssincejul09 .. ' weeks ago') -- [[Module:NumberSpell]] can only spell numbers up to 100.
self:preprocess_equals_preprocess('{{#invoke:TimeAgo/sandbox|main|{{REVISIONTIMESTAMP}}|magnitude=days}}', '{{#expr:floor(({{LOCALTIMESTAMP}}-{{REVISIONTIMESTAMP}})/86400)}} days ago')
self:preprocess_equals_preprocess('{{#invoke:TimeAgo/sandbox|main|{{REVISIONTIMESTAMP}}|magnitude=hours}}', '{{#expr:floor(({{LOCALTIMESTAMP}}-{{REVISIONTIMESTAMP}})/3600)}} hours ago')
self:preprocess_equals_preprocess('{{#invoke:TimeAgo/sandbox|main|{{REVISIONTIMESTAMP}}|magnitude=minutes}}', '{{#expr:floor(({{LOCALTIMESTAMP}}-{{REVISIONTIMESTAMP}})/60)}} minutes ago')
self:preprocess_equals_preprocess('{{#invoke:TimeAgo/sandbox|main|{{REVISIONTIMESTAMP}}|magnitude=seconds}}', '{{#expr:floor(({{LOCALTIMESTAMP}}-{{REVISIONTIMESTAMP}}))}} seconds ago')
end
|