My users have been reporting since yesterday that dates they enter into the WebDataGrid are losing a day when saving to the database.
On closer inspection, these date/time fields are losing 1 hour. For example, if a user enters 11/7/2011 into the WebDataGrid, 11/6/2011 11:00PM will be stored to the database, and the users then sees 11/6/2011 displayed in the grid as his saved value. This occurs regardless of the EditorProvider used... This even happens if you use the TextBox provider.
And this began recently, oddly corresponding to Daylight Savings Time.
I have found a very clumsy workaround. If you change your SQL statement so that it converts DateTime fields to VarChars, the WebDataGrid won't corrupt the date.
I have opened a support ticket CAS-77072-NSTXZT, but have also posted the issue and the workaround here, for the benefit of other users.
I consider this issue to be critical, since it is corrupting data.
Whoops, forgot to include version number.
Version=11.1.20111.2064
Hi Rob,
You can thank Microsoft for the problem since they do not serialize dates properly. This was reported in bug 84041 and looks to be resolved in build 11.1.20111.2088, so it should be available in the next Service Release. We changed how the dates are sent back and forth to the client (as strings, like you) to account for time zones and day light savings.
regards,David Young
Nuts, fixing this bug is becoming a whole lot of work. And we're still at least a week away from the SR being released?
Hello Rob,
I've just copied JS files to CDN for that build. Give it about an hour to sync.
Thank you very much!
Just to confirm, that includes the cssz files right? I'm sure it does, but want to double-check.
I just want to make sure that the css files won't fail to load for lack of being in the 2090 folder in the CDN. If the client won't look for them in the 2090 folder, then we're probably ok.
By the way, this update broke some of my CSOM code. I don't know if this particular behavior change was intended.
I am using CSOM to add rows to the WebDataGrid. Before, I could pass strings to the new row array, and that worked fine. The WebDataGrid would handle them as dates. Now, the server throws an error if I try to pass in a string. To fix it, I have to turn all strings into proper Javascript Date objects.
This now throws a server error, where it didn't before:
var newrow = [ '11/12/2011' ]; rows.add(newrow);
This works:
var newrow = [ new Date( '11/12/2011') ]; rows.add(newrow);
I am very lucky that my application doesn't call for storing time values.
Have you submitted a ticket so that they know about the issue that persists with time values?
The same happens to time columns, but for some reason, the date value of the time is changed. Arghh! Quite frustrating. Will have to strip out the time portion in javascript and compare them to see if they really changed! Just tabbing through a time field, the _Editing_CallValueChanging() event has these values:
? eventArgs.get_currentValue().toString()
"Wed Nov 30 10:21:00 PST 2011"
? eventArgs.get_newValue().toString()
"Thu Nov 10 10:21:00 PST 2011"
Very odd that webdatagrid chose to change the date portion of the time column form Nov 30 to Nov 10. Happens to be my wife's birthday!
They still need to do some more work on the date and time column editing.
One side effect I have noticed is that for date columns, the CellValueChanged Event gets triggered by just tabbing through a date field.
Evaluating the _Editing_CellValueChanging event, the eventArgs.get_currentValue() and eventArgs.get_newValue() are equal. I imagine this is a side effect of the change that was made.
I am currently using this code to bypass this behavior
function
wdg_Editing_CellValueChanging(sender, eventArgs) {
if (eventArgs.get_currentValue().toString() == eventArgs.get_newValue().toString())
eventArgs.set_cancel(
true);
}
Thanks for reporting back! Glad to hear it!
Just wanted to confirm that I upgraded to 11.2 and this is no longer an issue.
Thanks
Jorge