lastDayOfQuarter

Modified on Thu, 24 Aug 2023

Description

Use this function to obtain the last day of a year quarter for the given date. The result will be in the local timezone.

Syntax

lastDayOfQuarter(date, options)

Returns

Return ValueDescription
DateReturns a Date object representing the last day of the year quarter for the given date in the local timezone.

Sample

ExampleResultDescription
lastDayOfQuarter(2023-04-09, { weekStartsOn: 1 })2023-06-30Returns the last day of the quarter for April 9, 2023, in the local timezone. It is adjusted to fall on the last day of the week (Monday in this case, as weekStartsOn is set to 1), resulting in June 30, 2023, which is the last day of the quarter that includes April 9, 2023.

To view all the Date functions, click here.

See Also