Skip to content

Issue 2233: Remove use of native date objects in DB#2235

Merged
rmroot merged 13 commits intodevelopfrom
issue-2233-timezones
Feb 9, 2026
Merged

Issue 2233: Remove use of native date objects in DB#2235
rmroot merged 13 commits intodevelopfrom
issue-2233-timezones

Conversation

@rmroot
Copy link
Copy Markdown
Member

@rmroot rmroot commented Feb 9, 2026

connects #2233

This pull request focuses on improving date handling throughout the analysis and data migration logic. The main changes include standardizing how dates are processed (favoring local time over UTC), updating data migration routines to add explicit month, year, and day fields, and utilizing helper functions for date comparison and predictor data selection. These changes enhance consistency and reliability in date-related calculations and data migrations.

Date Handling Standardization:

  • Replaced usage of getUTCFullYear() and getUTCMonth() with getFullYear() and getMonth() across multiple analysis classes to ensure local time is used for year and month calculations. This affects classes such as AnnualAnalysisSummaryDataClass, MonthlyAccountAnalysisClass, MonthlyAnalysisSummaryClass, and others. [1] [2] [3] [4] [5] [6] [7]

  • Updated filtering and data grouping logic to use helper functions like checkSameMonth for consistent month comparisons, replacing direct property checks. [1] [2] [3] [4] [5]

Data Migration and Enrichment:

  • Enhanced data migration routines to populate and persist month, year, and day fields in predictorData and meterData records if not already set, marking them as migrated. This ensures that all records have explicit date components for future processing. [1] [2]

  • Modified the signature of setPredictorDataV2 to accept an additional boolean parameter, likely to control migration behavior.

Predictor Data Handling Improvements:

  • Changed the way the latest predictor data is determined by using the new getLatestPredictorData helper instead of _.maxBy, and ensured that date extraction uses getDateFromPredictorData for consistency. [1] [2]

  • Updated filtering of predictor data for a given month to use the explicit year and month fields, improving reliability over date string parsing. [1] [2]

Imports and Dependency Updates:

  • Added imports for new helper functions (checkSameMonth, getDateFromPredictorData, getLatestPredictorData) in relevant analysis classes to support the above logic. [1] [2] [3] [4] [5]

These changes collectively improve the robustness and consistency of date-related logic throughout the application.

@rmroot rmroot requested a review from Copilot February 9, 2026 19:38
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

@rmroot rmroot merged commit e18a8d3 into develop Feb 9, 2026
3 checks passed
@rmroot rmroot deleted the issue-2233-timezones branch March 18, 2026 15:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants