You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
16 lines
504 B
16 lines
504 B
|
3 years ago
|
import parseDate from './parseDate';
|
||
|
|
|
||
|
|
/**
|
||
|
|
* @description: 根据生日获取星座
|
||
|
|
* @param {Date|Number|String} date
|
||
|
|
* @return {String}
|
||
|
|
*/
|
||
|
|
export default function getAstro(date) {
|
||
|
|
date = parseDate(date);
|
||
|
|
const month = date.getMonth() + 1;
|
||
|
|
const day = date.getDate();
|
||
|
|
const s = '摩羯水瓶双鱼白羊金牛双子巨蟹狮子处女天秤天蝎射手摩羯';
|
||
|
|
const arr = [20, 19, 21, 20, 21, 22, 23, 23, 23, 24, 23, 22];
|
||
|
|
return s.substr(month * 2 - (day < arr[month - 1] ? 2 : 0), 2);
|
||
|
|
}
|