This commit is contained in:
Louis Lam
2025-06-15 18:37:01 +08:00
committed by GitHub
parent 3b6a78bd80
commit 609429bd7e
2 changed files with 11 additions and 3 deletions

View File

@@ -9,9 +9,9 @@
// Frontend uses util.ts
*/
import * as dayjs from "dayjs";
import dayjsFrontend from "dayjs";
// For loading dayjs plugins, don't remove event though it is not used in this file
// For dayjs plugins' type checking, don't remove event though it is not used in this file
// eslint-disable-next-line @typescript-eslint/no-unused-vars
import * as timezone from "dayjs/plugin/timezone";
// eslint-disable-next-line @typescript-eslint/no-unused-vars
@@ -21,6 +21,13 @@ import * as jsonata from "jsonata";
export const isDev = process.env.NODE_ENV === "development";
export const isNode = typeof process !== "undefined" && process?.versions?.node;
/**
* Smarter dayjs import that supports both frontend and backend
* @returns {dayjs.Dayjs} dayjs instance
*/
const dayjs = (isNode) ? require("dayjs") : dayjsFrontend;
export const appName = "Uptime Kuma";
export const DOWN = 0;
export const UP = 1;