Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ public class DateUtil {

private static final String TIME_ZONE = "GMT+8";

private static final boolean isUseLocalTimeZone =
Copy link

Copilot AI Dec 1, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The variable name isUseLocalTimeZone does not follow Java naming conventions. Boolean variables should not have the "is" prefix when they are constants. According to Java naming conventions and the codebase style (e.g., DEFAULT_IS_DAEMON in ExecutorUtils.java), this should be named USE_LOCAL_TIMEZONE or USE_LOCAL_TIME_ZONE.

Suggested change
private static final boolean isUseLocalTimeZone =
private static final boolean USE_LOCAL_TIMEZONE =

Copilot uses AI. Check for mistakes.
Boolean.parseBoolean(System.getProperty("USE_LOCAL_TIMEZONE"));

private static final String STANDARD_DATETIME_FORMAT = "standardDatetimeFormatter";

private static final String STANDARD_DATETIME_FORMAT_FOR_MILLISECOND =
Expand Down Expand Up @@ -97,7 +100,12 @@ public class DateUtil {
public static ThreadLocal<Map<String, SimpleDateFormat>> datetimeFormatter =
ThreadLocal.withInitial(
() -> {
TimeZone timeZone = TimeZone.getTimeZone(TIME_ZONE);
TimeZone timeZone;
if (isUseLocalTimeZone) {
timeZone = TimeZone.getDefault();
} else {
timeZone = TimeZone.getTimeZone(TIME_ZONE);
}
Comment on lines +103 to +108
Copy link

Copilot AI Dec 1, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new timezone selection logic based on the USE_LOCAL_TIMEZONE system property lacks test coverage. The DateUtilTest.java file contains tests for the DateUtil class, but none verify the behavior when this system property is set. Consider adding tests to validate:

  1. The default behavior when USE_LOCAL_TIMEZONE is not set (should use GMT+8)
  2. The behavior when USE_LOCAL_TIMEZONE is set to "true" (should use system default timezone)
  3. The behavior when USE_LOCAL_TIMEZONE is set to "false" (should use GMT+8)

Copilot uses AI. Check for mistakes.

Map<String, SimpleDateFormat> formatterMap = new HashMap<>();
SimpleDateFormat standardDatetimeFormatter =
Expand Down
Loading