using System;
var dt = new DateTime(DateTime.UtcNow.AddMinutes(10).Ticks, DateTimeKind.Unspecified);
dt > DateTime.Now // false
dt > DateTime.UtcNow // true
dt > DateTimeOffset.Now // false
dt > DateTimeOffset.UtcNow // also false!!!
We can get "Unspecified" DateTimes from a variety of places including deserialized data such as SQL/EntityFramework.
Comparing an Unspecified DateTime with a DateTimeOffset is a potential source of bugs as it trigger a conversion to local time in both .NET Framework and in modern .NET.
In Australia/Sydney UTC+11:
We can get "Unspecified" DateTimes from a variety of places including deserialized data such as SQL/EntityFramework.
Comparing an Unspecified DateTime with a DateTimeOffset is a potential source of bugs as it trigger a conversion to local time in both .NET Framework and in modern .NET.
Tracked by WI00562111.