Skip to content

Commit d43faa5

Browse files
committed
Branch: fix/8653-daily-report-category-highlight
Staged changes: - Added import for mekhq.MekHQ - Removed hardcoded DAILY_REPORT_DATE_FORMAT constant - Updated isDateOnly() to use user's configured date format and locale via MekHQ.getMHQOptions().getLongDisplayDateFormat() and MekHQ.getMHQOptions().getDateLocale()
1 parent c488c5f commit d43faa5

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

MekHQ/src/mekhq/gui/DailyReportLogPanel.java

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -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();
@@ -208,7 +207,12 @@ public static boolean isDateOnly(List<String> reports) {
208207
String line = reports.get(0);
209208
String inner = line.substring(3, line.length() - 4); // strip <b> and </b>
210209

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

0 commit comments

Comments
 (0)