Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes `LocalDateTime` handling of BC dates #1388

Merged
merged 1 commit into from Jan 16, 2019

Conversation

Projects
None yet
3 participants
@kdubb
Copy link
Contributor

commented Jan 16, 2019

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).

All Submissions:

  • Have you followed the guidelines in our Contributing document?
  • Have you checked to ensure there aren't other open Pull Requests for the same update/change?

New Feature Submissions:

  1. Does your submission pass tests?
  2. Does mvn checkstyle:check pass ?

Changes to Existing Features:

  • Does this break existing behaviour? If so please explain.

BC LocalDateTime handling was previously incorrect as it didn't handle proleptic year conversion correctly.

  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you written new tests for your core changes, as applicable?
  • Have you successfully run tests with your changes locally?
Fixes `LocalDateTime` handling of BC dates
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`).
@codecov-io

This comment has been minimized.

Copy link

commented Jan 16, 2019

Codecov Report

Merging #1388 into master will decrease coverage by 0.01%.
The diff coverage is 100%.

@@             Coverage Diff             @@
##             master   #1388      +/-   ##
===========================================
- Coverage     68.72%   68.7%   -0.02%     
+ Complexity     3895    3893       -2     
===========================================
  Files           179     179              
  Lines         16394   16394              
  Branches       2668    2668              
===========================================
- Hits          11266   11264       -2     
- Misses         3881    3882       +1     
- Partials       1247    1248       +1

@davecramer davecramer merged commit ebada4a into pgjdbc:master Jan 16, 2019

2 checks passed

codecov/project Absolute coverage decreased by -0.01% but relative coverage increased by +31.27% compared to a7f63bf
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details

vlsi added a commit that referenced this pull request Jan 20, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.