set duration
parent
8ee168f105
commit
0fae80fc84
|
@ -13,6 +13,7 @@
|
||||||
"@testing-library/react": "^13.4.0",
|
"@testing-library/react": "^13.4.0",
|
||||||
"@testing-library/user-event": "^13.5.0",
|
"@testing-library/user-event": "^13.5.0",
|
||||||
"antd": "^5.20.0",
|
"antd": "^5.20.0",
|
||||||
|
"dayjs": "^1.11.12",
|
||||||
"react": "^18.3.1",
|
"react": "^18.3.1",
|
||||||
"react-dom": "^18.3.1",
|
"react-dom": "^18.3.1",
|
||||||
"react-scripts": "5.0.1",
|
"react-scripts": "5.0.1",
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
"@testing-library/react": "^13.4.0",
|
"@testing-library/react": "^13.4.0",
|
||||||
"@testing-library/user-event": "^13.5.0",
|
"@testing-library/user-event": "^13.5.0",
|
||||||
"antd": "^5.20.0",
|
"antd": "^5.20.0",
|
||||||
|
"dayjs": "^1.11.12",
|
||||||
"react": "^18.3.1",
|
"react": "^18.3.1",
|
||||||
"react-dom": "^18.3.1",
|
"react-dom": "^18.3.1",
|
||||||
"react-scripts": "5.0.1",
|
"react-scripts": "5.0.1",
|
||||||
|
|
21
src/App.js
21
src/App.js
|
@ -17,6 +17,7 @@ import { useForm } from "antd/es/form/Form";
|
||||||
import useMessage from "antd/es/message/useMessage";
|
import useMessage from "antd/es/message/useMessage";
|
||||||
import { useEffect, useRef, useState } from "react";
|
import { useEffect, useRef, useState } from "react";
|
||||||
import { myFetch } from "./utils";
|
import { myFetch } from "./utils";
|
||||||
|
import dayjs from "dayjs";
|
||||||
|
|
||||||
const { useBreakpoint } = Grid;
|
const { useBreakpoint } = Grid;
|
||||||
|
|
||||||
|
@ -91,13 +92,19 @@ function App() {
|
||||||
|
|
||||||
if (response.acceleration !== undefined)
|
if (response.acceleration !== undefined)
|
||||||
setAcceleration(response.acceleration);
|
setAcceleration(response.acceleration);
|
||||||
/*
|
|
||||||
if (response.duration !== undefined)
|
const format = "HH:mm:ss";
|
||||||
form.setFieldValue("duration", {
|
|
||||||
$s: response.duration % 60,
|
if (response.duration !== undefined) {
|
||||||
$m: Math.floor(response.duration / 60) % 60,
|
form.setFieldsValue({
|
||||||
$H: Math.floor(response.duration / 3600),
|
duration: dayjs(
|
||||||
}); */
|
`${Math.floor(response.duration / 3600)}:${
|
||||||
|
Math.floor(response.duration / 60) % 60
|
||||||
|
}:${response.duration % 60}`,
|
||||||
|
format
|
||||||
|
),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
if (response.distance !== undefined) setDistance(response.distance);
|
if (response.distance !== undefined) setDistance(response.distance);
|
||||||
if (response.direction !== undefined) setDirection(response.direction);
|
if (response.direction !== undefined) setDirection(response.direction);
|
||||||
|
|
Loading…
Reference in New Issue