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.