UNPKG

@wener/console

Version:

Base console UI toolkit

39 lines (38 loc) 1.28 kB
"use client"; import React from "react"; import { Toaster } from "react-hot-toast"; import dayjs from "dayjs"; import advancedFormat from "dayjs/plugin/advancedFormat"; import dayOfYear from "dayjs/plugin/dayOfYear"; import duration from "dayjs/plugin/duration"; import isToday from "dayjs/plugin/isToday"; import relativeTime from "dayjs/plugin/relativeTime"; import timezone from "dayjs/plugin/timezone"; import utc from "dayjs/plugin/utc"; import { DaisyTheme } from "../../daisy/index.js"; import { useExposeDebug } from "../../hooks/index.js"; let init = false; export const StaticRootReactor = () => { useExposeDebug({ dayjs }); if (!init) { init = true; setupDayjs(); } return /*#__PURE__*/ React.createElement(React.Fragment, null, /*#__PURE__*/ React.createElement(Toaster, null), /*#__PURE__*/ React.createElement(DaisyTheme.Sidecar, null)); }; function setupDayjs() { dayjs.extend(relativeTime); dayjs.extend(duration); dayjs.extend(advancedFormat); dayjs.extend(isToday); dayjs.extend(dayOfYear); // dayjs.extend(quarterOfYear); // dayjs.extend(localeData); dayjs.extend(utc); dayjs.extend(timezone); dayjs.locale("zh-cn"); dayjs.tz.setDefault("Asia/Shanghai"); return dayjs; }