eachQuarterOfInterval

返回指定时间间隔内的所有季度。

import { eachQuarterOfInterval } from "date-fns";

// 示例时间间隔
const startDate = new Date(2024, 0, 1); // 2024年1月1日
const endDate = new Date(2024, 11, 31); // 2024年12月31日

// 返回指定时间间隔内的所有季度
const quarters = eachQuarterOfInterval({ start: startDate, end: endDate });

console.log("指定时间间隔内的所有季度:", quarters);
// 指定时间间隔内的所有季度:[
//   Tue Jan 01 2024 00:00:00 GMT+0800 (China Standard Time),
//   Tue Apr 01 2024 00:00:00 GMT+0800 (China Standard Time),
//   Mon Jul 01 2024 00:00:00 GMT+0800 (China Standard Time),
//   Mon Oct 01 2024 00:00:00 GMT+0800 (China Standard Time)
// ]