mirror of
https://github.com/zadam/trilium.git
synced 2025-12-03 22:14:24 +01:00
feat(dayjs): enable duration plugin (closes #4456)
This commit is contained in:
parent
74c11f4d4e
commit
f7f7fda040
@ -16,6 +16,11 @@ describe("dayjs", () => {
|
|||||||
expect(dayjs("2023-10-01").format("Q")).not.toBe("Q");
|
expect(dayjs("2023-10-01").format("Q")).not.toBe("Q");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("duration plugin is available", () => {
|
||||||
|
const d = dayjs.duration({ hours: 2, minutes: 30 });
|
||||||
|
expect(d.asMinutes()).toBe(150);
|
||||||
|
});
|
||||||
|
|
||||||
it("is-between is available", () => {
|
it("is-between is available", () => {
|
||||||
expect(dayjs("2023-10-02").isBetween(dayjs("2023-10-01"), dayjs("2023-10-03"))).toBe(true);
|
expect(dayjs("2023-10-02").isBetween(dayjs("2023-10-01"), dayjs("2023-10-03"))).toBe(true);
|
||||||
});
|
});
|
||||||
|
|||||||
@ -2,6 +2,7 @@ import { default as dayjs, type Dayjs } from "dayjs";
|
|||||||
|
|
||||||
//#region Plugins
|
//#region Plugins
|
||||||
import advancedFormat from "dayjs/plugin/advancedFormat.js";
|
import advancedFormat from "dayjs/plugin/advancedFormat.js";
|
||||||
|
import duration from "dayjs/plugin/duration.js";
|
||||||
import isBetween from "dayjs/plugin/isBetween.js";
|
import isBetween from "dayjs/plugin/isBetween.js";
|
||||||
import isoWeek from "dayjs/plugin/isoWeek.js";
|
import isoWeek from "dayjs/plugin/isoWeek.js";
|
||||||
import isSameOrAfter from "dayjs/plugin/isSameOrAfter.js";
|
import isSameOrAfter from "dayjs/plugin/isSameOrAfter.js";
|
||||||
@ -11,6 +12,7 @@ import utc from "dayjs/plugin/utc.js";
|
|||||||
import { LOCALE_IDS } from "./i18n.js";
|
import { LOCALE_IDS } from "./i18n.js";
|
||||||
|
|
||||||
dayjs.extend(advancedFormat);
|
dayjs.extend(advancedFormat);
|
||||||
|
dayjs.extend(duration);
|
||||||
dayjs.extend(isBetween);
|
dayjs.extend(isBetween);
|
||||||
dayjs.extend(isoWeek);
|
dayjs.extend(isoWeek);
|
||||||
dayjs.extend(isSameOrAfter);
|
dayjs.extend(isSameOrAfter);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user