How to use the eachWeekOfInterval function from date-fns
Find comprehensive JavaScript date-fns.eachWeekOfInterval code examples handpicked from public code repositorys.
71 72 73 74 75 76 77 78 79 80 81
return eachDayOfInterval({start: from, end: to}) .map(start => [formatDate(start), formatDate(start)]) } function getWeeks(from = BEGINNING, to = new Date()) { return eachWeekOfInterval({start: from, end: to}, {weekStartsOn: 1}) .map(start => { const end = endOfWeek(start, {weekStartsOn: 1}) return [formatDate(start), formatDate(end)] })
1
2
0
+ 3 other calls in file
GitHub: curriei/trash-talking
114 115 116 117 118 119 120 121 122 123
} lastDay = new Date(subIntervalBreaks[subIntervalBreaks.length - 1]); subIntervalBreaks.push(dateFns.addDays(lastDay, 1)); break; case 'week': subIntervalBreaks = dateFns.eachWeekOfInterval(queryInterval); if (subIntervalBreaks.length === 0) { subIntervalBreaks = [ dateFns.startOfWeek(queryInterval['start']), dateFns.addMilliseconds(dateFns.endOfWeek(queryInterval['end']), 1)
1
0
0
23 24 25 26 27 28 29 30 31 32 33 34
} const weeks = (start, end) => { const startDate = new Date(start); const endDate = new Date(end); return eachWeekOfInterval({start: startDate, end: endDate}).map((d) => format(d, "yyyy'W'I")) } const dataSets = [ {
0
0
0
+ 3 other calls in file
date-fns.format is the most popular function in date-fns (3838 examples)