@using Syncfusion.EJ2.Blazor.Calendars;
<EjsDateRangePicker>
<DateRangePickerPresets>
<DateRangePickerPreset Label="This Week" Start="@weekStart" End="@weekEnd"></DateRangePickerPreset>
<DateRangePickerPreset Label="This Month" Start="@monthStart" End="@monthEnd"></DateRangePickerPreset>
<DateRangePickerPreset Label="Last Month" Start="@lastMonthStart" End="@lastMonthEnd"></DateRangePickerPreset>
<DateRangePickerPreset Label="Last Year" Start="@lastYearStart" End="@lastYearEnd"></DateRangePickerPreset>
</DateRangePickerPresets>
</EjsDateRangePicker>
@code{
static DateTime lastMonth = DateTime.Now.AddMonths(-1);
//static double days = (double)DateTime.Now.DayOfWeek;
static DateTime weekStart = new DateTime().AddDays(4);
static DateTime weekEnd = weekStart.AddDays(6);
static DateTime monthStart = new DateTime(DateTime.Now.Year, DateTime.Now.Month, 1);
static DateTime monthEnd = monthEnd.AddMonths(1).AddDays(-1);
static DateTime lastMonthStart = new DateTime(lastMonth.Year, lastMonth.Month, 1);
DateTime lastMonthEnd = lastMonthStart.AddMonths(1).AddDays(-1);
DateTime lastYearStart = new DateTime(DateTime.Now.Year - 1, 1, 1);
DateTime lastYearEnd = new DateTime(DateTime.Now.Year - 1, 12, 31);
} |