import React, { useState, useEffect, useRef } from 'react'; import Menu from '../Components/Menu'; import Schedule from '../Components/Schedule'; import styled from 'styled-components'; import moment from 'moment'; import "moment/locale/ko"; moment.locale("ko", { week: { dow: 1 } }); const Drop = styled.div` & button { border solid 1px; } ` const Tab = styled.ul` & a, a:hover, a:active { color: black; } ` function Home() { const [show, setShow] = useState(false); const [weeks, setWeeks] = useState([]); const [days, setDays] = useState([]); const [sendDate, setSendDate] = useState(null); useEffect(() => { Dateform(); }, []); function Dateform() { let today = moment(); let weeks = []; let dates = []; let sendDates = []; for (let i = 0; i < 6; i++) { if (i !== 0) { today.add(7, 'd'); } let date = { start: null, end: null }; date.start = today.startOf('week').format("MMM Do"); date.end = today.endOf('week').weekday(4).format("MMM Do"); dates.push(date); const week = date.start + " ~ " + date.end; weeks.push(week); let sendDate = today.startOf('week').format("YYYY-MM-DD"); sendDates.push(sendDate); }; setWeeks([...weeks]) setDays([...sendDates]) }; function choose(e, index) { setShow(true) setSendDate(days[index]) } return (
대관 가능 시간