Skip to content

Conversation

@jamiecarter7
Copy link
Contributor

@jamiecarter7 jamiecarter7 commented Jan 15, 2026

Story card: 17479

Because

There is a bug preventing the % value for the goal line to show as NaN outside of chrome (Safari - and possibly others)
image

This addresses

This fixes that issue, and is working on Chome, Safari, Opera. Unable to test on Firefox.

Safari is strict and returns Invalid Date for non-ISO strings such as 2024-12 or Dec 2024, so getMonth() becomes NaN, (the text bubble then renders “Goal: … NaN%”).
Normalizing the date key before parsing so getMonth() is stable across browsers.

Test instructions

  1. Navigate to branch goal-lines-NaN-safari-bug-fix
  2. add goals-lines flipper flag and enable all
  3. Go to reports.js line 690 and change the line from IN: [] to ->
  4. IN: ["organization", "state", "district", "block", "facility"],
  5. Now head to any dashboard and ensure the goal-line bubble reads with no NaN errors.
  6. Test from org all the way down to facility level.
  7. Check in different browsers, mandatory: Chrome, safari, optional extras: firefox, edge, opera)

 Safari is strict and returns Invalid Date for non-ISO strings such as 2024-12 or Dec 2024, so getMonth() becomes NaN, propagating through the improvement ratio and goal calculation (the text bubble then renders “Goal: … NaN%”).

Because monthIndexFromDateKey feeds relativeImprovementRatio (used in calculateGoal → withGoalLineConfig), an invalid date in Safari makes the goal value NaN. Consider normalizing the date key before parsing (e.g., append -01 to make YYYY-MM-01 or parse with a month map) so getMonth() is stable across browsers.
@jamiecarter7 jamiecarter7 requested a review from a team January 15, 2026 15:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants