星座计算

星座查询器

function getZodiac(date) { var zodiacs = [ { sign: "鼠", start: new Date(date.getFullYear(), 0, 25), end: new Date(date.getFullYear(), 1, 11) }, { sign: "牛", start: new Date(date.getFullYear(), 1, 12), end: new Date(date.getFullYear(), 2, 30) }, { sign: "虎", start: new Date(date.getFullYear(), 2, 31), end: new Date(date.getFullYear(), 4, 17) }, { sign: "兔", start: new Date(date.getFullYear(), 4, 18), end: new Date(date.getFullYear(), 6, 5) }, { sign: "龙", start: new Date(date.getFullYear(), 6, 6), end: new Date(date.getFullYear(), 7, 23) }, { sign: "蛇", start: new Date(date.getFullYear(), 7, 24), end: new Date(date.getFullYear(), 9, 10) }, { sign: "马", start: new Date(date.getFullYear(), 9, 11), end: new Date(date.getFullYear(), 10, 29) }, { sign: "羊", start: new Date(date.getFullYear(), 10, 30), end: new Date(date.getFullYear(), 11, 17) }, { sign: "猴", start: new Date(date.getFullYear(), 11, 18), end: new Date(date.getFullYear() + 1, 0, 5) }, { sign: "鸡", start: new Date(date.getFullYear() + 1, 0, 6), end: new Date(date.getFullYear() + 1, 1, 25) }, { sign: "狗", start: new Date(date.getFullYear() + 1, 1, 26), end: new Date(date.getFullYear() + 1, 3, 13) }, { sign: "猪", start: new Date(date.getFullYear() + 1, 3, 14), end: new Date(date.getFullYear() + 1, 4, 1) } ]; var zodiac = zodiacs.find(function(z) { return date >= z.start && date <= z.end; }); return zodiac ? zodiac.sign : ""; } function getZodiacSign(date) { var signs = [ { sign: "水瓶座", start: new Date(date.getFullYear(), 0, 20), end: new Date(date.getFullYear(), 1, 18) }, { sign: "双鱼座", start: new Date(date.getFullYear(), 1, 19), end: new Date(date.getFullYear(), 2, 20) }, { sign: "白羊座", start: new Date(date.getFullYear(), 2, 21), end: new Date(date.getFullYear(), 3, 19) }, { sign: "金牛座", start: new Date(date.getFullYear(), 3, 20), end: new Date(date.getFullYear(), 4, 20) }, { sign: "双子座", start: new Date(date.getFullYear(), 4, 21), end: new Date(date.getFullYear(), 5, 20) }, { sign: "巨蟹座", start: new Date(date.getFullYear(), 5, 21), end: new Date(date.getFullYear(), 6, 22) }, { sign: "狮子座", start: new Date(date.getFullYear(), 6, 23), end: new Date(date.getFullYear(), 7, 22) }, { sign: "