How to use the eachYearOfInterval function from date-fns
Find comprehensive JavaScript date-fns.eachYearOfInterval code examples handpicked from public code repositorys.
87 88 89 90 91 92 93 94 95 96 97
return [formatDate(start), formatDate(end)] }) } function getYears(from = BEGINNING, to = new Date()) { return eachYearOfInterval({start: from, end: to}) .map(start => { const end = endOfYear(start) return [formatDate(start), formatDate(end)] })
1
2
0
+ 3 other calls in file
GitHub: curriei/trash-talking
138 139 140 141 142 143 144 145 146 147
} lastDay = new Date(subIntervalBreaks[subIntervalBreaks.length - 1]); subIntervalBreaks.push(dateFns.addMonths(lastDay, 1)); break; case 'year': subIntervalBreaks = dateFns.eachYearOfInterval(queryInterval); if (subIntervalBreaks.length === 0) { subIntervalBreaks = [ dateFns.startOfYear(queryInterval['start']), dateFns.addMilliseconds(dateFns.endOfYear(queryInterval['end']), 1)
1
0
0
186 187 188 189 190 191 192 193 194 195
return false; if (upper && dateFns.getYear(target) > dateFns.getYear(upper)) return false; return true; }; const years = vue.computed(() => dateFns.eachYearOfInterval({ start: from.value, end: to.value, }).map((value) => ({ value,
0
0
0
+ 9 other calls in file
date-fns.format is the most popular function in date-fns (3838 examples)