diff options
Diffstat (limited to 'modern/src/settings/MaintenancesPage.jsx')
-rw-r--r-- | modern/src/settings/MaintenancesPage.jsx | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/modern/src/settings/MaintenancesPage.jsx b/modern/src/settings/MaintenancesPage.jsx index 2a66590c..9241eb3e 100644 --- a/modern/src/settings/MaintenancesPage.jsx +++ b/modern/src/settings/MaintenancesPage.jsx @@ -1,4 +1,5 @@ import React, { useState } from 'react'; +import dayjs from 'dayjs'; import { Table, TableRow, TableCell, TableHead, TableBody, } from '@mui/material'; @@ -42,8 +43,14 @@ const MaintenacesPage = () => { } }, [timestamp]); - const convertAttribute = (key, value) => { + const convertAttribute = (key, start, value) => { const attribute = positionAttributes[key]; + if (key.endsWith('Time')) { + if (start) { + return dayjs(value).locale('en').format('YYYY-MM-DD'); + } + return `${value / 86400000} ${t('sharedDays')}`; + } if (attribute && attribute.dataType) { switch (attribute.dataType) { case 'speed': @@ -76,8 +83,8 @@ const MaintenacesPage = () => { <TableRow key={item.id}> <TableCell>{item.name}</TableCell> <TableCell>{item.type}</TableCell> - <TableCell>{convertAttribute(item.type, item.start)}</TableCell> - <TableCell>{convertAttribute(item.type, item.period)}</TableCell> + <TableCell>{convertAttribute(item.type, true, item.start)}</TableCell> + <TableCell>{convertAttribute(item.type, false, item.period)}</TableCell> <TableCell className={classes.columnAction} padding="none"> <CollectionActions itemId={item.id} editPath="/settings/maintenance" endpoint="maintenance" setTimestamp={setTimestamp} /> </TableCell> |