chore: import locale from dayjs

This commit is contained in:
Steven
2023-04-10 23:39:27 +08:00
parent be0f2fe442
commit 87dfddcfe6
2 changed files with 8 additions and 3 deletions

View File

@ -6,7 +6,7 @@ import { useTranslation } from "react-i18next";
import { toast } from "react-hot-toast";
import ReactMarkdown from "react-markdown";
import remarkGfm from "remark-gfm";
import { useConversationStore, useConnectionStore, useMessageStore, useUserStore } from "@/store";
import { useConversationStore, useConnectionStore, useMessageStore, useUserStore, useSettingStore } from "@/store";
import { Message } from "@/types";
import Icon from "../Icon";
import { CodeBlock } from "../CodeBlock";
@ -19,6 +19,7 @@ interface Props {
const MessageView = (props: Props) => {
const message = props.message;
const { t } = useTranslation();
const settingStore = useSettingStore();
const userStore = useUserStore();
const conversationStore = useConversationStore();
const connectionStore = useConnectionStore();
@ -106,7 +107,9 @@ const MessageView = (props: Props) => {
>
{message.content}
</ReactMarkdown>
<span className="self-end text-sm text-gray-400 pt-1 pr-1">{dayjs(message.createdAt).format("lll")}</span>
<span className="self-end text-sm text-gray-400 pt-1 pr-1">
{dayjs(message.createdAt).locale(settingStore.setting.locale).format("lll")}
</span>
</div>
<div className={`invisible group-hover:visible ${showMenu && "!visible"}`}>
<button

View File

@ -5,9 +5,11 @@ import { AppProps } from "next/app";
import React, { useEffect } from "react";
import { Toaster } from "react-hot-toast";
import { useTranslation } from "react-i18next";
dayjs.extend(localizedFormat);
import { useSettingStore } from "@/store";
dayjs.extend(localizedFormat);
import "dayjs/locale/zh";
import "@/locales/i18n";
import "@/styles/tailwind.css";
import "@/styles/global.css";