import {Calendar} from "antd-mobile";
import dayjs from "dayjs";
import {TaskCount} from "../TaskCount";
import React,{Fragment} from "react";
const ToDoCal = (props) => {
    const [currentDay, setCurrentDay] = React.useState(new Date())
    const today = dayjs()
    return (
        <Fragment>
            <Calendar
                selectionMode='single'
                renderLabel={date => {
                    if (dayjs(date).isSame(today, 'day')) return '今天'
                    if (date.getDay() === 0 || date.getDay() === 6) {
                        return '周末'
                    }
                }}
                defaultValue={currentDay}
                onChange={val => {
                    setCurrentDay(val)
                }}
            />
            <TaskCount currentDay={currentDay}/>
        </Fragment>
    )
}
export default ToDoCal;