aboutsummaryrefslogtreecommitdiff
path: root/modern/src/settings/CalendarPage.js
diff options
context:
space:
mode:
authorAnton Tananaev <anton@traccar.org>2022-11-06 17:00:03 -0800
committerAnton Tananaev <anton@traccar.org>2022-11-06 17:00:03 -0800
commita9c8b1b6c513257a5fd69cf00992d4fec59d6069 (patch)
treeb2fa1bd33ae8766affb4ac1cfdba2dde5a9a54de /modern/src/settings/CalendarPage.js
parent4d6d5eca8c6ee8c43340d18d323816885edeb9da (diff)
downloadtrackermap-web-a9c8b1b6c513257a5fd69cf00992d4fec59d6069.tar.gz
trackermap-web-a9c8b1b6c513257a5fd69cf00992d4fec59d6069.tar.bz2
trackermap-web-a9c8b1b6c513257a5fd69cf00992d4fec59d6069.zip
Respect 12 hour time
Diffstat (limited to 'modern/src/settings/CalendarPage.js')
-rw-r--r--modern/src/settings/CalendarPage.js10
1 files changed, 5 insertions, 5 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}`) });
}}
/>