项目作者: zancheng

项目描述 :
The calculation of the week
高级语言: JavaScript
项目地址: git://github.com/zancheng/weekCalculation.git
创建时间: 2018-07-24T07:52:58Z
项目社区:https://github.com/zancheng/weekCalculation

开源协议:

下载


weekCalculation

The calculation of the week

  1. * 判断规则:
  2. 第一周--是这个月的新一周,且不在上个月最后一周内。*

String.prototype.dateIndexInYear

获取这一天属于今年的第多少天

  1. 默认时间是今天,调用方法示例:
  2. '2018/10/1'.dateIndexInYear()
  3. 返回: 273

String.prototype.weekIndexInYear

获取这一天属于今年的第多少周

  1. 默认时间是今天,调用方法示例:
  2. '2018-10-1'.weekIndexInYear()
  3. 返回: 39

String.prototype.weekInMonthCount

获取这一年的这一月的有多少周

  1. 默认时间是今天,调用方法示例:
  2. '2018-10-1'.weekInMonthCount()
  3. 返回: 5

String.prototype.weekIndexInMonth

获取这一周属于本月第多少周

  1. 如果属于上个月,返回 -1
  2. 默认时间是今天,调用方法示例:
  3. '2018-10-01'.weekIndexInMonth()
  4. 返回: 1

String.prototype.getWeekRange

获取这一周的区间范围,返回的是数组
默认时间是今天,调用方法示例:

  1. '2019-06-05'.getWeekRange()
  2. 返回: ["2019/06/03", "2019/06/09"]