Thank you for opening this question in advance.
The thing I want to make(and understood)is time input feature, that allows user to see the expected time; by comparing two (given) input value provided by user.
For example, (1) user will input any starting time to first time input section.
(2) user will input any ending time to set.
(3) By substracting ending value with starting value, it should print the outcome.
(start) 10:00
(end) 14:00
And this is goal: End - start = 4 hours (expected time; to accomplish its task)
So far, I have attmpted searching for useState, getTime method as a clue to make the feature I described above.
But something is missing...for example:
var diffTime = (end.getTime() - start.getTime()) / (1000);
But I have no idea how to expand this idea further than this point.
How should I print the (expected time) value by comparing the input values received from two different time input values?
import React from "react";
import styled from "styled-components";
function App() {
return (
<div className="App">
<h3>Section</h3>
<div className="time">
<label for="due">Set your time to compare it</label>
<p></p>
Start
<input id="due" type="datetime-local" name="duedate" />
End
<input id="due" type="datetime-local" name="duedate" />
<p>
<label for="due">Time you spent</label>
<StylingBox>
<div className="square-box">
<div className="sqaure-content">
<p>(place to display the calculated value here)</p>
</div>
</div>
</StylingBox>
</p>
</div>
</div>
);
}
export default App;