jdtcn / BlazorDateRangePicker

A Blazor component for choosing date ranges and dates
MIT License
186 stars 34 forks source link

Using DateTimeOffset.MaxValue or DateTimeOffset.MinValue causes Exception #65

Closed Silver7899 closed 3 years ago

Silver7899 commented 3 years ago

https://blazordaterangepicker.azurewebsites.net/single

  1. Type 12/31/9999
  2. Click to field
  3. Exception in F12 console:
blazor.webassembly.js:1 

       crit: Microsoft.AspNetCore.Components.WebAssembly.Rendering.WebAssemblyRenderer[100]
      Unhandled exception rendering component: ArgumentOutOfRange_DateArithmetic Arg_ParamName_Name, months
System.ArgumentOutOfRangeException: ArgumentOutOfRange_DateArithmetic Arg_ParamName_Name, months
   at System.DateTime.ThrowDateArithmetic(Int32 )
   at System.DateTime.AddMonths(Int32 )
   at System.DateTimeOffset.AddMonths(Int32 )
   at BlazorDateRangePicker.DateRangePicker.AdjustCalendars()
   at BlazorDateRangePicker.DateRangePicker.Open()
   at Microsoft.AspNetCore.Components.ComponentBase.CallStateHasChangedOnAsyncCompletion(Task )
   at Microsoft.AspNetCore.Components.RenderTree.Renderer.GetErrorHandledTask(Task , ComponentState ) 
jdtcn commented 3 years ago

Hi!

Thank you for the report, I've fixed the issue in the new 4.0.0 version of the package.