We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

DateRange Predefined set of date ranges

Thread ID:





148871 Nov 6,2019 05:54 PM UTC Nov 25,2020 12:04 PM UTC Blazor 5
Tags: DateRangePicker
Alex Whittle
Asked On November 6, 2019 05:54 PM UTC

Can't see any example code for DateRange Predefined set of date ranges on this page https://www.syncfusion.com/blazor-components/blazor-daterangepicker - is there any documentation available anywhere?

Narayanasamy Panneer Selvam [Syncfusion]
Replied On November 7, 2019 09:52 AM UTC

Hi Alex,

Good day to you.

Yes, we have online documentation to configuring the predefined date range. 
Please refer the below documentation link for more information: https://ej2.syncfusion.com/blazor/documentation/daterangepicker/data-binding/ 

Alex Whittle
Replied On November 7, 2019 09:54 AM UTC


How do I do this - I can't see the example code for this in any of the demos?

Narayanasamy Panneer Selvam [Syncfusion]
Replied On November 8, 2019 10:31 AM UTC

Good day to you.

We have prepared a sample as per your requirement using DateRangePicker’s Preset property. Refer the given code example, 
@using Syncfusion.EJ2.Blazor.Calendars; 
            <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>         
    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); 

We have prepared a simple demo sample for your reference,
We will include this demo sample in our blazor sample browser, it will be available with our Beta release. 

Narayanasamy P.

Varun D
Replied On November 24, 2020 07:07 AM UTC

Hi sir, What is FJ2 in Syncfusion.EJ2.Blazor.Calendars and why are you adding Ejs as a prefix in <EjsDateRangePicker> ? The solution you had referred  has dependency to Syncfusion.Ej2.Blazor under packages. But mine refers to  Syncfusion.Blazor. It's quite frustrating!

Sureshkumar P [Syncfusion]
Replied On November 25, 2020 12:04 PM UTC

Hi Varun, 
Thanks for your update.  
The mentioned Syncfusion.EJ2.Blazor NuGet package name is our previous version from version, it will be Syncfusion.Blazor. Other Blazor packages will also have the same name changes. Also, In the previous version, the component names are prefixed with Ejs (example: EjsGrid, EjsChart) which has been changed to the prefix Sf (example: SfGrid, SfChart). 
Sureshkumar P 


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon