- Home
- Forum
- ASP.NET Core
- Avoid using Timezones and dst in the Schedule
Avoid using Timezones and dst in the Schedule
We are glad to hear this from you. Kindly let us know, if you need any further assistance on this.
Regards,
I have a similar requirement what I did ti get it working is to change the code in the controller: in my case i am using central time for illustration but yu can make it a variable:
if (param.action == "insert")
{
var value = param.value;
foreach (var fieldName in value.GetType().GetProperties())
{
var newName = fieldName.ToString().Split(null);
if (newName[1] == "Id") result = (_context.Process.ToList().Count > 0 ? _context.Process.ToList().Max(p => p.Id) : 1) + 1;
else if (newName[1] == "StartDate" || newName[1] == "EndDate") {
DateTime dateTimeUtc = Convert.ToDateTime(fieldName.GetValue(value));
DateTime dateCstTime = TimeZoneInfo.ConvertTime(dateTimeUtc, TimeZoneInfo.FindSystemTimeZoneById("Central Standard Time"));
result = dateCstTime;
}
else result = fieldName.GetValue(value);
fieldName.SetValue(process, result);
}
_context.Process.Add(process);
}
In the client side
<ej-schedule id="Schedule1" width="100%" height="525px" time-zone="UTC -06:00" ....
<e-appointment-settings apply-time-offset="false" ....
With these changes the data in the client side and in the server will always be in sync and in "Central Time" in this case. I am not sure if it will help you, but it works for me.
- 7 Replies
- 4 Participants
-
DS dsapo
- Apr 4, 2017 09:00 PM UTC
- Jul 10, 2017 04:28 AM UTC