micronaut-projects / micronaut-projects/micronaut-data

Reading Postgresql pre-gregorian dates as LocalDates results in mismatching values

Open
#3,363 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

type: bug
Dominant language
Java
Stars
482
Forks
229
Avg merge
1d 7h
Merged PRs (30d)
32

Description

### Expected Behavior

Dates before 15 October 1582 are converted to LocalDates preserving the value

### Actual Behaviour

Dates before 15 October 1582 are read back with a difference of +6 days.

Conversion seems to happen on
https://github.com/micronaut-projects/micronaut-data/blob/59e5d4c638b1f14f426448f7a733919704e97eac/data-runtime/src/main/java/io/micronaut/data/runtime/convert/DataConversionServiceFactory.java#L668

Date and Instant epoch millis are handled differently before the Julian to Gregorian Calendar switch on 15th October 1582

### Steps To Reproduce

_No response_

### Environment Information

_No response_

### Example Application

_No response_

### Version

4.12

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at data-runtime/src/main/java/io/micronaut/data/runtime/convert/DataConversionServiceFactory.java around line 668, where the issue identifies the conversion. Trace how PostgreSQL dates before 15 October 1582 become LocalDates, then add regression coverage showing that pre-Gregorian values are read back unchanged.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, postgresql
Domain
databases
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.