DatePicker for Blazor, StrictMode bug

Hi,

We have a problem with the DatePicker component for Blazor. When StrictMode is set to true then the entire application freezes.

To help you understand the problem we've created a new project that only has this component included. There are 3 different cases in the sample project:
  • Strict mode set to false - everything works fine

<SfDatePicker TValue="DateTime" @bind-Value="@DueDate"
              Min="DateTime.UtcNow" AllowEdit="false">
</SfDatePicker>

  • Strict mode set to true and both value and min are set to the same date - when you click on the calendar button the calendar does not show up and the app freeze   

<SfDatePicker TValue="DateTime" @bind-Value="@DueDate3" StrictMode="true"
              Min="DateTime.UtcNow" AllowEdit="false">
</SfDatePicker>

  • Strict mode set to true and value is ahead of min - then everything works until you select the first date (min date), then the app freezes (same problem like above

<SfDatePicker TValue="DateTime" @bind-Value="@DueDate3" StrictMode="true"
              Min="DateTime.UtcNow" AllowEdit="false">
</SfDatePicker>

     @code
     {
         public DateTime DueDate { get; set; } = DateTime.UtcNow;
         public DateTime DueDate2 { get; set; } = DateTime.UtcNow;
         public DateTime DueDate3 { get; set; } = DateTime.UtcNow.AddDays(3);
     }

Thank you.

Attachment: DatePickerProblem_d710bab1.zip

3 Replies 1 reply marked as answer

JM Jeyanth Muthu Pratheeban Sankara Subramanian Syncfusion Team April 7, 2021 01:19 PM UTC

Hi Aleksandar, 

Thanks for contacting Syncfusion support. 

We have checked your query, “Datepicker popup not opening when StrictMode is enabled”. We would like to thank you for spending your time to customize the sample and helping us to understand the issue much better. On analysing the sample provided, you have set the Value and Min property to DateTime.UtcNow inline in tag helper. We would like to inform you that when StrictMode is enabled, if Value property is less than Min value, then we update the Min value to Value property. Since the comparison of Min and Value always returns false as the provided value is in DateTime.UtcNow and it is updating for every milliseconds which in turn causes Min value to be updated to the Value property and this process prolongs which causes the application to freeze. To overcome this issue, we suggest you to set the Min and Value property in OnInitialized(). We have modified the sample. Please find the sample in the below link. 


 


 
Kindly integrate the provided solution in your application and get back to us if you need any further assistance on this. 

Regards, 
Jeyanth. 


Marked as answer

AL Aleksandar April 7, 2021 07:55 PM UTC

Hi Jeyanth,

Thank you - appreciate your help!

I really like the File Upload package, you guys have done a great work.

Kind regards,
Aleksandar


JM Jeyanth Muthu Pratheeban Sankara Subramanian Syncfusion Team April 8, 2021 04:36 AM UTC

Hello Aleksander, 

Thanks for the feedback. 

We are glad to hear that your issue has been resolved. Please let us know if you would require any further assistance on this. 

Regards, 
Jeyanth. 


Loader.
Up arrow icon