Skip to content

[$250] 93447 - Concierge - Timezone in VictoryChart not updated to user’s timezone #93791

Closed

Description

@applause-bot

If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!


Version Number: 9.4.9-0
Reproducible in staging?: Yes
Reproducible in production?: Yes
If this was caught during regression testing, add the test name, ID and link from BrowserStack: #93447
Email or phone of affected tester (no customers): N/A
Issue reported by: Applause Internal Team
Bug source: Pull Request QA execution
Device used: Windows 11 / Chrome, iPhone 13 / iOS 26.5, Samsung A52 / Android 14
App Component: Other

Action Performed:

Preconditions:

  • Logged in to any user that has several expenses
  • Navigate to Concierge chat or #admin rooms of a workspace Send this messsage to Concierge “make a VictoryChart that has an "As of: date and time" based on my timezone as the subtitle under the chart title for all expenses. Make it for Monthly spend, top categories, and top employees by spend”
  • Wait for Concierge to reply with VIctoryChart displayed (note that the subtitle time doesn't matches to my timezone)

Steps:

  1. Change the timezone on Profile settings to America/Los_Angeles
  2. Open the Concierge chat message with a VictoryChart that has an As of:subtitle under the chart title (note that the subtitle time doesn't change, it's expected)
  3. Change the timezone in settings (I changed to Asia/Tokyo) and reopen the chat

Expected Result:

  • in preconditions, the subtitle time in VictoryChart doesn't matches to my timezone
  • in step 3, subtitle time should change

Actual Result:

  • In preconditions, the subtitle time in VictoryChart that the Concierge made doesn't matches to my timezone
  • in step 3, subtitle time doesn't change

Workaround:

Unknown

Platforms:

  • Android: App
  • Android: mWeb Chrome
  • iOS: App
  • iOS: mWeb Safari
  • iOS: mWeb Chrome
  • Windows: Chrome
  • MacOS: Chrome Safari

Screenshots/Videos

Bug7183299_1781691271843.809050d9a22f5c96ea4d42e82f312978.mp4

View all open jobs on GitHub

Applause Internal Information
Exported by: Mita Rachim
Bug ID: 7183299

Upwork Automation - Do Not Edit

Activity

  1. added
    Daily
    Bug
    on Jun 17, 2026
  2. applause-bot commented on Jun 17, 2026

    @applause-bot
    Author

    While Applause doesn't embed attachments for this bug, here are the links for quick view:
    https://platform.applause.com/services/links/v1/external/ae2614a3db64597a1b3c620c8ef035d23ec23fb0e66f336dfc376122432835ae

  3. MelvinBot commented on Jun 17, 2026

    @MelvinBot
    Contributor

    ⚠️ Preliminary analysis — this report does not yet demonstrate a reproducible bug; please see the clarification request below.

    Issue Analysis

    The Expected Result and Actual Result in this report are identical. Both say:

    • In preconditions, the subtitle time doesn't match my timezone
    • In step 3, subtitle time doesn't change

    As written, the actual behavior matches the expected behavior, so there is no demonstrated discrepancy to fix. The reporter also notes in step 2 that the subtitle not changing is "expected". Before this can be actioned, we need to know what the correct behavior should be (i.e., should the "As of:" subtitle reflect/track the viewer's timezone, or not?).

    Most likely the underlying concern: PR #93447 ("Use user timezone") added client-side localization so the chart's As of: subtitle renders in the viewer's timezone. QA found it isn't taking effect for this AI-generated chart. The localizer is intentionally narrow and silently no-ops on text it can't parse:

    • It only rewrites labels matching the regex ^As of:\s*(.+)$ whose datetime parses against the server's fixed format MMM d, yyyy [at] h:mm aa (parse formats).
    • If the regex doesn't match or the date can't be parsed, it returns the original text unchanged (file:38-54).

    In this test, the user explicitly prompted Concierge to "make … an 'As of: date and time' based on my timezone as the subtitle." That subtitle is free-form text generated by the AI, not the deterministic UTC As of: label the localizer expects. If the AI emits a different shape (full month name like "June", a baked-in timezone/offset, or a non-UTC time), it falls through the localizer untouched — which exactly explains "doesn't match my timezone" and "doesn't change when I switch timezones."

    Investigation details
    • Timezone is correctly plumbed: VictoryChartCartesian.tsx:29,60-63 and VictoryChartPolar.tsx:27,39-42 pass timezone={timezone} and key the label on the timezone, so a timezone change does re-render and re-localize — when the text is parseable.
    • The localized value is applied at VictoryChartLabel.tsx:33. The wiring is correct; the gap is the parse step rejecting non-server-format text.
    • Alternative explanation considered: a genuine plumbing/render bug. Ruled lower because the timezone prop and re-render key are present and correct in both chart types; the symptom set (no match + no reaction to change) is the signature of the silent no-op path, not a missing prop.

    Confidence: Medium on the technical mechanism (I can't see the exact AI-generated subtitle string in the attached video to confirm the parse failure). High that the report as written shows no Expected/Actual discrepancy.

    What's needed to proceed:

    1. Clarify the intended behavior — should an AI-authored As of: subtitle be localized to the viewer's timezone, or is the current behavior acceptable?
    2. If localization is expected here, capture the exact subtitle string Concierge produced (from the video/devtools). If it isn't the server's MMM d, yyyy at h:mm a UTC format, this is a server/Concierge content-format question (the chart subtitle is generated server-side), not a frontend rendering fix.

    Next Steps: Reply with @MelvinBot <your feedback> to refine this analysis, or provide the captured subtitle text so I can confirm the parse path.

  4. added
    External
    on Jun 17, 2026
  5. added
    Help Wanted
    on Jun 17, 2026
  6. David-2002065 commented on Jun 17, 2026

    @David-2002065
    Contributor

    Proposal

    Please re-state the problem that we are trying to solve in this issue.

    The As of: ... subtitle of a Concierge VictoryChart is still rendered in UTC and does not get localized to / updated with the viewer's selected timezone, even after the fix in #93447.

    What is the root cause of that problem?

    #93447 localizes the subtitle in getLocalizedVictoryChartLabelText, which matches the label text against

    const AS_OF_LABEL_PATTERN = /^As of:\s*(.+)$/i;
    

    and runs it against the whole label text here

    function getLocalizedVictoryChartLabelText(text: string, timezone?: SelectedTimezone): string {
    if (!timezone) {
    return text;
    }
    const match = text.trim().match(AS_OF_LABEL_PATTERN);
    if (!match) {
    return text;
    }
    const utcDate = parseDateAsUTC(match[1]);
    if (!utcDate) {
    return text;
    }
    const localizedDate = DateUtils.formatInTimeZoneWithFallback(utcDate, timezone, CHART_DISPLAY_FORMAT);
    return `As of: ${localizedDate}`;
    }

    But a <victorylabel> node is multi-line — the chart title and the As of: ... subtitle are two lines of one node, with per-line styles, which is exactly why VictoryChartLabel splits on \n and indexes color/fontSize per line:

    const displayText = getLocalizedVictoryChartLabelText(text, timezone);
    const processedLines = displayText.split('\n').reduce(

    text: unescapeVictoryChartText(parseAttributeAsString(tnode.attributes.text) ?? ''),

    So the real text is e.g. Monthly spend\nAs of: Jun 5, 2026 at 06:47 PM. AS_OF_LABEL_PATTERN has no m (multiline) flag, so ^As of: only anchors to the start of the string, never to the start of the second line. The match fails, the function returns the original text unchanged, and the subtitle stays in UTC. The unit tests added in #93447 only feed single-line strings, so they pass while the real (title + subtitle) label never localizes.

    What changes do you think we should make in order to solve the problem?

    We should localize the label line by line instead of treating the whole multi-line text as a single candidate, so only the As of: line is rewritten while the title (and its per-line index alignment with the style arrays) is preserved. In getLocalizedVictoryChartLabelText:

    function getLocalizedVictoryChartLabelText(text: string, timezone?: SelectedTimezone): string {
    if (!timezone) {
    return text;
    }
    const match = text.trim().match(AS_OF_LABEL_PATTERN);
    if (!match) {
    return text;
    }
    const utcDate = parseDateAsUTC(match[1]);
    if (!utcDate) {
    return text;
    }
    const localizedDate = DateUtils.formatInTimeZoneWithFallback(utcDate, timezone, CHART_DISPLAY_FORMAT);
    return `As of: ${localizedDate}`;
    }

    function getLocalizedVictoryChartLabelText(text: string, timezone?: SelectedTimezone): string {
        if (!timezone) {
            return text;
        }
    
        return text
            .split('\n')
            .map((line) => {
                const match = line.trim().match(AS_OF_LABEL_PATTERN);
                if (!match) {
                    return line;
                }
    
                const utcDate = parseDateAsUTC(match[1]);
                if (!utcDate) {
                    return line;
                }
    
                return `As of: ${DateUtils.formatInTimeZoneWithFallback(utcDate, timezone, CHART_DISPLAY_FORMAT)}`;
            })
            .join('\n');
    }
    

    The line count is unchanged, so the per-line color/fontSize/fontWeight indices used in VictoryChartLabel keep lining up.

    Alternatively, we can keep operating on the whole string but make the regex multiline and replace in place — add the m flag (/^As of:\s*(.+)$/im) and use text.replace(AS_OF_LABEL_PATTERN, ...) so only the matched line is swapped and the rest of the text is retained. The per-line .map above is cleaner and keeps the existing single-match parsing intact, so I'd lead with that.

    What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?

    Add a multi-line case to localizeVictoryChartLabelText.test.ts (the gap that let this regress), e.g. getLocalizedVictoryChartLabelText('Monthly spend\nAs of: Jun 5, 2026 at 06:47 PM', 'Asia/Tokyo') should return 'Monthly spend\nAs of: Jun 6, 2026 at 3:47 AM', confirming the title line is preserved and only the As of: line is localized.

    What alternative solutions did you explore? (Optional)

    Splitting the title and subtitle into two separate <victorylabel> nodes on the server so each is single-line — but that's a server-side change and the client should be robust to multi-line labels regardless, so the client-side per-line fix is preferable.

  7. melvin-bot commented on Jun 17, 2026

    @melvin-bot

    Triggered auto assignment to Contributor-plus team member for initial proposal review - @daledah (External)

  8. x-dev90 commented on Jun 17, 2026

    @x-dev90
    Contributor

    Proposal

    What is the root cause of that problem?

    The VictoryChart label localization code only parses As of: subtitles in the MMM d, yyyy at h:mm AM/PM format.

    The actual QA recording for this issue shows the generated Concierge chart subtitle as As of: 2026-06-16 00:00. That value is passed to VictoryChartLabel, which calls getLocalizedVictoryChartLabelText() before rendering the Skia text. However, parseDateAsUTC() only tries these two formats:

    • MMM d, yyyy hh:mm aa

    • MMM d, yyyy h:mm aa

    • VictoryChartLabel rewrites the label text at render time:

      function VictoryChartLabel({x, y, text, color, fontSize, fontWeight, fontFamily, fontStyle, lineHeight, textAnchor = 'start', verticalAnchor = 'middle', timezone}: VictoryChartLabelsProps) {
      const typefaces = useChartTypefaces();
      const theme = useTheme();
      const displayText = getLocalizedVictoryChartLabelText(text, timezone);
      const processedLines = displayText.split('\n').reduce(

    • parseDateAsUTC() normalizes and parses only the human-readable formats:

      /** Matches server `EXP_CHAT_COMMENT_DATETIME` (`M j, Y \a\t h:i A`) with and without a leading zero on the hour. */
      const SERVER_AS_OF_PARSE_FORMATS = ['MMM d, yyyy hh:mm aa', 'MMM d, yyyy h:mm aa'] as const;
      /**
      * Parses a Victory chart "As of" datetime label text into a UTC date.
      */
      function parseDateAsUTC(sourceText: string): Date | null {
      const normalizedText = sourceText
      .trim()
      .replace(/\s+at\s+/i, ' ')
      .trim();
      for (const formatStr of SERVER_AS_OF_PARSE_FORMATS) {
      const parsed = parse(normalizedText, formatStr, new Date());
      if (!isValid(parsed)) {
      continue;
      }
      return new Date(Date.UTC(parsed.getFullYear(), parsed.getMonth(), parsed.getDate(), parsed.getHours(), parsed.getMinutes(), parsed.getSeconds()));
      }

    • When parsing fails, the original text is returned unchanged:

      const utcDate = parseDateAsUTC(match[1]);
      if (!utcDate) {
      return text;
      }
      const localizedDate = DateUtils.formatInTimeZoneWithFallback(utcDate, timezone, CHART_DISPLAY_FORMAT);
      return `As of: ${localizedDate}`;

    Because 2026-06-16 00:00 does not match the supported parse formats, the helper returns the original UTC string. So changing the user timezone correctly re-renders the chart label path, but there is no localized value to render.

    What changes do you think we should make in order to solve the problem?

    Extend the existing VictoryChart As of: parser to support the DB-style UTC timestamp format that Concierge actually emits in the failing chart.

    Required changes:

    • Add yyyy-MM-dd HH:mm, yyyy-MM-dd H:mm, yyyy-MM-dd HH:mm:ss, and yyyy-MM-dd H:mm:ss to SERVER_AS_OF_PARSE_FORMATS.
    • Keep the existing UTC reconstruction with Date.UTC(...), so both old human-readable labels and DB-style labels are interpreted as UTC wall-clock values.
    • Add unit coverage for parsing 2026-06-16 00:00.
    • Add unit coverage proving the DB-style subtitle localizes differently for America/Los_Angeles and Asia/Tokyo.

    Tests to add:

    • parseDateAsUTC('2026-06-16 00:00') returns 2026-06-16T00:00:00.000Z.
    • parseDateAsUTC('2026-06-16 00:00:30') preserves seconds.
    • getLocalizedVictoryChartLabelText('As of: 2026-06-16 00:00', 'America/Los_Angeles') returns As of: Jun 15, 2026 at 5:00 PM.
    • getLocalizedVictoryChartLabelText('As of: 2026-06-16 00:00', 'Asia/Tokyo') returns As of: Jun 16, 2026 at 9:00 AM.

    PR #93447 already introduced the right rendering-layer approach: subscribe to the current user timezone and localize victorylabel text at render time. This proposal is not a duplicate because that implementation missed the actual Concierge subtitle format shown in the regression recording. The minimal root-cause fix is to keep the existing architecture and expand the parser to handle the emitted DB-style UTC timestamp.

    What alternative solutions did you explore? (Optional)

  9. changed the title [-]93447 - Concierge - Timezone in VictoryChart not updated to user’s timezone[/-] [+][$250] 93447 - Concierge - Timezone in VictoryChart not updated to user’s timezone[/+] on Jun 17, 2026
  10. melvin-bot commented on Jun 17, 2026

    @melvin-bot
  11. godzillaxbox19982014-lgtm commented on Jun 17, 2026

    @godzillaxbox19982014-lgtm

    Proposal

    Please re-state the problem that we are trying to solve in this issue.

    93447 - Concierge - Timezone in VictoryChart not updated to user’s timezone

    What is the root cause of that problem?

    I traced this to the path that handles VictoryChart:

    What changes do you think we should make in order to solve the problem?

    • Update src/components/HTMLEngineProvider/HTMLRenderers/VictoryChartRenderer/context/VictoryChartContext.tsx:37 to derive VictoryChart from the matched app state path that owns this flow before the value is consumed.
    • Carry the same normalized value through src/components/HTMLEngineProvider/HTMLRenderers/VictoryChartRenderer/context/VictoryChartContext.tsx:20; that follows the safer family move to thread the chart point URL/query/tooltip payload into the rendered bar/segment, so the write/optimistic/read paths agree instead of only changing the visible component.
    • Keep the change inside the Charts, Victory Renderer, Tooltips, Drill-Down Links surface and avoid changing platform-specific hover versus press behavior, saved search URL compatibility.

    What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?

    1. Add or update a regression in tests/**/*Chart*.ts for the exact issue flow: 93447 - Concierge - Timezone in VictoryChart not updated to user’s timezone.
    2. Cover the counter-case near src/components/HTMLEngineProvider/HTMLRenderers/VictoryChartRenderer/context/VictoryChartContext.tsx:37 so valid existing VictoryChart behavior still works.
    3. Manually repeat the issue steps after the patch and confirm the visible state/action is no longer stale.

    What alternative solutions did you explore? (Optional)

    • I would not add a broad new condition outside these referenced paths; the safer fix is to keep VictoryChart consistent at the first read/write boundary shown above.
  12. aswin-s commented on Jun 17, 2026

    @aswin-s
    Contributor

    Please re-state the problem that we are trying to solve in this issue.

    When Concierge renders a VictoryChart with an "As of: [date and time]" subtitle, the displayed time does not match the user's profile timezone — both on initial render and after changing the timezone in Profile settings. The expected behavior is that the subtitle shows the datetime converted to the user's currently selected timezone.

    What is the root cause of that problem?

    In src/components/HTMLEngineProvider/HTMLRenderers/VictoryChartRenderer/utils/localizeVictoryChartLabelText.ts, the function parseDateAsUTC (lines 15–32) is supposed to interpret the server-supplied datetime string as UTC before re-formatting it in the user's profile timezone. It does so in two steps:

    1. It calls parse(normalizedText, formatStr, new Date()) from date-fns, which has no timezone awareness — it treats the numeric fields (hour, minute, etc.) as belonging to the device's local timezone, producing a Date whose internal epoch already reflects the device offset.
    2. It then passes the result's local-time components into Date.UTC(parsed.getFullYear(), parsed.getMonth(), parsed.getDate(), parsed.getHours(), parsed.getMinutes(), parsed.getSeconds()).

    Because parsed.getHours() (and the other getters) return local values, not UTC values, step 2 re-interprets those local components as if they were UTC. This bakes the device's UTC offset into the epoch a second time — the UTC anchor fed into DateUtils.formatInTimeZoneWithFallback is therefore wrong by exactly the device's UTC offset, so the final display value is off by that amount regardless of which user timezone is selected.

    What changes do you think we should make in order to solve the problem?

    1. localizeVictoryChartLabelText.ts — parseDateAsUTC: Replace the two-step parse-then-reconstruct approach with toDate from date-fns-tz, passing {timeZone: 'UTC'} so the numeric fields in the server string are treated as UTC from the start. This avoids the device-local interpretation that date-fns/parse introduces and produces a correct UTC epoch directly.

      import {toDate} from 'date-fns-tz';
      
      function parseDateAsUTC(sourceText: string): Date | null {
          const normalizedText = sourceText
              .trim()
              .replace(/\s+at\s+/i, ' ')
              .trim();
      
          for (const formatStr of SERVER_AS_OF_PARSE_FORMATS) {
              const parsed = toDate(normalizedText, {timeZone: 'UTC'});
      
              if (!isValid(parsed)) {
                  continue;
              }
      
              return parsed;
          }
      
          return null;
      }

      date-fns-tz is already present in the Expensify codebase (used elsewhere for timezone-aware formatting), so no new dependency is required.

    2. localizeVictoryChartLabelText.ts — SERVER_AS_OF_PARSE_FORMATS: The display format constant CHART_DISPLAY_FORMAT uses CONST.DATE.LOCAL_TIME_FORMAT which is 'h:mm a' (single a). The parse formats use 'aa' (double). Align the parse format suffix to 'a' to match the server's h:i A PHP format and the display constant.

    3. VictoryChartCartesian.tsx and VictoryChartPolar.tsx: No change needed — both already pass timezone from useCurrentTimezone() down to VictoryChartLabel, and the key includes timezone to force re-render on timezone change. The fix is entirely in localizeVictoryChartLabelText.ts.

    What alternative solutions did you explore? (Optional)

    An alternative is to keep date-fns/parse but replace the Date.UTC(...) reconstruction with parsed.getTime(). This removes the double-encoding of the device offset, but it does not fully fix the problem: date-fns/parse still interprets the server string in device-local time, so parsed.getTime() is itself device-offset-dependent. On a device set to UTC+0 the result happens to be correct, but on any other device the UTC anchor is still wrong. Using date-fns-tz/toDate with {timeZone: 'UTC'} is the correct approach because it neutralizes the device timezone at parse time rather than at reconstruction time.

  13. 10 remaining items

  14. Abdulloh0109 commented on Jun 17, 2026

    @Abdulloh0109
    Contributor

    What is the root cause of that problem?

    PR #93447 localizes the As of: subtitle at render time, but the localizer never actually rewrites this chart's subtitle. The video shows the subtitle rendering as raw server text — As of: 2026-06-16 00:00 — i.e. an un-localized UTC value in yyyy-MM-dd HH:mm (24-hour) format. There are two independent defects in getLocalizedVictoryChartLabelText, each of which alone is enough to make it a no-op:

    1. The parser doesn't recognize the format the server actually emits (the certain, observed cause).
    parseDateAsUTC only attempts two formats, both 12-hour with a month name and AM/PM:

    const SERVER_AS_OF_PARSE_FORMATS = ['MMM d, yyyy hh:mm aa', 'MMM d, yyyy h:mm aa'] as const;

    The server actually emits 2026-06-16 00:00 (yyyy-MM-dd HH:mm). parse() against MMM d, yyyy [h]h:mm aa returns an Invalid Date, isValid is false for both formats, so parseDateAsUTC returns null:

    for (const formatStr of SERVER_AS_OF_PARSE_FORMATS) {
    const parsed = parse(normalizedText, formatStr, new Date());
    if (!isValid(parsed)) {
    continue;
    }
    return new Date(Date.UTC(parsed.getFullYear(), parsed.getMonth(), parsed.getDate(), parsed.getHours(), parsed.getMinutes(), parsed.getSeconds()));
    }
    return null;

    getLocalizedVictoryChartLabelText then bails and returns the original text unchanged:

    const utcDate = parseDateAsUTC(match[1]);
    if (!utcDate) {
    return text;
    }

    So the subtitle keeps the raw UTC string forever. That's both reported symptoms in one chain: it never matches the user's timezone on first render, and changing the timezone in settings changes nothing because the parse step always fails and the localization branch is never reached. (For reference, a successful localization would render MMM d, yyyy 'at' h:mm a — e.g. Jun 16, 2026 at 12:00 AM — and LOCAL_TIME_FORMAT is 'h:mm a'. The on-screen 2026-06-16 00:00 matches neither the parse format nor the output format, confirming it's untouched server text.)

    2. The match is anchored to the whole string, but title + subtitle are one multi-line label.
    In this chart "Monthly spend" and "As of: …" are a single multi-line <victorylabel> node (line 0 = bold title, line 1 = muted subtitle — the per-line color / fontSize / fontWeight arrays on LabelItem exist exactly for this, and the component renders them after displayText.split('\n')). But the localizer runs on the whole string before that split:

    const displayText = getLocalizedVictoryChartLabelText(text, timezone);
    const processedLines = displayText.split('\n').reduce(

    and the regex is anchored to the start of the entire string with no m flag:

    const match = text.trim().match(AS_OF_LABEL_PATTERN);
    if (!match) {
    return text;
    }

    For "Monthly spend\nAs of: …", ^ resolves to "Monthly spend", so the As of: line (line 1) never matches. Even if the format were fixed, this would still bail out. And the success branch returns `As of: ${localizedDate}` — discarding every other line — so a single-line rewrite would also drop the title:

    Both defects must be fixed for localization to work for a real title/subtitle chart. Reactivity is fine — useCurrentTimezone → useCurrentUserPersonalDetails reads PERSONAL_DETAILS_LIST via useOnyx and the label is re-keyed on timezone, so the component does re-render on a timezone change; there is just nothing to recompute.

    What changes do you think we should make in order to solve the problem?

    Two changes, both in the util layer (localizeVictoryChartLabelText.ts):

    1. Parse the format the server actually sends. Add the real server format(s) to SERVER_AS_OF_PARSE_FORMATS — yyyy-MM-dd HH:mm (and yyyy-MM-dd HH:mm:ss if seconds appear). The existing Date.UTC(...) reconstruction and formatInTimeZoneWithFallback output path are fine once parseDateAsUTC returns a valid date. Confirm against actual Concierge output whether MMM d, yyyy at h:mm AM is ever emitted; if not, the 12-hour formats can be dropped, but keeping both is harmless.

    2. Localize per line, not per whole label. In getLocalizedVictoryChartLabelText, text.split('\n'), run the As of: match + reformat on each line, and join('\n'). Only the matching line is rewritten; the title line (and its line-indexed styles) is preserved. Anchoring with ^…$ is then correct per line, so the m-flag ambiguity disappears. Keep the per-line guards (no timezone / unparseable → return the line unchanged).

    No change needed in VictoryChartLabel / VictoryChartCartesian — they already pass and re-key on timezone. Edge cases touched: standalone As of: labels still localize, the title line is preserved, and offline still works (purely client-side).

    What alternative solutions did you explore? (Optional)

    • Emit a machine-readable timestamp from the server (ISO 8601 with offset, or epoch) in a dedicated <victorylabel> attribute and format it fully client-side. This is structurally the better fix — parsing a human-facing display string back into a Date and guessing its format is exactly what broke here. I'd lean toward this long-term, but it's a server change, so the client-side parse fix above is the immediate one.
    • Only add the m flag to AS_OF_LABEL_PATTERN. Rejected: it fixes detection on multi-line labels but the success branch (#L54) still returns only As of: … and drops the title, and it does nothing about the format mismatch — the parse would still fail on 2026-06-16 00:00.
    • Treat it as a reactivity / memoized-HTML bug. Rejected: useCurrentUserPersonalDetails subscribes to PERSONAL_DETAILS_LIST through useOnyx and the label is re-keyed on timezone; if reactivity were the cause the first render would already be localized, which contradicts the observed raw 2026-06-16 00:00.
  15. KJ21-ENG commented on Jun 17, 2026

    @KJ21-ENG
    Contributor

    Updated my proposal — root cause is the As-of parser rejecting no-year/trailing-PT Concierge chart labels, not multiline label placement.

  16. oqildev commented on Jun 17, 2026

    @oqildev
    Contributor

    Proposal

    What is the root cause of that problem?

    PR #93447 ("Use user timezone") added render-time localization for the chart As of: subtitle, but it parses against a datetime shape the server never sends, so parsing fails on every real label and the subtitle is rendered verbatim.

    The wiring is fine. VictoryChartLabel runs the text through the localizer on every render at VictoryChartLabel.tsx#L30, and the timezone is keyed into the label so a profile-timezone change forces a re-render at VictoryChartCartesian.tsx#L44-L46. So this is not a stale/missing re-render — the localizer just keeps returning the input unchanged.

    The break is in the parser. parseDateAsUTC only accepts a year-bearing, zone-less string via these two formats at localizeVictoryChartLabelText.ts#L9-L10:

    ['MMM d, yyyy hh:mm aa', 'MMM d, yyyy h:mm aa']
    

    The author's own comment on that line says it targets EXP_CHAT_COMMENT_DATETIME (M j, Y \a\t h:i A), i.e. May 6, 2026 at 12:49 PM. But that's the wrong server constant. The string the chart renderer actually emits is at monthly-spend.xml#L2-L3:

    As of: May 6, 12:49 PM PT
    

    No year, no at, and a trailing timezone abbreviation (PT). AS_OF_LABEL_PATTERN (L6) matches and hands parseDateAsUTC the value May 6, 12:49 PM PT. The format expects a 4-digit year right where the string has 12:49, and there's a trailing PT no token consumes — so date-fns/parse returns Invalid Date for both formats, isValid is false, and parseDateAsUTC returns null (L15-L32). On null, the localizer returns the original text untouched (L48-L51).

    That single no-op explains both reported symptoms: the precondition subtitle never matches the viewer's timezone (it's the server's pre-baked PT value), and switching profile timezones re-renders but re-runs the same failing parse, so nothing changes.

    There's a second defect stacked behind the first, even once the format matches: the string is in Pacific (PT), but parseDateAsUTC anchors the wall-clock as UTC via Date.UTC(...) (L28). The PR body states the labels are "emitted by the server as UTC wall-clock text" — that premise is wrong; the server emits a zoned, labeled time. Anchoring 12:49 PM as UTC instead of PT yields an instant off by the PT offset (~7–8h).

    The unit tests are green because they assert against the invented format, not the real one — e.g. parseDateAsUTC('Jun 5, 2026 at 06:47 PM') at localizeVictoryChartLabelText.test.ts#L5-L8. Nothing in the suite feeds a year-less, PT-suffixed string, so the test pass and the production no-op coexist.

    What changes do you think we should make in order to solve the problem?

    Fix layer is the parser util localizeVictoryChartLabelText.ts — the render and timezone plumbing are already correct.

    1. Match the real shape. Parse the year-less, zone-suffixed format the server sends (MMM d, h:mm aa plus a trailing zone token), not MMM d, yyyy .... Capture the trailing zone abbreviation separately, and since the string carries no year, default it to the current year before constructing the instant.
    2. Anchor with the embedded zone, not UTC. Build the absolute instant by interpreting the parsed wall-clock in the captured source zone (PT → America/Los_Angeles) instead of Date.UTC(...), then hand that instant to DateUtils.formatInTimeZoneWithFallback in the viewer's timezone. PT is ambiguous between PDT/PST — resolving it via the zone (not a fixed offset) keeps DST correct.
    3. Decide what the output should show. The original ask in #93443 wanted the zone label displayed; the current CHART_DISPLAY_FORMAT drops it and re-adds a year. Whoever picks this up should confirm with the issue owner whether the localized subtitle keeps a zone label. Minor, but it's a visible product decision baked into the format string.
    4. Test against the real contract. Replace the invented strings in the unit suite with the fixture format (As of: May 6, 12:49 PM PT) and assert it localizes differently for, say, America/Los_Angeles vs Asia/Tokyo. That's the exact gap that let this ship green.

    No offline/optimistic concerns — this is pure client-side render formatting.

    What alternative solutions did you explore? (Optional)

    Make the server emit a machine-readable instant (recommended structural fix, deferred as it's a server change). Have the chart renderer add an unambiguous attribute to the <victorylabel> node (e.g. a UTC ISO timestamp like asof="2026-05-06T19:49:00Z") and have the client format that into the viewer's zone. This removes string parsing entirely and kills three fragilities at once: PT being ambiguous between PDT/PST, month names being locale-dependent, and the guessed-year problem. I'd prefer this long-term, but it's out of this repo and the bounty is an App fix, so I lead with the client parser.

    Multi-line regex fix (/^As of:.../im + per-line map), proposed by others. Rejected: it solves a node shape the server doesn't produce here. The title and the As of: subtitle are separate single-line <victorylabel> nodes — monthly-spend.xml#L2 (title) vs #L3 (As of:). ^As of: already matches the subtitle node fine; the m flag changes nothing because the parse, not the regex, is what fails.

    Double-encoded device offset, proposed by others. Rejected: parse() sets local wall-clock components and Date.UTC() reads those same local getters back, so the device offset cancels — parseDateAsUTC('Jun 5, 2026 at 06:47 PM') returns 2026-06-05T18:47:00.000Z on any device, which is exactly what the PR's own passing test asserts. The fault isn't a wrong offset on a successful parse; it's that the parse never succeeds for the string the server actually sends.

  17. github-actions commented on Jun 17, 2026

    @github-actions
    Contributor

    ⚠️ @oqildev Your proposal is a duplicate of an already existing proposal and has been automatically withdrawn to prevent spam. Please review the existing proposals before submitting a new one.

  18. abbasifaizan70 commented on Jun 17, 2026

    @abbasifaizan70
    Contributor

    🚫 Duplicated proposal withdrawn by 🤖 ProposalPolice.

    Proposal

    Please re-state the problem that we are trying to solve in this issue.

    The "As of: …" subtitle on a Concierge VictoryChart is not shown in the viewer's timezone, and it does not update when the viewer changes their profile timezone and reopens the chat. After PR #93447 it should re-localize on every timezone change.

    What is the root cause of that problem?

    PR #93447 tries to re-localize the subtitle by reverse-parsing the already-rendered display string back into an instant, then reformatting it. That only works if the displayed string exactly matches one assumed format; otherwise the function returns the text untouched, so the subtitle never tracks the viewer timezone.

    The accepted formats are a hard-coded two-item list, both year-bearing with a month name and AM/PM, so anything shaped differently can't match:

    /** Matches server `EXP_CHAT_COMMENT_DATETIME` (`M j, Y \a\t h:i A`) with and without a leading zero on the hour. */
    const SERVER_AS_OF_PARSE_FORMATS = ['MMM d, yyyy hh:mm aa', 'MMM d, yyyy h:mm aa'] as const;

    parseDateAsUTC tries only those formats and, even on success, anchors the wall-clock fields as UTC — so a zone-qualified value (e.g. … PT) would resolve to the wrong instant even if it did parse:

    function parseDateAsUTC(sourceText: string): Date | null {
    const normalizedText = sourceText
    .trim()
    .replace(/\s+at\s+/i, ' ')
    .trim();
    for (const formatStr of SERVER_AS_OF_PARSE_FORMATS) {
    const parsed = parse(normalizedText, formatStr, new Date());
    if (!isValid(parsed)) {
    continue;
    }
    return new Date(Date.UTC(parsed.getFullYear(), parsed.getMonth(), parsed.getDate(), parsed.getHours(), parsed.getMinutes(), parsed.getSeconds()));
    }
    return null;
    }

    When the parse fails it silently falls back to the original text, which is why nothing changes on a timezone switch:

    const utcDate = parseDateAsUTC(match[1]);
    if (!utcDate) {
    return text;
    }
    const localizedDate = DateUtils.formatInTimeZoneWithFallback(utcDate, timezone, CHART_DISPLAY_FORMAT);
    return `As of: ${localizedDate}`;

    But the chart renderer emits the subtitle as a human-readable string with no year and a trailing timezone abbreviation (its own separate node), which neither parse format can match:

    <victorylabel x="32" y="62" text="As of: May 6, 12:49 PM PT" style="{fill: '#73857E', fontSize: 11, fontWeight: 400, fontFamily: 'Expensify Neue'}" />

    The deeper, structural cause is that the absolute instant is never carried to the client in machine-readable form. The parser only reads the display string into text:

    text: unescapeVictoryChartText(parseAttributeAsString(tnode.attributes.text) ?? ''),

    …and the component can only try to re-derive the instant by reverse-parsing that display string on every render:

    const displayText = getLocalizedVictoryChartLabelText(text, timezone);

    Because this subtitle is authored by Concierge from the user's free-form prompt, its shape and its source timezone are not guaranteed — it may be year-less with a PT suffix (the fixture above), or a DB-style 2026-06-16 00:00, etc. No finite list of parse formats can reliably recover the instant, and any format that does parse a zone-qualified value (e.g. … PT) and anchors it as UTC produces the wrong instant. So the problem is not a single missing format string; it is that re-deriving an absolute time from a localized display string is lossy and unreliable.

    What changes do you think we should make in order to solve the problem?

    Carry the instant to the client in an unambiguous, machine-readable attribute and format that in the viewer's timezone, instead of reverse-parsing the human display string. Keep the existing string-parsing path only as a fallback for labels that don't carry the attribute.

    1. Chart renderer: emit the absolute instant as a UTC ISO-8601 attribute on the "As of" <victorylabel> node (alongside the existing human text), e.g. asof="2026-05-06T19:49:00Z". Current node, for reference:

    <victorylabel x="32" y="62" text="As of: May 6, 12:49 PM PT" style="{fill: '#73857E', fontSize: 11, fontWeight: 400, fontFamily: 'Expensify Neue'}" />

    1. LabelItem type — add the optional field next to text. Original:

    /** Absolute instant for an "As of" label (UTC ISO-8601) */
    asOf?: string;
    1. Parser — read the attribute into the label item. Original:

    const labelItem: LabelItem = {
    x: parseAttributeAsNumber(tnode.attributes.x) ?? 0,
    y: parseAttributeAsNumber(tnode.attributes.y) ?? 0,
    text: unescapeVictoryChartText(parseAttributeAsString(tnode.attributes.text) ?? ''),
    color: {},
    fontSize: {},
    fontWeight: {},
    fontFamily: {},
    fontStyle: {},
    lineHeight: parseAttributeAsNumberArray(tnode.attributes.lineheight),
    textAnchor: parseTextAnchor(tnode.attributes.textanchor),
    verticalAnchor: parseTextAnchor(tnode.attributes.verticalanchor),
    };

    asOf: parseAttributeAsString(tnode.attributes.asof),
    1. Localizer — add a helper that formats a known instant directly (no string parsing, no format guessing), reusing the existing display format. Original:

    function getLocalizedVictoryChartLabelText(text: string, timezone?: SelectedTimezone): string {
    if (!timezone) {
    return text;
    }
    const match = text.trim().match(AS_OF_LABEL_PATTERN);
    if (!match) {
    return text;
    }
    const utcDate = parseDateAsUTC(match[1]);
    if (!utcDate) {
    return text;
    }
    const localizedDate = DateUtils.formatInTimeZoneWithFallback(utcDate, timezone, CHART_DISPLAY_FORMAT);
    return `As of: ${localizedDate}`;
    }

    function getLocalizedVictoryChartAsOfText(isoTimestamp: string, fallbackText: string, timezone?: SelectedTimezone): string {
        const instant = new Date(isoTimestamp);
        if (!timezone || Number.isNaN(instant.getTime())) {
            return fallbackText;
        }
        return `As of: ${DateUtils.formatInTimeZoneWithFallback(instant, timezone, CHART_DISPLAY_FORMAT)}`;
    }
    export {getLocalizedVictoryChartLabelText, getLocalizedVictoryChartAsOfText, parseDateAsUTC};
    1. Component — prefer the structured instant, fall back to the legacy string path. Original:

    function VictoryChartLabel({x, y, text, color, fontSize, fontWeight, fontFamily, fontStyle, lineHeight, textAnchor = 'start', verticalAnchor = 'middle', timezone}: VictoryChartLabelsProps) {

    const displayText = getLocalizedVictoryChartLabelText(text, timezone);

    function VictoryChartLabel({x, y, text, asOf, color, fontSize, fontWeight, fontFamily, fontStyle, lineHeight, textAnchor = 'start', verticalAnchor = 'middle', timezone}: VictoryChartLabelsProps) {
    const displayText = asOf ? getLocalizedVictoryChartAsOfText(asOf, text, timezone) : getLocalizedVictoryChartLabelText(text, timezone);

    Why this fixes it: the instant no longer has to be guessed from a localized, AI-authored display string. timezone is already passed into VictoryChartLabel and keyed so the label re-renders on a profile-timezone change; with a real instant in hand, that re-render now produces a correctly localized value every time. Labels without the attribute keep their current behavior, so nothing else regresses.

    Tests to add: getLocalizedVictoryChartAsOfText('2026-05-06T19:49:00Z', 'As of: May 6, 12:49 PM PT', 'America/Los_Angeles') and 'Asia/Tokyo' localize to different values; a missing/invalid asOf returns the original text; and a <victorylabel asof="…"> fixture flows through parseVictoryLabelNode → VictoryChartLabel.

    What alternative solutions did you explore? (Optional)

    • Client-only tolerant parser (the App-scoped stopgap): strip a trailing timezone token, support year-less and DB-style shapes, default the year, and anchor using the embedded zone instead of Date.UTC. This avoids a renderer change but stays brittle — it must keep guessing formats and source zones for text an LLM writes freely, and a zone-qualified value parsed wrong silently mislocalizes. It treats the symptom (missing format) rather than the cause (the instant isn't carried).
    • Per-line localization / multiline regex: irrelevant for the charts in this issue. The fixture shows the title and the "As of" line are separate single-line <victorylabel> nodes, so a multiline fix would not make As of: May 6, 12:49 PM PT parseable.
    • Epoch milliseconds instead of ISO-8601 for the asof attribute: equally unambiguous; ISO-8601 UTC is chosen for readability and because new Date(iso) needs no extra parsing.
  19. github-actions commented on Jun 17, 2026

    @github-actions
    Contributor

    ⚠️ @abbasifaizan70 Your proposal is a duplicate of an already existing proposal and has been automatically withdrawn to prevent spam. Please review the existing proposals before submitting a new one.

  20. abbasifaizan70 commented on Jun 17, 2026

    @abbasifaizan70
    Contributor

    @daledah This isn't a duplicate of the referenced proposal. That proposal's root cause is that the parser uses the wrong date format, and its fix stays entirely within localizeVictoryChartLabelText.ts (keep parsing the display string, but strip the timezone, default the year, and re-anchor). My root cause is different: the absolute instant is never sent to the client in machine-readable form, and because the subtitle is AI-authored free-form text, no finite set of parse formats can ever be reliable — the reverse-parse round-trip itself is the defect. My fix removes string parsing for these labels entirely by carrying a structured asof (UTC ISO-8601) attribute through victoryLabelParser.ts → LabelItem → VictoryChartLabel, files the other proposal never touches. The referenced proposal only names a machine-readable timestamp as a one-line alternative; it doesn't adopt it as the solution or wire it through the parsing pipeline.

  21. sandipanghos commented on Jun 17, 2026

    @sandipanghos

    🚫 Duplicated proposal withdrawn by 🤖 ProposalPolice.

  22. github-actions commented on Jun 17, 2026

    @github-actions
    Contributor

    ⚠️ @sandipanghos Your proposal is a duplicate of an already existing proposal and has been automatically withdrawn to prevent spam. Please review the existing proposals before submitting a new one.

  23. sandipanghos commented on Jun 17, 2026

    @sandipanghos

    Proposal

    What is the root cause of that problem?

    A Victory chart packs its title and the "As of: …" subtitle into one multi-line label, but NewDot's localizer only recognizes "As of:" when it's a single-line, standalone label. So on a real chart the "As of:" line sits on the second line of the title label, the localizer doesn't recognize it, and it returns the text untouched — the viewer's timezone is never applied, and never updates.

    Primary Root Cause — src/components/HTMLEngineProvider/HTMLRenderers/VictoryChartRenderer/utils/localizeVictoryChartLabelText.ts:6 + :43-46 (anchored, non-multiline match against the entire label):

    // :6   anchored to start of the WHOLE string; flags are only `i` (no `m`)
    const AS_OF_LABEL_PATTERN = /^As of:\s*(.+)$/i;
    // :43-46  a title+subtitle label like "Monthly spend\nAs of: …" never matches → returned unchanged
    const match = text.trim().match(AS_OF_LABEL_PATTERN);
    if (!match) { return text; }

    Why it bites: VictoryChartLabel.tsx:30 passes the full label to the localizer before splitting into lines (displayText.split('\n')), and the label text is one attribute (victoryLabelParser.ts:16). So a "title on line 1 / As of: on line 2" label — which is what "subtitle under the chart title" means — fails the ^As of: anchor and is returned verbatim. The date never reaches parseDateAsUTC.

    Secondary Root Cause — same file, :53-54. Even if the match did fire on a multi-line label, the function rebuilds the label from only the "As of" line:

    return `As of: ${localizedDate}`;   // ← drops the title line entirely

    So a naive "just add the m flag" fix would localize the time but erase the chart title. The function assumes the label is "As of"-only.

    Affected Files

    • …/utils/localizeVictoryChartLabelText.ts:6, 43-46, 53-54 — whole-string anchored match + whole-string rebuild; both assume a single-line "As of"-only label.
    • Render path that proves the multi-line shape: …/components/VictoryChartLabel.tsx:30 (localize-then-split('\n')); …/parsers/victoryLabelParser.ts:16 (label text is one attribute).

    Affected Component(s): VictoryChart HTML renderer — "As of" label localization.

    Bug Category: wrong-assumption-about-input-shape (single-line vs multi-line) + regex-anchoring defect.

    Mechanism: Concierge emits <victorylabel text="Monthly spend\nAs of: Jun 5, 2026 at 06:47 PM"> → victoryLabelParser.ts:16 stores it as one text → VictoryChartLabel.tsx:30 calls getLocalizedVictoryChartLabelText(text, timezone) on the full string → /^As of:/i (:6) doesn't match (title is on line 1) → :44-46 returns text unchanged → user sees Concierge's un-localized time, frozen across timezone changes.

    What changes do you think we should make in order to solve the problem?

    Fix Option 1 (Recommended) — localize per line, preserving the rest of the label. localizeVictoryChartLabelText.ts:38-54.

    before: match the WHOLE label against /^As of:/, rebuild as `As of: ${localizedDate}`
    after : split the label into lines, rewrite ONLY the line matching /^As of:/i in place, rejoin with '\n'
            → title stays intact, subtitle gets the viewer's timezone, on any chart type
    

    Why best: directly removes the cause (the subtitle is now recognized wherever it sits in the label) and fixes the title-erasure trap in one change. Contained to one util; no server change needed.

    Fix Option 2 (Alternative) — have Concierge emit the "As of:" subtitle as its own standalone <victorylabel> (separate from the title), so the existing single-line matcher works. Trade-off: needs a Concierge/server change and every old chart in history stays broken; doesn't fix the App's fragility.

    Revert Option: revert the ~2026‑06‑12 localizer. Removes the half-fix but restores the original always-wrong-zone behavior — not ideal.

    Alternate fix (rejected): just add the m (multiline) flag to the regex. Rejected — it would match the second line but :53-54 still rebuilds the label from only the "As of" line, deleting the title. Half-fix that creates a worse bug.

    What alternative solutions did you explore? (Optional)

    • Add only the m flag — matches the line but still erases the title (rejected above).
    • Move the subtitle to its own label on the server — leaves old charts broken and keeps the App brittle.
    • Revert the localizer — restores the original wrong behavior.

    Reminder: Please use plain English, be brief and avoid jargon. Feel free to use images, charts or pseudo-code if necessary. Do not post large multi-line diffs or write walls of text. Do not create PRs unless you have been hired for this job.

  24. github-actions commented on Jun 17, 2026

    @github-actions
    Contributor

    ⚠️ @sandipanghos Thanks for your proposal. Please update it to follow the proposal template, as proposals are only reviewed if they follow that format (note the mandatory sections).

  25. sandipanghos commented on Jun 17, 2026

    @sandipanghos

    Proposal

    [Updated](link to proposal)

  26. luacmartins commented on Jun 19, 2026

    @luacmartins
    Contributor

    This is working as expected. The date format in the OP is incorrect.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

BugDailyExternalHelp Wanted

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions