Method Deck / dates

Calendar quarter and fiscal year

Computes a date's calendar quarter and its fiscal quarter and fiscal year for a given fiscal-year start month.

Published for review. The Founder is checking every card himself; anything he strikes comes down the same hour.

Try it

Inputs

Outputs

Steps

  1. Parse the date as a proleptic Gregorian civil date.
  2. calendar_quarter = floor((month - 1) / 3) + 1.
  3. If fiscal_year_start_month is 1, the fiscal year always equals the calendar year (a fiscal year that starts and ends within the same January-December span cannot be named for a different year).
  4. Otherwise: if the date's month is on or after fiscal_year_start_month, the fiscal year is named for the NEXT calendar year (the fiscal year that starts this year and ends next year); if the month is before fiscal_year_start_month, it is named for the current calendar year (the fiscal year already in progress, started the prior calendar year).
  5. fiscal_quarter = floor(((month - fiscal_year_start_month + 12) mod 12) / 3) + 1.

Constants

None.

Sources

Worked example and test vectors

NameInputsAnswer
worked example{"date":"2026-09-30","fiscal_year_start_month":10}Calendar Q3 2026; fiscal Q4 FY2026
test vector: after the fiscal start{"date":"2025-11-15","fiscal_year_start_month":10}Calendar Q4 2025; fiscal Q1 FY2026
test vector: fiscal year matches calendar year{"date":"2026-05-10","fiscal_year_start_month":1}Calendar Q2 2026; fiscal Q2 FY2026

Published card