-
Bug
-
Resolution: Fixed
-
P4
-
None
-
None
-
b07
-
generic
-
generic
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8336077 | 21.0.6-oracle | Johny Jose | P4 | Open | Unresolved | |
JDK-8336076 | 17.0.14-oracle | Johny Jose | P4 | Open | Unresolved | |
JDK-8336075 | 11.0.26-oracle | Johny Jose | P4 | Open | Unresolved | |
JDK-8336078 | 8u441 | Johny Jose | P4 | Open | Unresolved |
The definition of the `Africa/Casablanca` zone has `1:00` as the standard offset since 10/28/2018, and the rules for the zone has entries beyond the year 2037, such as:
```
Rule Morocco 2037 only - Oct 4 3:00 -1:00 -
Rule Morocco 2037 only - Nov 15 2:00 0 -
Rule Morocco 2038 only - Sep 26 3:00 -1:00 -
Rule Morocco 2038 only - Oct 31 2:00 0 -
Rule Morocco 2039 only - Sep 18 3:00 -1:00 -
Rule Morocco 2039 only - Oct 23 2:00 0 -
...
Rule Morocco 2086 only - Apr 14 3:00 -1:00 - (*)
Rule Morocco 2086 only - May 19 2:00 0 -
Rule Morocco 2087 only - Mar 30 3:00 -1:00 -
Rule Morocco 2087 only - May 11 2:00 0 -
```
So for example, looking at the transition marked with `*`, the following code
```
var tz = TimeZone.getTimeZone("Africa/Casablanca");
var zi = tz.toZoneId();
var i = ZonedDateTime.of(LocalDateTime.of(2086, 4, 14, 2, 59), zi).toInstant();
var d = Date.from(i);
System.out.println(zi.getRules().isDaylightSavings(i));
System.out.println(tz.inDaylightTime(d));
i = ZonedDateTime.of(LocalDateTime.of(2086, 4, 14, 3, 0), zi).toInstant();
d = Date.from(i);
System.out.println(zi.getRules().isDaylightSavings(i));
System.out.println(tz.inDaylightTime(d));
```
should print:
```
true
true
false
false
```
but current implementation prints:
```
true
true
false
true
```
The cause of this issue was there is the definition of the `last year` as `2037`, and transitions are only considered till that year. This restriction seems to come from the old `zic` implementation, thus no longer applicable to the JDK. The `last year` has to be expanded to some year after 2087, which is the greatest transition year currently existing in the TZDB files.
```
Rule Morocco 2037 only - Oct 4 3:00 -1:00 -
Rule Morocco 2037 only - Nov 15 2:00 0 -
Rule Morocco 2038 only - Sep 26 3:00 -1:00 -
Rule Morocco 2038 only - Oct 31 2:00 0 -
Rule Morocco 2039 only - Sep 18 3:00 -1:00 -
Rule Morocco 2039 only - Oct 23 2:00 0 -
...
Rule Morocco 2086 only - Apr 14 3:00 -1:00 - (*)
Rule Morocco 2086 only - May 19 2:00 0 -
Rule Morocco 2087 only - Mar 30 3:00 -1:00 -
Rule Morocco 2087 only - May 11 2:00 0 -
```
So for example, looking at the transition marked with `*`, the following code
```
var tz = TimeZone.getTimeZone("Africa/Casablanca");
var zi = tz.toZoneId();
var i = ZonedDateTime.of(LocalDateTime.of(2086, 4, 14, 2, 59), zi).toInstant();
var d = Date.from(i);
System.out.println(zi.getRules().isDaylightSavings(i));
System.out.println(tz.inDaylightTime(d));
i = ZonedDateTime.of(LocalDateTime.of(2086, 4, 14, 3, 0), zi).toInstant();
d = Date.from(i);
System.out.println(zi.getRules().isDaylightSavings(i));
System.out.println(tz.inDaylightTime(d));
```
should print:
```
true
true
false
false
```
but current implementation prints:
```
true
true
false
true
```
The cause of this issue was there is the definition of the `last year` as `2037`, and transitions are only considered till that year. This restriction seems to come from the old `zic` implementation, thus no longer applicable to the JDK. The `last year` has to be expanded to some year after 2087, which is the greatest transition year currently existing in the TZDB files.
- backported by
-
JDK-8336075 Daylight saving information for `Africa/Casablanca` are incorrect
- Open
-
JDK-8336076 Daylight saving information for `Africa/Casablanca` are incorrect
- Open
-
JDK-8336077 Daylight saving information for `Africa/Casablanca` are incorrect
- Open
-
JDK-8336078 Daylight saving information for `Africa/Casablanca` are incorrect
- Open
- relates to
-
JDK-8223388 TestZoneInfo310.java fails post tzdata2018i integration
- Closed
(2 links to)