Skip to content

Instantly share code, notes, and snippets.

@jamesantrobus
Created February 14, 2011 20:07
Show Gist options
  • Save jamesantrobus/826443 to your computer and use it in GitHub Desktop.
Save jamesantrobus/826443 to your computer and use it in GitHub Desktop.
Workaround for Newtonsoft.Json issue 5 https://github.com/chrisntr/Newtonsoft.Json/issues#issue/5
GetUtcOffSet - JsonConvert.cs Line 111
private static TimeSpan GetUtcOffset(DateTime dateTime)
{
#if SILVERLIGHT
return TimeZoneInfo.Local.GetUtcOffset(dateTime);
#else
return TimeZone.CurrentTimeZone.GetUtcOffset(dateTime);
#endif
}
Replacing with this fixes the issue
private static TimeSpan GetUtcOffset(DateTime dateTime)
{
return TimeZone.CurrentTimeZone.GetUtcOffset(dateTime);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment