I've got a grid with a RadzenDatePicker. In my database I want to store all dates as UTC, regardless of the timezone of the user.
But of course the dates should be displayed to the user in his local time (timezone).
But how can I do this?
Another user posted a similar question (but there are no answers unfortunately):
<RadzenGridColumn TItem="Entry" Property="Date" Title="Date">
<Template Context="entry">
<div>@entry.Date.ToString("g")</div>
</Template>
<EditTemplate Context="entry">
<RadzenDatePicker TValue="DateTime" @bind-Value=@entry.Date ShowTime="true" ShowSeconds="false" HoursStep="1" MinutesStep="1" SecondsStep="10" DateFormat="g" />
</EditTemplate>
</RadzenGridColumn>
As you see, the picker is bound to the "Date
" (DateTime) property of the entity "entry
". I have found no option to specify an offset for the date in the control.
So this would mean, when editing, it would display the UTC date to the user and not his local date. Or when the user creates a new row, I would need to insert the row into the grid using the local time of the user (so he sees the time as he expects it) but then I would need to convert it to UTC before it gets to the database - but it is bound to the property directly.
Any ideas how to achive this, or should I try another approach?