TSUCK Member since 2010 125 posts
Posted: 2 weeks ago
Last activity: 2 weeks 4 days ago

Datetime issue with Summer time in Japan (1948 ~ 1951)


Recently a pretty weird issue was reported to me by customer. They have upgraded their Java version, and this has started to happen. The issue is, when end user entered the 2nd of May, 1948 for date of birth field, data got invalid and system threw an error. We've investigated this issue, and found out why. It is a very rare case, but in this post I am sharing the root cause for a reference.


1. Japan DST history

I don't think many people know about this, but DST (Daylight Saving Time), a.k.a summer time was actually once introduced in Japan in 1948, and clocks were advanced by an hour. The system lasted for only three years because total work hours ended up becoming one hour longer and workers complained that they were being exploited.

Japan DST history
12 May 194811 Sep 1948
  • Sunday, 2 May 1948, 00:00:00 clocks were turned forward 1 hour to Sunday, 2 May 1948, 01:00:00 local daylight time instead.
  • Saturday, 11 September 1948, 02:00:00 clocks were turned backward 1 hour to Saturday, 11 September 1948, 01:00:00 local standard time instead.
23 Apr 194910 Sep 1949
  • Sunday, 3 April 1949, 00:00:00 clocks were turned forward 1 hour to Sunday, 3 April 1949, 01:00:00 local daylight time instead.
  • Saturday, 10 September 1949, 02:00:00 clocks were turned backward 1 hour to Saturday, 10 September 1949, 01:00:00 local standard time instead.
37 May 19509 Sep 1950
  • Sunday, 7 May 1950, 00:00:00 clocks were turned forward 1 hour to Sunday, 7 May 1950, 01:00:00 local daylight time instead.
  • Saturday, 9 September 1950, 02:00:00 clocks were turned backward 1 hour to Saturday, 9 September 1950, 01:00:00 local standard time instead.
46 May 19518 Sep 1951
  • Sunday, 6 May 1951, 00:00:00 clocks were turned forward 1 hour to Sunday, 6 May 1951, 01:00:00 local daylight time instead.
  • Saturday, 8 September 1951, 02:00:00 clocks were turned backward 1 hour to Saturday, 8 September 1951, 01:00:00 local standard time instead.


2. System behavior

When DST starts or ends, clocks are turned forward or backward for an hour. That means, this time period is not supposed to exist. So, entering this non existent timestamp will lead to a system error. Be noted that this issue happens only for operators who have "Asia/Tokyo" or "JST" timezone. Other timezone holder (ex. "America/New_York") wouldn't face this issue.

Locale settings

For example, if you try to enter the 2nd of May, 1948, 00:01 for a DateTime field as below.

Enter 5/2/1948 00:01 before Save

When you click "Save" button, system displays an error message as below.

Enter 5/2/1948 00:01 after Save

In this case, the user is notified of the error message, and he can correct data on the spot, which I think is less problematic. However, if the field is Date or Text and after submission activity appends 00:00 to convert it into Datetime in the background, an internal error is thrown in the post processing. I would use Date type for DOB property, but some customer may use Datetime type to preserve timestamp for other usage.


3. What does it have to do with Java version?

The system went live long time ago and the issue was never detected. Why is this issue detected after Java version is upgraded? Per our investigation, in 2018, timezone data was updated to include this past DST in Java. Below is the quote from release announce of "tzdata 2018c". The changes are included from 10, 8u172, 7u181, 6u191 onward.


Changes to past time stamps

     Japanese DST transitions (1948-1951) were Sundays at 00:00, not
     Saturdays or Sundays at 02:00.  (Thanks to Takayuki Nikai.)


To conclude, if your operators have Japan timezone, and if you are planning to use Java version that includes above update, and if you have a Datetime property that could host 1948 - 1951 timestamp data, discuss within your team how to avoid this issue.




***Edited by Moderator: Pooja to add developer knowledge share tag***
Pega Platform 8.4.1 Developer Knowledge Share
Share this page LinkedIn