JDK-8300097 : Possibly wrong DST rules in Europe/Dublin and Africa/Casablanca
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.time
  • Affected Version: 11,17,20
  • Priority: P4
  • Status: Open
  • Resolution: Unresolved
  • Submitted: 2023-01-13
  • Updated: 2023-01-13
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other
tbdUnresolved
Related Reports
Relates :  
Description
JDK may have wrong DST rules for Europe/Dublin and Africa/Casablanca.
Reading through the timezone data (europe and africa), the DST in Europe/Dublin from 1968/10/27 to 1971/10/31 is not observed.  However, the JDK returns the results as Dublin has DST during this period.

# Rule	NAME	FROM	TO	-	IN	ON	AT	SAVE	LETTER/S
Rule	Eire	1971	only	-	Oct	31	 2:00u	-1:00	-
Rule	Eire	1972	1980	-	Mar	Sun>=16	 2:00u	0	-
Rule	Eire	1972	1980	-	Oct	Sun>=23	 2:00u	-1:00	-
Rule	Eire	1981	max	-	Mar	lastSun	 1:00u	0	-
Rule	Eire	1981	1989	-	Oct	Sun>=23	 1:00u	-1:00	-
Rule	Eire	1990	1995	-	Oct	Sun>=22	 1:00u	-1:00	-
Rule	Eire	1996	max	-	Oct	lastSun	 1:00u	-1:00	-

# Zone	NAME		STDOFF	RULES	FORMAT	[UNTIL]
		#STDOFF	-0:25:21.1
Zone	Europe/Dublin	-0:25:21 -	LMT	1880 Aug  2
			-0:25:21 -	DMT	1916 May 21  2:00s
			-0:25:21 1:00	IST	1916 Oct  1  2:00s
			 0:00	GB-Eire	%s	1921 Dec  6 # independence
			 0:00	GB-Eire	GMT/IST	1940 Feb 25  2:00s
			 0:00	1:00	IST	1946 Oct  6  2:00s
			 0:00	-	GMT	1947 Mar 16  2:00s
			 0:00	1:00	IST	1947 Nov  2  2:00s
			 0:00	-	GMT	1948 Apr 18  2:00s
			 0:00	GB-Eire	GMT/IST	1968 Oct 27
# Vanguard section, for zic and other parsers that support negative DST.
			 1:00	Eire	IST/GMT
# Rearguard section, for parsers lacking negative DST; see ziguard.awk.
#			 1:00	-	IST	1971 Oct 31  2:00u
#			 0:00	GB-Eire	GMT/IST	1996
#			 0:00	EU	GMT/IST
# End of rearguard section.

jshell> ZoneId DUBLIN = ZoneId.of("Europe/Dublin")
jshell> Instant i1 = Instant.from(ZonedDateTime.of(LocalDate.of(1970, 6, 23), LocalTime.MIN, DUBLIN))
jshell> Instant i2 = Instant.from(ZonedDateTime.of(LocalDate.of(1971, 6, 23), LocalTime.MIN, DUBLIN))
jshell> DUBLIN.getRules().getOffset(i1)
$21 ==> +01:00
jshell> DUBLIN.getRules().getStandardOffset(i1)
$22 ==> Z
jshell> DUBLIN.getRules().getOffset(i2)
$23 ==> +01:00
jshell> DUBLIN.getRules().getStandardOffset(i2)
$23 ==> Z

In Africa/Casablanca, the offset between 2038/9/26 and 2038/11/6 should be GMT-1.  However the JDK returns the results as no DST defined during this period.

Rule	Morocco	2038	only	-	Sep	26	 3:00	-1:00	-
Rule	Morocco	2038	only	-	Nov	 7	 2:00	0	-

jshell> ZoneId CASABLANCA = ZoneId.of("Africa/Casablanca")
jshell> Instant i3 = Instant.from(ZonedDateTime.of(LocalDate.of(2038, 11, 1), LocalTime.MIN, CASABLANCA))
jshell> CASABLANCA.getRules().getOffset(i3)
$26 ==> Z
jshell> CASABLANCA.getRules().getStandardOffset(i3)
$27 ==> Z