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 *
5050
5151import megamek .codeUtilities .StringUtility ;
5252import megamek .common .ui .FastJScrollPane ;
53+ import mekhq .MekHQ ;
5354import mekhq .Utilities ;
5455import mekhq .campaign .enums .DailyReportType ;
5556
6061 * @author Jay Lawson
6162 */
6263public 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