Skip to content

Instantly share code, notes, and snippets.

@zhaoyou
Created November 27, 2016 13:19
Show Gist options
  • Save zhaoyou/142d08d236495367ed9fae5eeb773747 to your computer and use it in GitHub Desktop.
Save zhaoyou/142d08d236495367ed9fae5eeb773747 to your computer and use it in GitHub Desktop.
关于“获得某月份的天数”
/**
* from Weibo http://weibo.com/haoel?from=feed&loc=at&nick=%E5%B7%A6%E8%80%B3%E6%9C%B5%E8%80%97%E5%AD%90&is_all=1#1480252617643
**/
days = (month === 2) ? (28 + isLeapYear) : 31 - (month - 1) % 7 % 2;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment