Error: System.ArgumentOutOfRangeException: Year, Month, and Day parameters describe an un-representable DateTime.

Hello, 

I am currently using the SfDateRangePicker and when we have a date that comes back for 2022 we get the error below when trying to change the date. 


blazor.server.js:19 [2022-01-12T19:01:34.248Z] Error: System.ArgumentOutOfRangeException: Year, Month, and Day parameters describe an un-representable DateTime.

   at System.DateTime..ctor(Int32 year, Int32 month, Int32 day)

   at Syncfusion.Blazor.Calendars.SfDateRangePicker`1.SelectStartMonth()

   at Syncfusion.Blazor.Calendars.SfDateRangePicker`1.Show()

   at Syncfusion.Blazor.Calendars.SfDateRangePicker`1.DateRangeIconHandler()

   at Microsoft.AspNetCore.Components.ComponentBase.CallStateHasChangedOnAsyncCompletion(Task task)

   at Microsoft.AspNetCore.Components.RenderTree.Renderer.GetErrorHandledTask(Task taskToHandle)


Here is the code i am using in the Razor page.

<SfDateRangePicker Enabled="@dateRangePickerIsEnabled" TValue="DateTime?" Min="@MinDate" Max="@MaxDate" @bind-StartDate="@StartDate" @bind-EndDate="@EndDate" Placeholder="Choose a Range">

                            <DateRangePickerEvents TValue="DateTime?" ValueChange="ApplyFilters"></DateRangePickerEvents>

                        </SfDateRangePicker>


5 Replies

PM Ponmani Murugaiyan Syncfusion Team January 13, 2022 08:55 AM UTC

Hi Dustin, 

Greetings from Syncfusion support. 

The cause for the issue is if the provided date format is mismatched, then the reported error will occurred. For more reference, please check with the below blog. Please make ensure that your provided date format in the min/max date and start/end date format mismatches in your application. 


Also, if the received date is in another format you can convert the date format before updating to the property  


Regards, 
Ponmani M 



DC Dustin Cummings replied to Ponmani Murugaiyan January 18, 2022 02:09 PM UTC

Hello Ponmani M,


That data that I am receiving is in the same format as it has always been. This issue has just started when we use any date in January 2022.


I have changed the data that is being returned for the @MaxDate variable from

 '2022-01-12 18:12:42.3698958' to '2022-02-12 18:12:42.3698958' 

and I do not get this error. This error only happens when the month is 01.



PM Ponmani Murugaiyan Syncfusion Team January 19, 2022 06:35 AM UTC

Hi Dustin, 

We have considered the reported issue “When set the max, start and end date values in the same month then component throws script error” as bug in our end. The fix will be included in the upcoming patch release which is expected to be rolled out on January 26, 2022. You can track the status using the below feedback link. 


Regards, 
Ponmani M 



KF Kimberly Foster July 21, 2022 09:02 AM UTC

Ok, thanks.



UD UdhayaKumar Duraisamy Syncfusion Team July 21, 2022 04:07 PM UTC

Hi Kimberly,


Thanks for the update. Please get back to us if you need any further assistance.


Regards,

Udhaya Kumar D


Loader.
Up arrow icon