aboutsummaryrefslogtreecommitdiff
path: root/modern/src/settings/PreferencesPage.jsx
diff options
context:
space:
mode:
authorAnton Tananaev <anton@traccar.org>2023-09-04 10:53:05 -0700
committerAnton Tananaev <anton@traccar.org>2023-09-04 10:53:05 -0700
commit9a59d6524c45d5542433302a498f9ada4e45e806 (patch)
treeb779287db9104054ca5fbecf9f6218b2db46d8fe /modern/src/settings/PreferencesPage.jsx
parent63eaa20047613c872979e2894fbdb5a0caab31f7 (diff)
downloadtrackermap-web-9a59d6524c45d5542433302a498f9ada4e45e806.tar.gz
trackermap-web-9a59d6524c45d5542433302a498f9ada4e45e806.tar.bz2
trackermap-web-9a59d6524c45d5542433302a498f9ada4e45e806.zip
Migrate to DayJs from moment
Diffstat (limited to 'modern/src/settings/PreferencesPage.jsx')
-rw-r--r--modern/src/settings/PreferencesPage.jsx6
1 files changed, 3 insertions, 3 deletions
diff --git a/modern/src/settings/PreferencesPage.jsx b/modern/src/settings/PreferencesPage.jsx
index 15fd762a..e0673688 100644
--- a/modern/src/settings/PreferencesPage.jsx
+++ b/modern/src/settings/PreferencesPage.jsx
@@ -1,5 +1,5 @@
import React, { useState } from 'react';
-import moment from 'moment';
+import dayjs from 'dayjs';
import { useDispatch, useSelector } from 'react-redux';
import { useNavigate } from 'react-router-dom';
import {
@@ -70,7 +70,7 @@ const PreferencesPage = () => {
const socket = useSelector((state) => state.session.socket);
const [token, setToken] = useState(null);
- const [tokenExpiration, setTokenExpiration] = useState(moment().add(1, 'week').locale('en').format(moment.HTML5_FMT.DATE));
+ const [tokenExpiration, setTokenExpiration] = useState(dayjs().add(1, 'week').locale('en').format('YYYY-MM-DD'));
const mapStyles = useMapStyles();
const mapOverlays = useMapOverlays();
@@ -80,7 +80,7 @@ const PreferencesPage = () => {
const filter = createFilterOptions();
const generateToken = useCatch(async () => {
- const expiration = moment(tokenExpiration, moment.HTML5_FMT.DATE).toISOString();
+ const expiration = dayjs(tokenExpiration, 'YYYY-MM-DD').toISOString();
const response = await fetch('/api/session/token', {
method: 'POST',
body: new URLSearchParams(`expiration=${expiration}`),