[
https://jira.jboss.org/jira/browse/DNA-491?page=com.atlassian.jira.plugin...
]
Randall Hauch commented on DNA-491:
-----------------------------------
This is a good suggestion for improved date-time semantics. The equals method should
indeed test whether the instants in time are semantically the same, regardless of the
timezone or chronology.
Might even be good to add an "isSame(DateTime)" method that does the current
behavior (both objects represent equivalent logical instants AND have the exact same time
zones AND are based on the same Chronology).
JodaDateTime Is Using Overly-Strict Equality Test
-------------------------------------------------
Key: DNA-491
URL:
https://jira.jboss.org/jira/browse/DNA-491
Project: DNA
Issue Type: Bug
Affects Versions: 0.5
Reporter: Brian Carothers
The JodaDateTime class, the default DateTime implementation for DNA, uses JODA DateTimes
internally to represent instants in time in a time zone-neutral, machine portable fashion.
By default, the equals method for JodaDateTime is using the DateTime.equals(Object)
method[1]. This method checks that both objects represent equivalent logical instants AND
have the exact same time zones AND are based on the same Chronology[2]. This implies that
a date time representing 2:00 PM EST would not be ".equals" to another date time
representing 1:00 PM CST on the same date, even though both represent the same logical
instant. Additionally, DNA doesn't specify chronologies, leaving JODA to infer the
chronology based on the date source.
I recommend that we shift from using DateTime.equals(Object) to
DateTime.isEqual(ReadableInstant)[3] internally to avoid these problems. This issue keeps
the JPA connector from properly storing/reloading date properties on the TCK test.
[1] -
http://joda-time.sourceforge.net/api-release/org/joda/time/base/AbstractI...
[2] - JODA Chronologies are basically types of calendar like ISO8660, Gregorian/Julian,
etc.
[3] -
http://joda-time.sourceforge.net/api-release/org/joda/time/base/AbstractI...
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira