Details
-
Bug
-
Status: Closed
-
Minor
-
Resolution: Fixed
-
None
-
None
Description
While I find it mildly surprising that you can convert from a Day to a Date, I would expect that in doing so the Day (Date.getDate()) value within Date would be accurate (even if all other fields are meaningless).
// The output of each println (from a single run) is placed in comments beside it
public void testShowErrorsInSimpleFashion() throws Exception
When I look in DataHelperImpl.java, I see a series of Date Patterns. It seems that Day is being matched to an earlier pattern than the expected one (the expected one is "---dd zz"). When I move that pattern to first in the list, the outcome is affected. Were it not matching an earlier pattern, I would think that moving the correct one to the front of the list would not have an effect.
Leaving DataHelperImpl.java unaltered, Day = 21 EDT, and Day2 = 29 EST (in the case above). However, if I put the appropriate pattern first in the list, Day2 is instead = 20 EST. Interestingly, it is still not the correct day (21).
Frank pointed out that there have been recent updates to DataHelper, however I've retested with build level 425652 and see the same behavior.
Side note:
The following is not a JIRA issue, but it is related. In the second table on page 146 the Date conversions for most types are essentially to the same type, to Date, and to String. It seems that several more are possible. The following seem capable of being added:
DateTime-> Month, MonthDay, YearMonth, YearMonthDay, Time, Year, Duration, Day
Duration->Month, MonthDay, YearMonth, YearMonthDay, Time, Year, DateTime, Day
MonthDay->Month, Day
YearMonth->Month, Year
YearMonthDay->Month, Year, Day, YearMonth, MonthDay