[pgjdbc/pgjdbc] ebada4: Fixes `LocalDateTime` handling of BC dates (#1388)

From: Kevin Wooten <kdubb(at)me(dot)com>
To: pgsql-jdbc(at)lists(dot)postgresql(dot)org
Subject: [pgjdbc/pgjdbc] ebada4: Fixes `LocalDateTime` handling of BC dates (#1388)
Date: 2019-01-16 13:59:00
Message-ID: 5c3f38a499986_65af2ab8583c657868940@hookshot-fe-88eb02d.cp1-iad.github.net.mail
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

Branch: refs/heads/master
Home: https://github.com/pgjdbc/pgjdbc
Commit: ebada4afb25864bc2d8ba900b433a849c69decf8
https://github.com/pgjdbc/pgjdbc/commit/ebada4afb25864bc2d8ba900b433a849c69decf8
Author: Kevin Wooten <kdubb(at)me(dot)com>
Date: 2019-01-16 (Wed, 16 Jan 2019)

Changed paths:
M pgjdbc/src/main/java/org/postgresql/jdbc/TimestampUtils.java
M pgjdbc/src/test/java/org/postgresql/test/jdbc42/SetObject310Test.java

Log Message:
-----------
Fixes `LocalDateTime` handling of BC dates (#1388)

The assertion in `SetObject310Test.testSetLocalDateTimeBc` is

> // -1997-06-30T23:59:59.999999 -> 1997-06-30 23:59:59.999999 BC

This is incorrect. It is actually `-1996 == 1997 BC` because there is no year zero in AD/BC.

I used a `DateTimeFormatter` in the test to prove my case. This “fix” for this method is to fix `TimeStampUtils.appendDate` and stop using the proleptic year (aka `YEAR`) and start using the year of the era (aka `YEAR_OF_ERA`).

**NOTE:** This service has been marked for deprecation: https://developer.github.com/changes/2018-04-25-github-services-deprecation/

Functionality will be removed from GitHub.com on January 31st, 2019.

Browse pgsql-jdbc by date

  From Date Subject
Next Message Vladimir Sitnikov 2019-01-20 20:07:04 [pgjdbc/pgjdbc] ef14ce: test: avoid locale-dependent output in SetObject31...
Previous Message Rob Sargent 2019-01-11 17:07:19 Re: PGCopyOutputStream close() v. endCopy()