Обсуждение: [pgjdbc/pgjdbc] ebada4: Fixes `LocalDateTime` handling of BC dates(#1388)

Поиск
Список
Период
Сортировка

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

От
Kevin Wooten
Дата:
Branch: refs/heads/master
  Home:   https://github.com/pgjdbc/pgjdbc
  Commit: ebada4afb25864bc2d8ba900b433a849c69decf8
      https://github.com/pgjdbc/pgjdbc/commit/ebada4afb25864bc2d8ba900b433a849c69decf8
  Author: Kevin Wooten <kdubb@me.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.