Skip to content
dshorthouse edited this page Apr 11, 2013 · 6 revisions

Why doesn't the narwhal-processor accept dates like 03/12/1999?

The narwhal-processor (as of today) only produces precise results. The date 03/12/1999 could be 3-December-1999 (Gregorian little-endian) or 12-March (middle-endian, often used in the United States). Note that a date like 14/12/1999 will be parsed since it is not ambiguous. The date processor will eventually include an option to ignore middle-endian dates.

Why isn't a Java Date object returned in the date processor?

The date processor can handle partial dates but the Java Date object is not able to store them (as JDK 7).

How can I create a date range from a partial date?

If you can only store complete dates, you may want to create a date range from a date such as Jun 2003. You can use JSR-310 YearMonth if you want to create a date range starting with the first day of the month and ending with the last day of the month. e.g.

YearMonth ym = YearMonth.of(2012, 2);
ym.lengthInDays();

Important : If you plan to query those dates using a date range (e.g. give me all records between May 1st and May 8th) this solution will require an additional mechanism. You will need a way to differentiate a real date range from the ranges created to accommodate partial dates.