New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DateTimeZone needs to have well-defined equality #81

Closed
GoogleCodeExporter opened this Issue Mar 15, 2015 · 1 comment

Comments

Projects
None yet
2 participants
@GoogleCodeExporter

GoogleCodeExporter commented Mar 15, 2015

(From Jon:) Currently, FixedDateTimeZone overrides Equals(object) to compare 
itself with other fixed zones, but other time zones don't.  (Malcolm: This is 
bad for e.g. ZonedDateTime's Equals(object) implementation.)

It would be useful for zones to implement equality sensibly. In particular, 
asking a single IDateTimeZoneSource for a zone with the same ID should yield 
references to equal objects, even if they're two separate objects.

Whether two zones from *separate* sources which share the same original source 
data are equal is probably best left to be source-specific, although it would 
be preferable if they were.

(Malcolm: See also issue 65 for some more of the above.)

If we make DateTimeZone implement IEquatable<DateTimeZone> but with an abstract 
Equals(DateTimeZone) method, this will force implementations to at least 
acknowledge that they ought to be doing something sensible. It can also 
override Equals(object) to call Equals(DateTimeZone) appropriately so this can 
be done in just one place.

Original issue reported on code.google.com by malcolm.rowe on 11 Jul 2012 at 12:33

@GoogleCodeExporter

This comment has been minimized.

GoogleCodeExporter commented Mar 15, 2015

Fixed in change f9e425cae54f.

(Could do with more tests, but it's not a bad start...)

Original comment by jonathan.skeet on 11 Jul 2012 at 8:52

  • Changed state: Fixed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment