Module:Astrology
![]() |
This module was originally from page Module:Astrology in Chinese Moegirlpedia, and the license might be different from English Moegirlpedia. The contents might differ after being modified by different users on both sides. For more information, see Moegirlpedia:Copyrights.
|
This module can save the trouble of manually calculating the zodiac sign.
Usage
{{#invoke:Astrology|convert|month|day}}
Example
{{#invoke:Astrology|convert|01|08}}
Result: Capricorn
local p = {} local getArgs = require('Module:Arguments').getArgs function p._convert(args) local month = tonumber(args[1]) local day = tonumber(args[2]) if month == nil or day == nil then error('Error when invoking module or template.') end local combined = string.format('%02d%02d', month, day) if combined < '0121' then return 'Capricorn' elseif combined < '0220' then return 'Aquarius' elseif combined < '0321' then return 'Pisces' elseif combined < '0421' then return 'Aries' elseif combined < '0522' then return 'Taurus' elseif combined < '0622' then return 'Gemini' elseif combined < '0723' then return 'Cancer' elseif combined < '0823' then return 'Leo' elseif combined < '0923' then return 'Virgo' elseif combined < '1024' then return 'Libra' elseif combined < '1123' then return 'Scorpio' elseif combined < '1222' then return 'Sagittarius' else return 'Capricorn' end end function p.convert(frame) local args = getArgs(frame, {wrappers='Template:Astrology'}) return p._convert(args) end return p