diff options
author | Anton Tananaev <anton@traccar.org> | 2023-09-04 10:53:05 -0700 |
---|---|---|
committer | Anton Tananaev <anton@traccar.org> | 2023-09-04 10:53:05 -0700 |
commit | 9a59d6524c45d5542433302a498f9ada4e45e806 (patch) | |
tree | b779287db9104054ca5fbecf9f6218b2db46d8fe /modern/src/settings/CalendarPage.jsx | |
parent | 63eaa20047613c872979e2894fbdb5a0caab31f7 (diff) | |
download | trackermap-web-9a59d6524c45d5542433302a498f9ada4e45e806.tar.gz trackermap-web-9a59d6524c45d5542433302a498f9ada4e45e806.tar.bz2 trackermap-web-9a59d6524c45d5542433302a498f9ada4e45e806.zip |
Migrate to DayJs from moment
Diffstat (limited to 'modern/src/settings/CalendarPage.jsx')
-rw-r--r-- | modern/src/settings/CalendarPage.jsx | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/modern/src/settings/CalendarPage.jsx b/modern/src/settings/CalendarPage.jsx index 2868d3d5..099858a3 100644 --- a/modern/src/settings/CalendarPage.jsx +++ b/modern/src/settings/CalendarPage.jsx @@ -1,4 +1,4 @@ -import moment from 'moment'; +import dayjs from 'dayjs'; import React, { useState } from 'react'; import { useDispatch } from 'react-redux'; import TextField from '@mui/material/TextField'; @@ -53,8 +53,8 @@ const simpleCalendar = () => window.btoa([ 'PRODID:-//Traccar//NONSGML Traccar//EN', 'BEGIN:VEVENT', 'UID:00000000-0000-0000-0000-000000000000', - `DTSTART;${formatCalendarTime(moment())}`, - `DTEND;${formatCalendarTime(moment().add(1, 'hours'))}`, + `DTSTART;${formatCalendarTime(dayjs())}`, + `DTEND;${formatCalendarTime(dayjs().add(1, 'hours'))}`, 'RRULE:FREQ=DAILY', 'SUMMARY:Event', 'END:VEVENT', @@ -148,18 +148,18 @@ const CalendarPage = () => { <TextField label={t('reportFrom')} type="datetime-local" - value={moment(lines[5].slice(-15)).locale('en').format(moment.HTML5_FMT.DATETIME_LOCAL)} + value={dayjs(lines[5].slice(-15)).locale('en').format('YYYY-MM-DDTHH:mm')} onChange={(e) => { - const time = formatCalendarTime(moment(e.target.value, moment.HTML5_FMT.DATETIME_LOCAL)); + const time = formatCalendarTime(dayjs(e.target.value, 'YYYY-MM-DDTHH:mm')); setItem({ ...item, data: updateCalendar(lines, 5, `DTSTART;${time}`) }); }} /> <TextField label={t('reportTo')} type="datetime-local" - value={moment(lines[6].slice(-15)).locale('en').format(moment.HTML5_FMT.DATETIME_LOCAL)} + value={dayjs(lines[6].slice(-15)).locale('en').format('YYYY-MM-DDTHH:mm')} onChange={(e) => { - const time = formatCalendarTime(moment(e.target.value, moment.HTML5_FMT.DATETIME_LOCAL)); + const time = formatCalendarTime(dayjs(e.target.value, 'YYYY-MM-DDTHH:mm')); setItem({ ...item, data: updateCalendar(lines, 6, `DTEND;${time}`) }); }} /> |