Fix time render bug.

This commit is contained in:
Paulo Gustavo Veiga 2022-02-07 21:06:02 -08:00
parent 46823ccc3e
commit b892c25e3c
4 changed files with 14 additions and 5 deletions

View File

@ -66,7 +66,7 @@
"@wisemapping/editor": "^0.4.0",
"@wisemapping/mindplot": "^5.0.2",
"axios": "^0.21.0",
"dayjs": "^1.10.4",
"dayjs": "^1.10.7",
"react": "^17.0.2",
"react-dom": "^17.0.0",
"react-ga": "^3.3.0",

View File

@ -96,7 +96,7 @@ class MockClient implements Client {
12,
false,
'El Mapa3',
[label2, label3],
[label2, label3],
'Paulo3',
'2008-06-02T00:00:00Z',
'Berna',
@ -109,6 +109,7 @@ class MockClient implements Client {
this.labels = [label1, label2, label3];
}
fetchMindmap(id: number): Mindmap {
const parser = new DOMParser();
const xmlDoc = parser.parseFromString(`
@ -254,6 +255,7 @@ class MockClient implements Client {
});
}
}
fetchHistory(id: number): Promise<ChangeHistory[]> {
console.log(`Fetching history for ${id}`);
const result = [

View File

@ -12,6 +12,12 @@ import Card from '@mui/material/Card';
import ListItem from '@mui/material/ListItem';
import Typography from '@mui/material/Typography';
import List from '@mui/material/List';
import LocalizedFormat from 'dayjs/plugin/localizedFormat';
// Load fromNow pluggin
dayjs.extend(LocalizedFormat)
const InfoDialog = ({ mapId, onClose }: SimpleDialogProps): React.ReactElement => {
const { map } = fetchMapById(mapId);
@ -99,7 +105,7 @@ const InfoDialog = ({ mapId, onClose }: SimpleDialogProps): React.ReactElement =
:
</Typography>
<Typography variant="body2">
{dayjs(map?.creationTime).format('lll')}
{dayjs(map?.creationTime).format('LLL')}
</Typography>
</ListItem>
@ -131,7 +137,7 @@ const InfoDialog = ({ mapId, onClose }: SimpleDialogProps): React.ReactElement =
:
</Typography>
<Typography variant="body2">
{dayjs(map?.lastModificationTime).format('lll')}
{dayjs(map?.lastModificationTime).format('LLL')}
</Typography>
</ListItem>

View File

@ -36,8 +36,9 @@ import SearchIcon from '@mui/icons-material/Search';
import { AddLabelButton } from './add-label-button';
import relativeTime from 'dayjs/plugin/relativeTime';
import { LabelsCell } from './labels-cell';
import LocalizedFormat from 'dayjs/plugin/localizedFormat';
// Load fromNow pluggin
dayjs.extend(LocalizedFormat)
dayjs.extend(relativeTime);
function descendingComparator<T>(a: T, b: T, orderBy: keyof T) {