Skip to content

Time offset splits date and time wrongly for German month-name timestamps (dd MMM yyyy) #759

Open

Description

@Hirogen

SquareBracketColumnizer and TimestampColumnizer show wrong date and time columns when a time offset is set and the timestamp uses one of the German month-name formats (dd MMM yyyy HH:mm:ss[,.fff], formatInfo13–formatInfo15 in TimeFormatDeterminer).

Cause

  1. TimeFormatDeterminer only recognises these lines when the month is exactly 3 characters (span[6] == ' '), e.g. 21 Mär 2022 11:34:34.505.
  2. With a non-zero offset, the columnizer parses the timestamp, adds the offset and formats it again with dd MMM yyyy … in de-DE.
  3. When the format string has dd MMM, .NET formats the month from the genitive abbreviations: Jan.|Feb.|März|Apr.|Mai|Juni|Juli|Aug.|Sept.|Okt.|Nov.|Dez. These are 3 to 5 characters long. The month names it reads in are Jan|Feb|Mär|…, always 3 characters.
  4. The date and time columns are then cut by the format-string lengths (dateLen = "dd MMM yyyy".Length, timeLen = TimeFormat.Length), not from the reformatted string. In SquareBracketColumnizer.SquareSplit that's line[..dateLen] and line.Slice(dateLen + 1, timeLen). In TimestampColumnizer.SplitLine (around lines 105–106) it's newDate[..dateLen] and newDate.Slice(dateLen + 1, timeLen).

So for every month except May, the reformatted timestamp is 1 or 2 characters longer than the slices expect.

Steps to reproduce

  1. Open a log with lines like 21 Mär 2022 11:34:34.505[INFO][Worker]Message.
  2. Use the SquareBracket (or Timestamp) columnizer.
  3. Set a time offset, e.g. +123 ms.

Expected: the date column shows the date, and the time column shows 11:34:34.628.

Actual: the reformatted timestamp is 21 März 2022 11:34:34.628. The date column shows 21 März 202 and the time column shows 2 11:34:34.6. With Sept. it is off by 2 characters. A May timestamp shifted across the month boundary also breaks (31 Mai → 01 Juni).

The bracket fields and message are right after #754, because the split position now comes from newDate.Length. Only the date and time columns are affected.

Suggested direction

Find the date/time boundary in the reformatted string itself, not from the format-string lengths. For example, split newDate at the separator between the date and time parts. Or format the date and time halves separately (dateTime.ToString(DateFormat) and dateTime.ToString(TimeFormat)). Formatting with the same 3-letter month names the parser accepts would also keep the column shape.

Acceptance criteria

  • A test that shifts 21 Mär 2022 11:34:34.505 by +123 ms gives the date column 21 Mär 2022 (or 21 März 2022, whichever is chosen) and the time column 11:34:34.628. This holds for both SquareBracketColumnizer and TimestampColumnizer.
  • Covered: a 4-character month (März), a 5-character month (Sept.) and a shift across a month boundary (31 Mai → 01 Jun…).
  • Offset 0 behaves exactly as it does today.

Related: #713 / #754

Activity

  1. Hirogen commented on Nov 22, 2026

    @Hirogen
    MemberAuthor

    Implementation Brief

    Category: bug
    Summary: With a time offset, German dd MMM yyyy timestamps must be re-formatted with the same 3-letter month names the log uses, so the date and time columns split correctly.

    Depends on: #754. Start once it is merged, or on its branch. #754 changes the same offset path in SquareBracketColumnizer, and this issue assumes its behavior (bracket fields and message split from newDate.Length).

    Verified (on .NET, de-DE):

    • ParseExact("21 Mär 2022 11:34:34.505", "dd MMM yyyy HH:mm:ss.fff", de-DE) + 123 ms, formatted with the same format, gives 21 März 2022 11:34:34.628.
    • With dd MMM, .NET uses AbbreviatedMonthGenitiveNames (Jan.|Feb.|März|Apr.|Mai|Juni|Juli|Aug.|Sept.|Okt.|Nov.|Dez.): 3 to 5 chars. The log and the parser use AbbreviatedMonthNames (Jan|Feb|Mär|…|Dez): always 3 chars. Only May has the same length.
    • 31 Mai 2022 23:59:59.950 + 123 ms gives 01 Juni 2022 00:00:00.073.
    • Formatting the date half on its own (ToString("dd MMM yyyy")) still uses the genitive names, so splitting into two ToString calls does not keep the 3-letter form.
    • A de-DE CultureInfo clone whose DateTimeFormat.AbbreviatedMonthGenitiveNames is set to its AbbreviatedMonthNames formats 21 Mär 2022 11:34:34.628, 01 Sep 2022 … and 01 Jun 2022 ….

    Current behavior:
    With a non-zero time offset, TimestampColumnizer.SplitLine and SquareBracketColumnizer (SplitLine → SquareSplit) parse the timestamp, add the offset, format it again with formatInfo.DateTimeFormat / formatInfo.CultureInfo, and then cut the date and time columns by the format-string lengths (DateFormat.Length, TimeFormat.Length). For formatInfo13–formatInfo15 in TimeFormatDeterminer (dd MMM yyyy + HH:mm:ss[,.fff], de-DE), the formatted month is longer than 3 chars, so:

    • the date column shows 21 März 202 and the time column 2 11:34:34.6 (off by 2 chars for Sept.);
    • GetTimestamp breaks too: both columnizers rebuild the timestamp from columns 0 and 1 ("21 März 202" + " " + "2 11:34:34.6"), ParseExact throws, and the line gets DateTime.MinValue. With an offset set, these lines lose their timestamp, which affects everything that uses it (time sync, timestamp navigation, time-based filtering).

    Desired behavior:

    • With a time offset, the shifted timestamp uses the same 3-letter month names as the log (Mär, Sep, Jun), so it has the same shape and width as the original. For 21 Mär 2022 11:34:34.505 + 123 ms: date column 21 Mär 2022, time column 11:34:34.628.
    • GetTimestamp returns the shifted DateTime for these lines.
    • Offset 0 behaves exactly as today.
    • Other formats (numeric dates, en-US) are unchanged.

    Key interfaces:

    • TimeFormatDeterminer: formatInfo13–formatInfo15 and their FormatInfo.CultureInfo. A culture whose genitive abbreviated month names equal the abbreviated names is one way to get there; set it up once, not per line. A per-format "format culture" or a fix inside the columnizers is also acceptable, as long as no per-line allocation is added.
    • TimestampColumnizer.SplitLine (offset branch, both IgnoreFirstChar cases) and GetTimestamp.
    • SquareBracketColumnizer.SplitLine / SquareSplit (offset branch) and GetTimestamp.
    • Detection still needs the month to be exactly 3 chars (span[6] == ' '), so the log's own text never has the long forms; don't widen detection in this issue.

    Acceptance criteria:

    • For both SquareBracketColumnizer and TimestampColumnizer: 21 Mär 2022 11:34:34.505 with offset +123 ms gives date column 21 Mär 2022 and time column 11:34:34.628. It fails before the fix.
    • Covered for both columnizers: a month whose genitive form is 4 chars (März), one whose genitive form is 5 chars (Sept.), and a shift across a month boundary (31 Mai 2022 23:59:59.950 + 123 ms → 01 Jun 2022 / 00:00:00.073).
    • Covered: all three formats (,fff, .fff, no fraction), and the bracketed form (IgnoreFirstChar) in TimestampColumnizer.
    • GetTimestamp with an offset returns the shifted time for these lines (not DateTime.MinValue), in both columnizers.
    • Offset 0: columns and GetTimestamp unchanged.
    • Bracket fields and message stay correct with an offset (no regression of Preserve bracket fields and message when SquareBracketColumnizer applies a time offset #754).
    • Full test suite passes (known flaky UI tests aside).

    Out of scope:

    • Recognising longer month names or other cultures in TimeFormatDeterminer.
    • Other columnizers or the time-offset UI.
  2. added
    bugPesky little gritter, needs squashing
    on Nov 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugPesky little gritter, needs squashing

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions