2025-01-01 08:16:32 -05:00
|
|
|
import {Calendar} from "antd-mobile";
|
|
|
|
import dayjs from "dayjs";
|
2025-01-05 05:04:52 -05:00
|
|
|
import {TaskCount} from "../TaskCount";
|
|
|
|
import React,{Fragment} from "react";
|
2025-01-01 08:16:32 -05:00
|
|
|
const ToDoCal = (props) => {
|
2025-01-05 05:04:52 -05:00
|
|
|
const [currentDay, setCurrentDay] = React.useState(new Date())
|
2025-01-01 08:16:32 -05:00
|
|
|
const today = dayjs()
|
|
|
|
return (
|
2025-01-05 05:04:52 -05:00
|
|
|
<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>
|
2025-01-01 08:16:32 -05:00
|
|
|
)
|
|
|
|
}
|
|
|
|
export default ToDoCal;
|