时间转换moment公用函数

This commit is contained in:
禺狨
2023-03-03 19:09:42 +08:00
parent 0220e608bc
commit feda1feb95
4 changed files with 74 additions and 132 deletions

View File

@@ -16,6 +16,7 @@ import styles from "./index.module.less";
import { PlusOutlined, ReloadOutlined } from "@ant-design/icons";
import { user } from "../../api/index";
import { TreeDepartment } from "../../compenents";
import { dateFormat } from "../../utils/index";
interface DataType {
id: React.Key;
@@ -61,6 +62,7 @@ export const MemberPage: React.FC = () => {
{
title: "注册时间",
dataIndex: "created_at",
render: (text: string) => <span>{dateFormat(text)}</span>,
},
{
title: "操作",

View File

@@ -1,3 +1,5 @@
import moment from "moment";
export function getToken(): string {
return window.localStorage.getItem("playedu-backend-token") || "";
}
@@ -7,5 +9,9 @@ export function setToken(token: string) {
}
export function clearToken() {
window.localStorage.removeItem("playedu-backend-token");
}
window.localStorage.removeItem("playedu-backend-token");
}
export function dateFormat(dateStr: string) {
return moment(dateStr).format("YYYY-MM-DD HH:mm");
}