|
When running Postgis online tests in a Vancouver Time zone, the testFiltersByDate test fails:
PostgisDateOnlineTest>OnlineTestCase.run:123->JDBCDateOnlineTest.testFiltersByDate:45 expected:<2> but was:<1>
The test case defines: DateFormat df = new SimpleDateFormat("yyyy-dd-MM"); df.setTimeZone( TimeZone.getTimeZone("PST")); Then, it constructs a query, calling df.parse("2009-28-06"), which returns a java.util.Date: "Sun Jun 28 00:00:00 PDT 2009" (Notice the timezone) This query eventually has a simplifyingFilterVisitor called on it, which causes the date to be cast to a java.sql.Date: "2009-27-06" Since sql dates have no time component, the time is truncated and due to the timezone results in the 27th. This causes the filter to match only one date instead of two (as expected).
|