Рефакторинг импорта dayjs и добавление утилиты форматирования дат. Все компоненты, использующие dayjs, теперь используют новую функцию formatDate для форматирования дат с учетом локали. Также добавлена поддержка обновления локали dayjs при изменении языка в i18next.

This commit is contained in:
2025-03-23 21:58:18 +03:00
parent 3d383f2e25
commit 2901f51862
15 changed files with 75 additions and 40 deletions
@@ -33,6 +33,7 @@ import { useTranslation } from 'react-i18next'
import { getGravatarURL } from '../../../utils/gravatar'
import { ShortText } from './ShortText'
import { AttendanceData } from '../hooks'
import { formatDate } from '../../../utils/dayjs-config'
interface AttendanceTableProps {
data: AttendanceData
@@ -120,7 +121,7 @@ export const AttendanceTable: React.FC<AttendanceTableProps> = ({ data }) => {
})
// Добавляем дату
row.push(dayjs(lesson.date).format('DD.MM.YYYY'))
row.push(formatDate(lesson.date, 'DD.MM.YYYY'))
// Добавляем полное название занятия (без сокращений)
row.push(lesson.name)
@@ -230,7 +231,7 @@ export const AttendanceTable: React.FC<AttendanceTableProps> = ({ data }) => {
</Td>
)
})}
<Td>{dayjs(lesson.date).format('DD.MM.YYYY')}</Td>
<Td>{formatDate(lesson.date, 'DD.MM.YYYY')}</Td>
<Td><ShortText text={lesson.name} /></Td>
{data.students.map((st) => {