Skip to content
Open
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";

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 system property USE_LOCAL_TIMEZONE lacks documentation. A comment should be added to explain:

  • What this property does (controls timezone behavior for date/timestamp formatting)
  • How to set it (as a JVM system property)
  • Valid values (true/false)
  • Default behavior when not set (uses GMT+8)
  • The impact on date/timestamp conversions across the application
Suggested change
/**
* System property: USE_LOCAL_TIMEZONE
*
* Controls timezone behavior for date/timestamp formatting throughout the application.
*
* How to set: Pass as a JVM system property, e.g. -DUSE_LOCAL_TIMEZONE=true
* Valid values: "true" or "false" (case-insensitive)
* Default behavior: If not set or set to "false", uses GMT+8 as the default timezone.
* If set to "true", uses the local system timezone for date/timestamp conversions.
*
* Impact: Affects how dates and timestamps are formatted and parsed across the application.
* Setting this to "true" will use the system's local timezone, which may change the results
* of date/timestamp conversions depending on the environment where the JVM is running.
*/

Copilot uses AI. Check for mistakes.
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 for boolean variables. In Java, boolean variable names should not include "is" as a prefix when declared, since the getter method will add "is" automatically. The variable should be named useLocalTimeZone instead of isUseLocalTimeZone.

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

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);
}

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