import { DateRangePickerComponent, PresetDirective, PresetsDirective, RangeEventArgs } from "@syncfusion/ej2-react-calendars";
interface SelectDateProps {
}
const SelectDate: React.FC<SelectDateProps> = () => {
const asdasdasd = (args: RangeEventArgs) => {
}
const today: Date = new Date(new Date().toDateString());
const weekStart: Date = new Date(new Date(new Date().setDate(new Date().getDate() - (new Date().getDay() + 7) % 7)).toDateString());
const weekEnd: Date = new Date(new Date(new Date().setDate(new Date(new Date().setDate((new Date().getDate()
- (new Date().getDay() + 7) % 7))).getDate() + 6)).toDateString());
const monthStart: Date = new Date(new Date(new Date().setDate(1)).toDateString());
const monthEnd: Date = new Date(new Date(new Date(new Date().setMonth(new Date().getMonth() + 1)).setDate(0)).toDateString());
const lastStart: Date = new Date(new Date(new Date(new Date().setMonth(new Date().getMonth() - 1)).setDate(1)).toDateString());
const lastEnd: Date = new Date(new Date(new Date().setDate(0)).toDateString());
const yearStart: Date = new Date(new Date(new Date().getFullYear() - 1, 0, 1).toDateString());
const yearEnd: Date = new Date(new Date(new Date().getFullYear() - 1, 11, 31).toDateString());
const start: Date = new Date("10/7/2017");
const end: Date = new Date("11/15/2017");
return (
<DateRangePickerComponent placeholder='Select a range' startDate={start} endDate={end} change={asdasdasd}>
<PresetsDirective >
<PresetDirective label="This Week" start={weekStart} end={weekEnd}></PresetDirective>
<PresetDirective label="This Month" start={monthStart} end={monthEnd}></PresetDirective>
<PresetDirective label="Last Month" start={lastStart} end={lastEnd}></PresetDirective>
<PresetDirective label="Last Year" start={yearStart} end={yearEnd}></PresetDirective>
</PresetsDirective>
</DateRangePickerComponent>
);
}
export default SelectDate;