Skip to content

Commit c8ca517

Browse files
committed
Workaround for TimeZoneInfo.Local = null
1 parent 3d19ecb commit c8ca517

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/Newtonsoft.Json/Utilities/DateTimeUtils.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ static DateTimeUtils()
5353

5454
public static TimeSpan GetUtcOffset(this DateTime d)
5555
{
56-
#if NET20
56+
#if NET20 || UNITY3D
5757
return TimeZone.CurrentTimeZone.GetUtcOffset(d);
5858
#else
5959
return TimeZoneInfo.Local.GetUtcOffset(d);
@@ -288,7 +288,11 @@ internal static bool TryParseDateTimeOffsetIso(StringReference text, out DateTim
288288
offset = new TimeSpan(dateTimeParser.ZoneHour, dateTimeParser.ZoneMinute, 0);
289289
break;
290290
default:
291+
#if UNITY3D
292+
offset = GetUtcOffset(d);
293+
#else
291294
offset = TimeZoneInfo.Local.GetUtcOffset(d);
295+
#endif
292296
break;
293297
}
294298

0 commit comments

Comments
 (0)