The EqualsImpl method in the Nodatime BclDateTimeZone class throws a NotImplementedException. It is documented to behave in this way - is there a reason for this?
If testing equality of two ZonedDateTimes that use a BclDateTimeZone this causes the exception to be thrown.
Is this a bug, it doesn't seem right?
Yup - it's basically very hard to determine zone equality in a general way. Suppose we have two
BclDateTimeZoneinstances which wrap two distinctTimeZoneInfovalues... we could:TimeZoneInfo.Localhas an ID ofLocalIIRC)I agree that it's a pain, and I think I'm planning on removing value equality on
ZonedDateTimeentirely in Noda Time 2.0, and makeZonedDateTimeuse reference equality.If you want to compare time zones, a better alternative is likely to be the use of
ZonedEqualityComparerto specify how you want them to be compared.But the inability to compare
ZonedDateTimevalues for equality when using BCL values is definitely nasty. I've raised a bug for that; I'm preparing a 1.3.1 release, and I might see if I can fix it there, rather than you having to wait for 2.0.