You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Specifying a tzid of "UTC" should ensure that Value.Kind is DateTimeKind.Utc
Specifying a non-UTC tzid should ensure that Value.Kind is DateTimeKind.Local
Everything else should leave the Kind property alone
Right now, the bug is that Anything that doesn't have an explicit, real, time zone is marked as Unspecified which is wrong. We shouldn't touch it in that case.
[Test,TestCaseSource(nameof(DateTimeKindOverrideTestCases))]publicDateTimeKindDateTimeKindOverrideTests(DateTimedateTime,stringtzId)=>newCalDateTime(dateTime,tzId).Value.Kind;publicstaticIEnumerable<ITestCaseData>DateTimeKindOverrideTestCases(){conststringlocalTz="America/New_York";varlocalDt=DateTime.SpecifyKind(DateTime.Parse("2018-05-21T11:35:33"),DateTimeKind.Local);yieldreturnnewTestCaseData(localDt,"UTC").Returns(DateTimeKind.Utc).SetName("Explicit tzid = UTC time zone returns DateTimeKind.Utc");yieldreturnnewTestCaseData(DateTime.SpecifyKind(localDt,DateTimeKind.Utc),null).Returns(DateTimeKind.Utc).SetName("DateTime with Kind = Utc and no tzid returns DateTimeKind.Utc");yieldreturnnewTestCaseData(localDt,localTz).Returns(DateTimeKind.Local).SetName("Local datetime with local tzid returns DateTimeKind.Local");yieldreturnnewTestCaseData(DateTime.SpecifyKind(localDt,DateTimeKind.Utc),localTz).Returns(DateTimeKind.Local).SetName("DateTime with Kind = Utc with explicit local tzid returns DateTimeKind.Local");yieldreturnnewTestCaseData(DateTime.SpecifyKind(localDt,DateTimeKind.Unspecified),localTz).Returns(DateTimeKind.Local).SetName("DateTime with Kind = Unspecified with explicit local tzid returns DateTimeKind.Local");yieldreturnnewTestCaseData(localDt,null).Returns(DateTimeKind.Local).SetName("DateTime with Kind = Local with null tzid returns DateTimeKind.Local");yieldreturnnewTestCaseData(DateTime.SpecifyKind(localDt,DateTimeKind.Unspecified),null).Returns(DateTimeKind.Unspecified).SetName("DateTime with Kind = Unspecified and null tzid returns DateTimeKind.Unspecified");}
The text was updated successfully, but these errors were encountered:
Value.Kind
isDateTimeKind.Utc
Value.Kind
isDateTimeKind.Local
Kind
property aloneRight now, the bug is that Anything that doesn't have an explicit, real, time zone is marked as
Unspecified
which is wrong. We shouldn't touch it in that case.The text was updated successfully, but these errors were encountered: