[JENKINS-71965] fix timezone in build history (#8800)

* [JENKINS-71965] fix timezone in build history

the timezone shown was always the daylight saving time when the users
selected timezone has daylight saving. The change will now consider the
actual timestamp of the build to determine if it was in daylight saving
time to properly calculate the timezone to show.

* make locale aware
This commit is contained in:
Markus Winter authored and GitHub committed 2023-12-25 07:21:53 -07:00
1 parent df03159afe
commit 48da635be2
2 files changed
+3 -3

No files matched your search

+2 -2
View File
@@ -692,13 +692,13 @@ public class Functions {
}
@Restricted(NoExternalUse.class)
public static String getUserTimeZonePostfix() {
public static String getUserTimeZonePostfix(Date date) {
if (!isUserTimeZoneOverride()) {
return "";
}
TimeZone tz = TimeZone.getTimeZone(getUserTimeZone());
return tz.getDisplayName(tz.observesDaylightTime(), TimeZone.SHORT);
return tz.getDisplayName(tz.inDaylightTime(date), TimeZone.SHORT, getCurrentLocale());
}
@Restricted(NoExternalUse.class)