diff options
Diffstat (limited to 'modern/src/settings')
-rw-r--r-- | modern/src/settings/CalendarPage.js | 10 | ||||
-rw-r--r-- | modern/src/settings/UsersPage.js | 5 |
2 files changed, 9 insertions, 6 deletions
diff --git a/modern/src/settings/CalendarPage.js b/modern/src/settings/CalendarPage.js index 81f0021d..17848484 100644 --- a/modern/src/settings/CalendarPage.js +++ b/modern/src/settings/CalendarPage.js @@ -13,7 +13,7 @@ import { useTranslation } from '../common/components/LocalizationProvider'; import SettingsMenu from './components/SettingsMenu'; import { prefixString } from '../common/util/stringUtils'; -const formatTime = (time) => { +const formatCalendarTime = (time) => { const tzid = Intl.DateTimeFormat().resolvedOptions().timeZone; return `TZID=${tzid}:${time.locale('en').format('YYYYMMDDTHHmmss')}`; }; @@ -47,8 +47,8 @@ const simpleCalendar = () => window.btoa([ 'PRODID:-//Traccar//NONSGML Traccar//EN', 'BEGIN:VEVENT', 'UID:00000000-0000-0000-0000-000000000000', - `DTSTART;${formatTime(moment())}`, - `DTEND;${formatTime(moment().add(1, 'hours'))}`, + `DTSTART;${formatCalendarTime(moment())}`, + `DTEND;${formatCalendarTime(moment().add(1, 'hours'))}`, 'RRULE:FREQ=DAILY', 'SUMMARY:Event', 'END:VEVENT', @@ -133,7 +133,7 @@ const CalendarPage = () => { type="datetime-local" value={moment(lines[5].slice(-15)).locale('en').format(moment.HTML5_FMT.DATETIME_LOCAL)} onChange={(e) => { - const time = formatTime(moment(e.target.value, moment.HTML5_FMT.DATETIME_LOCAL)); + const time = formatCalendarTime(moment(e.target.value, moment.HTML5_FMT.DATETIME_LOCAL)); setItem({ ...item, data: updateCalendar(lines, 5, `DTSTART;${time}`) }); }} /> @@ -142,7 +142,7 @@ const CalendarPage = () => { type="datetime-local" value={moment(lines[6].slice(-15)).locale('en').format(moment.HTML5_FMT.DATETIME_LOCAL)} onChange={(e) => { - const time = formatTime(moment(e.target.value, moment.HTML5_FMT.DATETIME_LOCAL)); + const time = formatCalendarTime(moment(e.target.value, moment.HTML5_FMT.DATETIME_LOCAL)); setItem({ ...item, data: updateCalendar(lines, 6, `DTEND;${time}`) }); }} /> diff --git a/modern/src/settings/UsersPage.js b/modern/src/settings/UsersPage.js index bdebb1bb..6cb10d25 100644 --- a/modern/src/settings/UsersPage.js +++ b/modern/src/settings/UsersPage.js @@ -14,6 +14,7 @@ import CollectionActions from './components/CollectionActions'; import TableShimmer from '../common/components/TableShimmer'; import { useAdministrator } from '../common/util/permissions'; import SearchHeader, { filterByKeyword } from './components/SearchHeader'; +import { usePreference } from '../common/util/preferences'; const useStyles = makeStyles((theme) => ({ columnAction: { @@ -28,6 +29,8 @@ const UsersPage = () => { const admin = useAdministrator(); + const hours12 = usePreference('twelveHourFormat'); + const [timestamp, setTimestamp] = useState(Date.now()); const [items, setItems] = useState([]); const [searchKeyword, setSearchKeyword] = useState(''); @@ -83,7 +86,7 @@ const UsersPage = () => { <TableCell>{item.email}</TableCell> <TableCell>{formatBoolean(item.administrator, t)}</TableCell> <TableCell>{formatBoolean(item.disabled, t)}</TableCell> - <TableCell>{formatTime(item.expirationTime, 'YYYY-MM-DD')}</TableCell> + <TableCell>{formatTime(item.expirationTime, 'date', hours12)}</TableCell> <TableCell className={classes.columnAction} padding="none"> <CollectionActions itemId={item.id} |