From c6a4e4c6a93fc981dae24530cdffc9c446885390 Mon Sep 17 00:00:00 2001 From: Jin <22962980+JYC333@users.noreply.github.com> Date: Wed, 2 Apr 2025 19:30:06 +0200 Subject: [PATCH] =?UTF-8?q?chore:=20=F0=9F=A4=96=20use=20dayjs=20to=20get?= =?UTF-8?q?=20quarter=20number?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/services/date_notes.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/services/date_notes.ts b/src/services/date_notes.ts index fa15c3cad..6ec861968 100644 --- a/src/services/date_notes.ts +++ b/src/services/date_notes.ts @@ -11,9 +11,11 @@ import { t } from "i18next"; import dayjs from "dayjs"; import type { Dayjs } from "dayjs"; import isSameOrAfter from "dayjs/plugin/isSameOrAfter.js"; +import quarterOfYear from "dayjs/plugin/quarterOfYear.js"; import cloningService from "./cloning.js"; dayjs.extend(isSameOrAfter); +dayjs.extend(quarterOfYear); const CALENDAR_ROOT_LABEL = "calendarRoot"; const YEAR_LABEL = "yearNote"; @@ -191,7 +193,7 @@ function getYearNote(dateStr: string, _rootNote: BNote | null = null): BNote { } function getQuarterNumberStr(date: Dayjs) { - return `${date.year()}-Q${Math.floor(date.month() / 3) + 1}`; + return `${date.year()}-Q${date.quarter()}`; } function getQuarterNote(quarterStr: string, _rootNote: BNote | null = null): BNote {