date-fns#eachYearOfInterval TypeScript Examples
The following examples show how to use
date-fns#eachYearOfInterval.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: quarter.ts From ngx-gantt with MIT License | 6 votes |
getPrimaryDatePoints(): GanttDatePoint[] {
const years = eachYearOfInterval({ start: this.start.value, end: this.end.value });
const points: GanttDatePoint[] = [];
for (let i = 0; i < years.length; i++) {
const start = new GanttDate(years[i]);
const point = new GanttDatePoint(
start,
`${start.format(this.options.dateFormat.year)}`,
(this.getCellWidth() * 4) / 2 + i * (this.getCellWidth() * 4),
primaryDatePointTop
);
points.push(point);
}
return points;
}
Example #2
Source File: year.ts From ngx-gantt with MIT License | 6 votes |
getPrimaryDatePoints(): GanttDatePoint[] {
const years = eachYearOfInterval({ start: this.start.value, end: this.end.value });
const points: GanttDatePoint[] = [];
for (let i = 0; i < years.length; i++) {
const start = new GanttDate(years[i]);
const point = new GanttDatePoint(start, ``, this.getCellWidth() / 2 + i * this.getCellWidth(), primaryDatePointTop);
points.push(point);
}
return points;
}
Example #3
Source File: formatters.ts From mStable-apps with GNU Lesser General Public License v3.0 | 5 votes |
periodIntervalMapping: Record<TimeMetricPeriod, (interval: Interval) => Date[]> = {
[TimeMetricPeriod.Hour]: eachHourOfInterval,
[TimeMetricPeriod.Day]: eachDayOfInterval,
[TimeMetricPeriod.Week]: eachWeekOfInterval,
[TimeMetricPeriod.Month]: eachMonthOfInterval,
[TimeMetricPeriod.Quarter]: eachQuarterOfInterval,
[TimeMetricPeriod.Year]: eachYearOfInterval,
}