Created
June 4, 2025 08:47
-
-
Save cfstras/7d7a1b5a728aa390dc120e7610d9921c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class DateTimeInsanityTests | |
{ | |
[Fact] | |
public void YourDateTimeIsInsane() | |
{ | |
var t = new DateTime(); | |
// Does not throw | |
Console.WriteLine(new DateTimeOffset(t.ToUniversalTime())); | |
// Throws an exception in timezones east of UTC | |
Console.WriteLine(new DateTimeOffset(t)); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment