The current(July) preview of RIA Services handles DateTime objects in an strange manner. Many of silverlight developers have complained in Silverlight forums that their dates are messed up. In this post, I am listing down several observations as a reference. Note that my current settings are +6 GMT.
From DateTime.Kind DateTime.Value To DateTime.Kind DateTime.Value ---- ------------- ---------------- -- ------------- --------------- Client Unspecified 2009-01-01 00:00 Server Utc 2008-12-31 18:00 Server Unspecified 2009-01-01 00:00 Client Utc 2008-12-31 18:00 Client Local 2009-01-01 00:00 Server Utc 2008-12-31 18:00 Server Local 2009-01-01 00:00 Client Utc 2008-12-31 18:00 Client Utc 2009-01-01 00:00 Server Utc 2009-01-01 00:00 Server Utc 2009-01-01 00:00 Client Utc 2009-01-01 00:00
We can see that whatever Datetime we send, RIA service converts it to UTC when received at the other end. This could be bearable up to some extent but the worst thing is that RIA domain service treats Unspecified dates as Local and performs respective time zone conversion. Also, there is a UsesUtcDateTimes overridable in DomainService class but currently it does not seem to produce any effect.
Notice that there is no such conversion when using a WCF service, so whatever datetime value and kind we send from one side is exactlyreceived the same at the other side.
Lets hope the issues are fixed in the next version of RIA services.
My sample application that I used to test the behavior of RIA Domain Service and WCF Service can be downloaded from here. Remember to rename it to .zip for extraction.