Skip to content

Instantly share code, notes, and snippets.

@tychio
Last active December 14, 2015 11:39
Show Gist options
  • Save tychio/5080752 to your computer and use it in GitHub Desktop.
Save tychio/5080752 to your computer and use it in GitHub Desktop.
month and day to constellation
/**
* get constellation string
* @param p_m[number] month 1-12
* @param p_d[day] 1-31
* @return[string] constellation name
**/
function constellation (p_m, p_d) {
var _name = '魔羯水瓶双鱼牡羊金牛双子巨蟹狮子处女天秤天蝎射手魔羯';
var _day = [20,19,21,20,21,22,23,23,23,24,23,22];
var _sign = p_m * 2 - (p_d < _day[p_m - 1] ? 2 : 0);
return _name.substring(_sign, _sign + 2) + '座';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment