From 9a59d6524c45d5542433302a498f9ada4e45e806 Mon Sep 17 00:00:00 2001
From: Anton Tananaev <anton@traccar.org>
Date: Mon, 4 Sep 2023 10:53:05 -0700
Subject: Migrate to DayJs from moment

---
 modern/src/settings/CalendarPage.jsx | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

(limited to 'modern/src/settings/CalendarPage.jsx')

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}`) });
                     }}
                   />
-- 
cgit v1.2.3

