Skip to content

Commit cabd68e

Browse files
authored
Merge pull request #8723 from MegaMek/fix/8653-daily-report-category-highlight
Fix daily report category tabs highlighting when empty (Fixes #8653)
2 parents 034f8be + 3158d13 commit cabd68e

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

MekHQ/src/mekhq/gui/DailyReportLogPanel.java

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
* Copyright (c) 2009 - Jay Lawson (jaylawson39 at yahoo.com). All Rights Reserved.
3-
* Copyright (C) 2013-2025 The MegaMek Team. All Rights Reserved.
3+
* Copyright (C) 2013-2026 The MegaMek Team. All Rights Reserved.
44
*
55
* This file is part of MekHQ.
66
*
@@ -50,6 +50,7 @@
5050

5151
import megamek.codeUtilities.StringUtility;
5252
import megamek.common.ui.FastJScrollPane;
53+
import mekhq.MekHQ;
5354
import mekhq.Utilities;
5455
import mekhq.campaign.enums.DailyReportType;
5556

@@ -60,8 +61,6 @@
6061
* @author Jay Lawson
6162
*/
6263
public class DailyReportLogPanel extends JPanel {
63-
private static final DateTimeFormatter DAILY_REPORT_DATE_FORMAT = DateTimeFormatter.ofPattern("EEEE, MMMM d, yyyy");
64-
6564
//region Variable Declarations
6665
private final CampaignGUI gui;
6766
final JScrollPane logPanel = new FastJScrollPane();
@@ -185,8 +184,7 @@ public void appendLog(final List<String> newReports, final DailyReportType type)
185184
* <ul>
186185
* <li>{@code reports} contains exactly one element,</li>
187186
* <li>that element is wrapped in {@code <b>} and {@code </b>} tags, and</li>
188-
* <li>the inner text parses successfully as a {@link LocalDate} using the {@link #DAILY_REPORT_DATE_FORMAT}
189-
* formatter.</li>
187+
* <li>the inner text parses successfully as a {@link LocalDate} using the user's configured date format.</li>
190188
* </ul>
191189
*
192190
* <p>If the list size is not exactly one, the element is not correctly formatted, or the inner text cannot be
@@ -208,7 +206,12 @@ public static boolean isDateOnly(List<String> reports) {
208206
String line = reports.get(0);
209207
String inner = line.substring(3, line.length() - 4); // strip <b> and </b>
210208

211-
LocalDate.parse(inner, DAILY_REPORT_DATE_FORMAT);
209+
// Use the user's configured date format and locale to match what's displayed
210+
DateTimeFormatter formatter = DateTimeFormatter.ofPattern(
211+
MekHQ.getMHQOptions().getLongDisplayDateFormat()
212+
).withLocale(MekHQ.getMHQOptions().getDateLocale());
213+
214+
LocalDate.parse(inner, formatter);
212215
isDateOnly = true;
213216
} catch (Exception ignored) {
214217
// Not a formatted date — do nothing

0 commit comments

Comments
 (0)