Determine the first and last days of a quarter with Day.js
Determining the first and last days of a quarter is a common task for accounting applications and reporting. For web applications, I have been using Day.js (https://day.js.org/) for a long time instead of the well-known moment. There is an extension for Day.js that allows you to determine the first and last days of a quarter.
The extension is called quarterOfYear.
Here is an example of how to use it:
import dayjs from "dayjs";
import quarterOfYear from "dayjs/plugin/quarterOfYear";
dayjs.extend(quarterOfYear);
// First day of current quarter
const firstDayOfQuarter = dayjs().startOf("quarter");
// Last day of current quarter
const lastDayOfQuarter = dayjs().endOf("quarter");
console.log(firstDayOfQuarter.format("YYYY-MM-DD"));
console.log(lastDayOfQuarter.format("YYYY-MM-DD"));
If you run this script today, December 10, 2025, the result will be as follows:
2025-10-01
2025-12-31

How to return custom date format with localization in TypeScript / JavaScript
Code examples: Get date minus 1 day
First and last day in month