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

@kdubb
Copy link
Contributor

@kdubb kdubb 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?
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
Copy link

@codecov-io codecov-io 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
vlsi added a commit that referenced this issue Jan 20, 2019
davecramer added a commit to davecramer/pgjdbc that referenced this issue Jul 5, 2021
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`).
davecramer added a commit to davecramer/pgjdbc that referenced this issue Jul 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

3 participants