mirror of
https://github.com/TriliumNext/Notes.git
synced 2025-08-11 11:02:27 +08:00
chore: 🤖 use dayjs to get quarter number
This commit is contained in:
parent
dfd863161c
commit
c6a4e4c6a9
@ -11,9 +11,11 @@ import { t } from "i18next";
|
|||||||
import dayjs from "dayjs";
|
import dayjs from "dayjs";
|
||||||
import type { Dayjs } from "dayjs";
|
import type { Dayjs } from "dayjs";
|
||||||
import isSameOrAfter from "dayjs/plugin/isSameOrAfter.js";
|
import isSameOrAfter from "dayjs/plugin/isSameOrAfter.js";
|
||||||
|
import quarterOfYear from "dayjs/plugin/quarterOfYear.js";
|
||||||
import cloningService from "./cloning.js";
|
import cloningService from "./cloning.js";
|
||||||
|
|
||||||
dayjs.extend(isSameOrAfter);
|
dayjs.extend(isSameOrAfter);
|
||||||
|
dayjs.extend(quarterOfYear);
|
||||||
|
|
||||||
const CALENDAR_ROOT_LABEL = "calendarRoot";
|
const CALENDAR_ROOT_LABEL = "calendarRoot";
|
||||||
const YEAR_LABEL = "yearNote";
|
const YEAR_LABEL = "yearNote";
|
||||||
@ -191,7 +193,7 @@ function getYearNote(dateStr: string, _rootNote: BNote | null = null): BNote {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function getQuarterNumberStr(date: Dayjs) {
|
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 {
|
function getQuarterNote(quarterStr: string, _rootNote: BNote | null = null): BNote {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user