We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

UTC Offset Question

I have a creation form that takes 2x dates.

@model directoryData.ViewModels.SessionViewModel

@{
    ViewData["Title"] = "Create";
}
<h4>Create New Session for @Model.ClientName</h4>
<hr />
<div class="row" style="margin: 10px">
    <div class="col-md-4">

        <form asp-action="Create" asp-controller="Session" method="post" asp-route-session="@Model.Session">
            <input asp-for="@Model.Session.ClientId" class="form-control" style="display: none" />
            <ejs-datetimepicker id="startdatetimepicker" placeholder="Select a date and time" ejs-for="@Model.Session.StartTime"  ></ejs-datetimepicker>
            <ejs-datetimepicker id="enddatetimepicker" placeholder="Select a date and time" ejs-for="@Model.Session.EndTime"  ></ejs-datetimepicker>
            <div class="form-group">
                <input type="submit" value="Create Session" class="btn btn-primary"/>
            </div>
        </form>
    
    </div>
</div>

Here is my model:

  public class Session : EntityBase
    {
        [Key]
        public int SessionId { get; set; }

        [Required]
        public Guid ClinicId{ get; set; }
        [Required]
        public Guid ClientId { get; set; }
        [Required]
        public Guid EmployeeId { get; set; }
        [Required]
        public int DeviceId { get; set; }

        [Required] public DateTimeOffset StartTime { get; set; } = DateTimeOffset.Now;

        [Required]
        public DateTimeOffset EndTime { get; set; } = DateTimeOffset.Now.AddHours(4);

        public string Note { get; set; }
    }

When I debug locally, my time comes through with the UTC offset attached (2019-08-12 23:36:00.0000000 -06:00)
otherwise, when published, the time comes through without the offset (2019-08-12 23:36:00.0000000 00:00)

How do I get the website (client) to understand the UTC offset to send when creating a new session?

Thanks.



3 Replies

GG Gopi Govindasamy Syncfusion Team August 15, 2019 01:22 PM UTC

Hi Mark,  

Greetings from Syncfusion support. 

We have checked your reported problem at our end. But unfortunately, we were unable to replicate at our end. We suspect the cause of the problem due to on timezhone not same your client and server hosted machine(publish machine). Can you please ensure whether you have specify the same timezhone  to client and server(publish) machine. If still you are facing this problem, please provide below information to reproduce your issue at our end. 

  1. Application hosted link.
  2. timezhone details.
  3. screenshot for client and server machine timezhone.

Regards,
Gopi G. 



UN Unknown Syncfusion Team August 16, 2019 08:58 PM UTC

I think I have nearly solved my issue. The client needs to pass an offset to my controller so when I store time, I know correct UTC with that.

Thanks for your help. I will reopen another ticket in the correct control.


AB Ashokkumar Balasubramanian Syncfusion Team August 19, 2019 09:37 AM UTC

Hi Mark, 
 
We are glad to hear the problem has been resolved. Please let us know, if you need any further assistance. 
 
Regards, 
Ashokkumar B. 


Loader.
Live Chat Icon For mobile
Up arrow icon