function getRangeOfDates(start: moment.Moment, end: moment.Moment, key: moment.DurationInputArg2, arr = [start.startOf(key)]): moment.Moment[] {
if(start.isAfter(end)) throw new Error("start must precede end")
const next = moment(start).add(1, key).startOf(key)
if(next.isAfter(end, key)) return arr
return getRangeOfDates(next, end, key, arr.concat(next))
}
'Develop' 카테고리의 다른 글
nodeJs Buffer (0) | 2021.04.09 |
---|---|
aws elasticcache MOVED 문제 (0) | 2021.02.02 |
ecs-params: assign_public_ip (0) | 2020.06.02 |
node packages github branch로 사용 (0) | 2020.05.26 |
mysql index hint (0) | 2020.03.26 |