SfDatepicker changes Kind to Local

When using an SfDatepicker i've the following problem:

I bind the date value to a DateTime object loaded from a postgresql database with UTC kind (in debug i can see the king and it's UTC).

When picking a different date, the binded date changes accordingly but always changes the Kind to Local!

I'm using vs2022 nuget Syncfusion.Blazor 25.1.37

Thanks,

Marco


1 Reply

YS Yohapuja Selvakumaran Syncfusion Team April 4, 2024 01:12 PM UTC

Hi Marco Ortali,


Thank you for reaching out us. By default, the preselected date value will be processed based on the system's local time zone. The 'serverTimezoneOffset' is independent of the client machine. The value of the 'serverTimezoneOffset' property pertains to the server machine (where the application is hosted). For instance, if your application is hosted in the US, you should set the 'serverTimezoneOffset' property to the value '-4' as a string. The 'serverTimezoneOffset' property is intended to enable the component to render based on your updated server time zone property. This restriction will help ensure that the preselected date is initially converted based on the local time zone.

We wish to inform you that if you provide any preselected values, they will be converted based on the provided timeZone offset. However, please note that the 'ServerTimeZoneOffset' property functions only in the initial scenario and does not update dynamically when a value is selected.


Code Snippet:

<SfDatePicker Placeholder="Select a date and time" TValue="DateTime?" @bind-Value="@DateValue3" ServerTimezoneOffset="-4"></SfDatePicker>

 

@code {

    private DateTime? DateValue3 = DateTime.Now;

}



Regards,

Yohapuja S


Loader.
Up arrow icon