DateTime serialization and involuntary TimeZone adjustments, saga continues

S

sonic

Hello,

I am having an issue that should affect anyone that is trying to pass
DateTime object to client javascript. I've been having this issue for
weeks and even though found some workarounds ( mentioned below ) I am
still not satisfied with this issue as "resolved".

I am currently in final stages of deploying a fairly big atlas
solution. I've been very pleased with the experience developing in
asp.net 2.0 and atlas accept for the datetime serialization, and
javascriptobjectserializer to a lesser extent.

datetime properties are always adjusted with a browser time zone
whenever atlas script manager is used to call webservices directly, or
javascriptobjectserializer is used.

i started using JSON ( instead of javascriptobjectserializer) because
it allows for object converters to be supplied so that serialization of
certain types of properties can be fully controlled.
javascriptobjectserializer also appears to serialize enums incorrectly
( as ints instead of strings ) so json was helpful in that regard for
me.

atlas ajax:
calling webservices directly from javascript using atlas script manager
control will automatically adjust all datetimes even if the server and
browser are on the same machine (and yes my time zone is set
correctly),

the only remedy i found so far is that converting datetime
..ToUniversalTime() on the server can be helpful in stopping timezone
adjustments. but this will be a big pain when using custom objects and
2 way communication.

Brad Abrams posted a way to ignore Time in DateTime serialization, and
that is by adding [XmlAttribute(DataType = "date")] to the property
definition. this will work between web and app tiers, but appears to be
ignored by atlas serialization as well. (of course this method is only
useful when only the Date portion is relevant and you dont want the
adjusted timezone to kick the date back or forward a day)

i wish there was a way to set IIS to stop adjusting timezone for
browsers.
Perhaps I am missing something more obvious here and i will keep at it
until its all clear
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top