Function: getDays

getDays(time, len, direction?): string[]

返回指定长度的天数集合 摘自:https://segmentfault.com/a/1190000013041329

Parameters

Name Type Default value Description
time string | Date undefined 日期字符串或Date对象
len number undefined 天数长度
direction 1 | 2 | 3 3 方向:1: 前几天; 2: 后几天; 3:前后几天 默认3

Returns

string[]

日期字符串数组

Example

getDays('2018-1-29', 6, 1)
// => ["2018-1-26", "2018-1-27", "2018-1-28", "2018-1-29", "2018-1-30", "2018-1-31", "2018-2-1"]

Example

getDays(new Date(2018, 0, 29), 3, 2)
// => ["2018-1-29", "2018-1-30", "2018-1-31", "2018-2-1"]
ON THIS PAGE