Subject: [pgjdbc/pgjdbc] PR #3887: fix: make all Calendar instances proleptic Gregorian (#3837)

From: "m-van-tilburg (@m-van-tilburg)" <[email-masked]>
Date: Thu, 04 Dec 2025 14:22:17 +0000

Calendar instances created with Calendar.getInstance() or new GregorianCalendar() are by default a hybrid of the Julian and the Gregorian calendar. Java classes like java.sql.Date and SimpleDateFormat also (sometimes) use Calendar instances and therefore might also be affected. This differs from the java.time classes that use the proleptic Gregorian calendar by default. The postgresql server also uses the proleptic Gregorian calendar and therefore it makes sense to make all Calendar instances in the pgjdbc code proleptic Gregorian too. This will fix #3837

---

From: "m-van-tilburg (@m-van-tilburg)" <[email-masked]>
Date: Thu, 04 Dec 2025 14:32:04 +0000

(on pgjdbc/src/main/java/org/postgresql/jdbc/TimestampUtils.java)

This method has been duplicated in several places, it might be a good idea to make it public here and call it from the other places if that doesn't violate any package boundaries that I am unaware of

---

From: "m-van-tilburg (@m-van-tilburg)" <[email-masked]>
Date: Thu, 04 Dec 2025 15:01:50 +0000

I did not use `new Calendar.Builder().setCalendarType("iso8601").build())` because besides resulting in a proleptic Gregorian calendar it changes other things for the Calendar instance that might have unforeseen consequences

---

From: "davecramer (@davecramer)" <[email-masked]>
Date: Thu, 04 Dec 2025 20:20:16 +0000

Yes, we can put it in util as a static method

---

From: "m-van-tilburg (@m-van-tilburg)" <[email-masked]>
Date: Fri, 05 Dec 2025 18:44:09 +0000

Changed it to a public method, used it everywhere else and gave it its own test

---

From: "m-van-tilburg (@m-van-tilburg)" <[email-masked]>
Date: Tue, 16 Dec 2025 12:07:44 +0000

@davecramer do you have any review comments that I should address?