SCENARIO
I have two UTC timestamps that are 7 days apart
:
val timestamp1: Long = 1600642800000L // GMT => Sunday, September 20, 2020 11:00:00 PM
val timestamp1: Long = 1601247600000L // GMT => Sunday, September 27, 2020 11:00:00 PM
The timezone used here is Africa/Casablanca.
val timeZone = DateTimeZone.forID("Africa/Casablanca")
Then, when I try to generate offset
for both timestamps, it shows weird behavior:
timeZone.getOffset(timestamp1) // 3600000 milliseconds OR 1 hour
timeZone.getOffset(timestamp2) // 0 milliseconds
Africa/Casablanca currently has Day Light Saving enabled since May 24, 2020. It's clock was shifted on that day forward by 1 hr. So, currently it is at UTC + 1
hr. When Day Light Saving is not active, it is at UTC + 0
.
QUESTION
So, how is the above behavior possible ? Shouldn't both timestamps generate the same 1 hr offset ? Those two timestamps are only 7 days apart and no any Day Light Saving event happened between those timestamps.
I tried to reproduce similar behavior for other timezones but they always produce the same offset for those timestamps as expected.
Any insights on this behavior would be extremely helpful.