MSP-3289 update date format in project

This commit is contained in:
veselovnk committed 2024-05-20 13:22:52 +03:00
1 parent f9559055be
commit b9f6de6968
10 files changed
+31 -18

No files matched your search

@@ -16,6 +16,7 @@ import { ColumnsType } from 'antd/es/table'
import './active-configurations-table.scss'
import dayjs from 'dayjs'
import CanEdit from '@components/CanEdit'
import { dateFormats } from '@constants/date.ts'
const ActiveConfigurationsTable: FC<ActiveConfigurationsTablePropsType> =
@@ -167,7 +168,7 @@ const ActiveConfigurationsTable: FC<ActiveConfigurationsTablePropsType> =
key: 'updatedAt',
align: 'center',
render: (value: string) => {
return dayjs(value).format('HH:mm:ss DD.MM.YYYY')
return dayjs(value).format(dateFormats.fullFormat)
}
},
{
+2 -1
View File
@@ -19,6 +19,7 @@ import { VersionType } from '@type/version.type'
import './compare-version-modal.scss'
import dayjs from 'dayjs'
import { dateFormats } from '@constants/date.ts'
const Original = CodeMirrorMerge.Original
@@ -52,7 +53,7 @@ const CompareVersionModal: FC<CompareVersionModalPropsType> = ({
title: 'Создано',
dataIndex: 'createdAt',
render: (value: string) => {
return dayjs(value).format('HH:mm:ss DD.MM.YYYY')
return dayjs(value).format(dateFormats.fullFormat)
}
},
{
+3 -4
View File
@@ -24,6 +24,7 @@ import tokensApi from '@services/tokensService.ts'
import './tokens.scss'
import CanEdit from '@components/CanEdit'
import { dateFormats } from '@constants/date.ts'
const { FormSelect } = FormComponents
const { EmptyData } = Layout
@@ -120,8 +121,7 @@ const TokenContent = ({ id }: TokenPropTypes) => {
dataIndex: 'createdAt',
key: 'createdAt',
render: (record) => {
const FULL_DATE_FORMAT = 'DD-MM-YYYY/HH:mm'
const formatTime = dayjs(record.createdAt).format(FULL_DATE_FORMAT)
const formatTime = dayjs(record.createdAt).format(dateFormats.fullFormat)
return <div>{formatTime}</div>
}
},
@@ -142,10 +142,9 @@ const TokenContent = ({ id }: TokenPropTypes) => {
dataIndex: 'expireTime',
key: 'expireTime',
render: (value, record) => {
const FULL_DATE_FORMAT = 'DD-MM-YYYY, HH:mm'
const formatTime = dayjs(record.createdAt)
.add(record.expireTime)
.format(FULL_DATE_FORMAT)
.format(dateFormats.fullFormat)
return value > 0 ? <span>{formatTime}</span> : <span> Никогда </span>
}
+6
View File
@@ -0,0 +1,6 @@
type FormattersKey = 'fullFormat'
export const dateFormats:Record<FormattersKey,string> = {
fullFormat: 'DD.MM.YYYY HH:mm:ss'
}
+2 -1
View File
@@ -28,6 +28,7 @@ import { PermissionKeysType } from '@type/roles.type.ts'
import { VersionType } from '@type/version.type.ts'
import './all-versions-page.scss'
import { dateFormats } from '@constants/date.ts'
const AllVersionsPage = () => {
@@ -157,7 +158,7 @@ const AllVersionsPage = () => {
title: 'Создано',
dataIndex: 'createdAt',
render: (value: string) => {
return dayjs(value).format('HH:mm:ss DD.MM.YYYY')
return dayjs(value).format(dateFormats.fullFormat)
}
},
{
+2 -1
View File
@@ -16,6 +16,7 @@ import { PermissionKeysType } from '@type/roles.type.ts'
import './connections.scss'
import dayjs from 'dayjs'
import relativeTime from 'dayjs/plugin/relativeTime'
import { dateFormats } from '@constants/date.ts'
const Connections = () => {
const { data: ConnectionsList = [], isLoading: isModulesLoading } =
@@ -51,7 +52,7 @@ const Connections = () => {
}
const formatFullDate = (obj: string) =>
dayjs(obj).format('YYYY-MM-DD, HH:mm:ss')
dayjs(obj).format(dateFormats.fullFormat)
const keySelector = ({
address: { ip, port },
+3 -2
View File
@@ -16,6 +16,8 @@ import { LogType } from '@type/log.type'
import { PermissionKeysType } from '@type/roles.type'
import './security-log-page.scss'
import dayjs from 'dayjs'
import { dateFormats } from '@constants/date.ts'
const limit = 10
@@ -75,8 +77,7 @@ const SecurityLogPage = () => {
dataIndex: 'createdAt',
key: 'createdAt',
render: (value) => {
const date = new Date(value)
return `${date.toLocaleDateString()} ${date.toLocaleTimeString()}`
return dayjs(value).format(dateFormats.fullFormat)
}
},
{
+4 -4
View File
@@ -29,6 +29,8 @@ import { PermissionKeysType } from '@type/roles.type.ts'
import { SessionType } from '@type/session.type'
import './sessions-page.scss'
import dayjs from 'dayjs'
import { dateFormats } from '@constants/date.ts'
const limit = 10
@@ -96,8 +98,7 @@ const SessionsPage = () => {
dataIndex: 'createdAt',
key: 'createdAt',
render: (value) => {
const date = new Date(value)
return `${date.toLocaleDateString()} ${date.toLocaleTimeString()}`
return dayjs(value).format(dateFormats.fullFormat)
}
},
{
@@ -105,8 +106,7 @@ const SessionsPage = () => {
dataIndex: 'expiredAt',
key: 'expiredAt',
render: (value) => {
const date = new Date(value)
return `${date.toLocaleDateString()} ${date.toLocaleTimeString()}`
return dayjs(value).format(dateFormats.fullFormat)
}
},
{
+4 -3
View File
@@ -1,10 +1,12 @@
import { ArrowLeftOutlined, SaveOutlined } from '@ant-design/icons'
import { Button, message, Spin } from 'antd'
import dayjs from 'dayjs'
import { FormComponents } from 'isp-ui-kit'
import { useEffect } from 'react'
import { useForm } from 'react-hook-form'
import { useLocation, useNavigate } from 'react-router-dom'
import { dateFormats } from '@constants/date.ts'
import { ValidationRules } from '@constants/form/validationRules.ts'
import { findExclusiveRole } from '@utils/roleUtils.ts'
@@ -23,6 +25,7 @@ import { LabelItem } from 'isp-ui-kit/dist/FormComponents/formTypes'
import './user-editor.scss'
const UserEditor = () => {
const location = useLocation()
const navigate = useNavigate()
@@ -166,9 +169,7 @@ const UserEditor = () => {
{state.lastSessionCreatedAt && (
<>
Последняя сессия &nbsp;
{new Date(state.lastSessionCreatedAt).toLocaleDateString()}
&nbsp;
{new Date(state.lastSessionCreatedAt).toLocaleTimeString()}
{dayjs(state.lastSessionCreatedAt).format(dateFormats.fullFormat)}
</>
)}
</span>
+3 -1
View File
@@ -25,6 +25,8 @@ import { PermissionKeysType } from '@type/roles.type.ts'
import { UserType } from '@type/user.type.ts'
import './users-page.scss'
import dayjs from 'dayjs'
import { dateFormats } from '@constants/date.ts'
const UsersPage = () => {
const { data: allUsers = [], isLoading: isUsersLoading } =
@@ -124,7 +126,7 @@ const UsersPage = () => {
dataIndex: 'lastSessionCreatedAt',
key: 'lastSessionCreatedAt',
render: (value: string) =>
value ? new Date(value).toLocaleDateString() : ''
value ? dayjs(value).format(dateFormats.fullFormat) : ''
},
{
dataIndex: 'actions',