feat: implement date display utility across various pages

- Added `useDateDisplayer` hook and `dateDisplayer` function to format dates consistently based on the user's language.
- Updated multiple components and pages in both backoffice and portal applications to utilize the new date display functionality, ensuring proper formatting for dates in lists, tables, and detail views.
- Introduced Ethiopian date formatting for Amharic language support.
- Refactored date handling in components such as ExamAppealsPage, ResultPage, SeafarerRegistryPage, and others to improve localization and user experience.
This commit is contained in:
estifanos
2026-08-12 10:22:39 +00:00
parent 33935419fb
commit 9897a9bf78
30 changed files with 286 additions and 168 deletions

View File

@@ -2,6 +2,7 @@ import { Table, Badge, ActionIcon, Text } from '@mantine/core';
import { IconTrash } from '@tabler/icons-react';
import { useGetItemsQuery, useDeleteItemMutation, type Item } from '../api/item-api';
import { notify, useErrorHandler } from '@ema-platform/ui';
import { useDateDisplayer } from '@ema-platform/shared';
const STATUS_COLORS: Record<Item['status'], string> = {
DRAFT: 'gray',
@@ -13,6 +14,7 @@ export function ItemTable() {
const { data, isLoading } = useGetItemsQuery({});
const [deleteItem] = useDeleteItemMutation();
const { handleError } = useErrorHandler();
const showDate = useDateDisplayer();
const handleDelete = async (id: string) => {
try {
@@ -43,7 +45,7 @@ export function ItemTable() {
<Table.Td>
<Badge color={STATUS_COLORS[item.status]}>{item.status}</Badge>
</Table.Td>
<Table.Td>{new Date(item.createdAt).toLocaleDateString()}</Table.Td>
<Table.Td>{showDate(item.createdAt)}</Table.Td>
<Table.Td>
<ActionIcon
color="red"