GitHub 6521★

Get the current quarter of a date

JavaScript version

const getQuarter = (d = new Date()) => Math.ceil((d.getMonth() + 1) / 3);

TypeScript version

const getQuarter = (d = new Date()): number => Math.ceil((d.getMonth() + 1) / 3);
Follow me on and to get more useful contents.