msgraph-sdk-dotnet icon indicating copy to clipboard operation
msgraph-sdk-dotnet copied to clipboard

DateTimeTimeZoneExtensions should respect the TimeZone Kind

Open Mrnikbobjeff opened this issue 11 months ago • 0 comments

Describe the bug

In DateTimeZoneExtensions.cs, the Method ToDateTimeOffset does not respect the Timezone identifier. The method needs to add DateTimeStyles.RoundTrip to the DateTime.ParseExact invocation. A reproducable example is published here. To reproduce this the user has to be outside of the UTC Timezone.

Expected behavior

The DateTime Timezone should be respected (Z specifier for ZULU time at the end of the datetime string)

How to reproduce

Create a utc time, use it to create a DateTimeTimeZone, convert it to a DateTimeOffset when your local system is not UTC time

SDK Version

5.67.0

Latest version known to work for scenario above?

No response

Known Workarounds

See the provided example, it already contains the fix

Debug output

Configuration

  • OS: Windosw
  • Architecture: x64

Other information

No response

Mrnikbobjeff avatar Feb 24 '25 11:02 Mrnikbobjeff