Hi, and thanks for any help you can provide.
Here are some snippets from my MVVM code:
<div id="manageUser">
<div class="large-8 medium-8 columns">
<input id="StartDate"
data-role="datepicker"
data-format="dd/MM/yyyy"
data-bind="value: StartDate" />
</div>
</div>
<script>
var viewModelManageUser = kendo.observable({
...
StartDate: null,
...,
GetTranslator: function() {
var manageUserRequest = { ManageUser: { AssociateID: ascID }};
gateway.getFromService(manageUserRequest, function(e) {
...
if(e.Translator != null)
{
...
viewModelManageUser.set("StartDate", e.Translator.CreatedOn);
...
}
},
function (e) {
DisplayErrorMessage(e);
}
);
...
</script>
As you can see in the HTML, I declare an input (id = StartDate) with the following data- attributes:
data-role="datepicker"
data-format="dd/MM/yyyy"
data-bind="value: StartDate" />
Upon making the Ajax call to the server, the server code passes back a Translator.CreatedOn value of {1/13/2018 10:55:50 PM} from the database. Note both the client and the server are in the same time zone, (UTC-06:00) Central Time (US & Canada).
Using Chrome v70 Developer Tools, I can see the the argument successfully returned from the Ajax request has an e.Translator.CreatedOn value of "/Date(1515905750950-0000)/".
Again in Debug Tools, after the view model field, StartDate, is populated from the Ajax response, within the console I can see that viewModelManageUser.get("StartDate") returns a value of "/Date(1515905750950-0000)/".
Using the following tool, I can verify that the JavaScript date assigned to the StartDate view model field equates to Jan 13 2018 22:55:50. This value exactly matches the value returned from the database.
http://esqsoft.com/javascript_examples/date-to-epoch.htm
Option 2: Enter an epoch time value
New Epoch Time Value:
1515905750950-0000
Conversion Output:
Sat Jan 13 2018 22:55:50 GMT-0600 (Central Standard Time)
However, once the page finishes rendering, the value displayed on client within the bound Date Picker is as follows:
Start date 14/01/2018
I understand the effect of UTC on dates and relative rules of time zones. What I don't understand is, if the client and server are in the same timezone, and the JavaScript date matches the server date, why does the date picker display StartDate one day into the future relative to the server date?
I am using Kendo version 2018.1.117.
Thanks,
Jeff