-
Notifications
You must be signed in to change notification settings - Fork 0
/
App.js
37 lines (31 loc) · 1005 Bytes
/
App.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import React, {useState} from 'react';
import logo from './logo.svg';
import './App.css';
import Calendar from './Components/CalendarComp';
import {CustomTable} from './Components/table';
import TestApi from './Components/TestApi';
import moment from "moment";
function App() {
const [selectedDate, setSelectedDate] = useState(moment());
const [fromDate, setFromDate] = useState(moment().format('MM-DD-YYYY'));
const [toDate, setToDate] = useState(moment().add(6,'days').format('MM-DD-YYYY'));
const setDate =(date,fromDate,toDate) =>{
setSelectedDate(date);
setFromDate(fromDate);
setToDate(toDate);
}
return (
<div className="App">
<header className="App-header">
{selectedDate.format('DD-MM-YYYY')}
<p className="App-float-left">
<Calendar setDate={setDate}/>
</p>
<p className="App-float-right">
<TestApi fromDate={fromDate} toDate={toDate}/>
</p>
</header>
</div>
);
}
export default App;