Skip to content

RE1-T117 Trying to fix timezone conversion issues on dhi containers#407

Merged
ucswift merged 2 commits into
masterfrom
develop
Jun 11, 2026
Merged

RE1-T117 Trying to fix timezone conversion issues on dhi containers#407
ucswift merged 2 commits into
masterfrom
develop

Conversation

@ucswift

@ucswift ucswift commented Jun 11, 2026

Copy link
Copy Markdown
Member

Summary by CodeRabbit

  • Refactor
    • Improved timezone handling across the system—call management, workflow timestamps, and email-based call imports—to provide more consistent, reliable local times and UTC offsets for users.

@request-info

request-info Bot commented Jun 11, 2026

Copy link
Copy Markdown

Thanks for opening this, but we'd appreciate a little more information. Could you update it with more details?

@coderabbitai

coderabbitai Bot commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 0adc9bb3-b40e-4016-82e7-1e7f7aec9aa3

📥 Commits

Reviewing files that changed from the base of the PR and between f4eb67e and 8ec4424.

📒 Files selected for processing (1)
  • Core/Resgrid.Services/CallEmailTemplates/ParklandCounty2Template.cs
🚧 Files skipped from review as they are similar to previous changes (1)
  • Core/Resgrid.Services/CallEmailTemplates/ParklandCounty2Template.cs

📝 Walkthrough

Walkthrough

This PR refactors timezone handling to use NodaTime and IANA timezone identifiers (resolved via TZConvert). Core conversion and offset logic moved to NodaTime; dependent services (email template and workflow context builder) were updated to use the new helpers and tzdb-based conversions.

Changes

Timezone Conversion Refactoring

Layer / File(s) Summary
TimeConverterHelper core refactoring
Core/Resgrid.Model/Helpers/TimeConverterHelper.cs
TimeConverter and GetOffsetForDepartment switch from TimeZoneInfo offset and conversion APIs to NodaTime Instant and Tzdb timezone providers, resolving Windows timezone IDs to IANA via TZConvert.
ParklandCounty2Template email import update
Core/Resgrid.Services/CallEmailTemplates/ParklandCounty2Template.cs
Adds NodaTime and TimeZoneConverter dependencies and refactors email-to-call import logic to convert call timestamps using IANA timezone resolution and NodaTime LocalDateTime conversion via InZoneLeniently.
WorkflowTemplateContextBuilder local time update
Core/Resgrid.Services/WorkflowTemplateContextBuilder.cs
Imports Resgrid.Framework and refactors department-local time computation to use DateTimeHelpers.GetLocalDateTime with IANA timezone IDs instead of TimeZoneInfo.ConvertTimeFromUtc.

🎯 4 (Complex) | ⏱️ ~45 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title directly addresses the main change: migrating timezone conversion logic from TimeZoneInfo to NodaTime/TZConvert to fix timezone issues on DHI containers.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch develop

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
Core/Resgrid.Model/Helpers/TimeConverterHelper.cs (1)

69-69: ⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Inconsistent ConvertTimeZoneString usage across methods.

TimeConverter (line 31) and GetOffsetForDepartment (line 113) both call DateTimeHelpers.ConvertTimeZoneString(timeZone) before passing to TZConvert.WindowsToIana, but TimeConverterToString here passes timeZone directly. If ConvertTimeZoneString normalizes non-standard timezone IDs, this inconsistency could cause different conversion behavior between methods.

🔧 Proposed fix for consistency
-				var ianaTz = TZConvert.WindowsToIana(timeZone);
+				var ianaTz = TZConvert.WindowsToIana(DateTimeHelpers.ConvertTimeZoneString(timeZone));
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@Core/Resgrid.Model/Helpers/TimeConverterHelper.cs` at line 69, The
TimeConverterToString method is inconsistent: unlike TimeConverter and
GetOffsetForDepartment it calls TZConvert.WindowsToIana(timeZone) directly;
change TimeConverterToString to first normalize the input by calling
DateTimeHelpers.ConvertTimeZoneString(timeZone) and pass that result into
TZConvert.WindowsToIana so all three methods use the same normalized timezone
string (reference methods: TimeConverter, GetOffsetForDepartment,
TimeConverterToString).
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@Core/Resgrid.Services/CallEmailTemplates/ParklandCounty2Template.cs`:
- Around line 56-61: Add a null/empty check and fallback before converting the
department timezone: if department.TimeZone is null or whitespace, use the same
default used by TimeConverterHelper (e.g., "Pacific Standard Time") before
calling TZConvert.WindowsToIana; update the block around
TZConvert.WindowsToIana(department.TimeZone) / LocalDateTime.FromDateTime(...) /
.InZoneLeniently(DateTimeZoneProviders.Tzdb[...]) so you pass a non-null, valid
Windows zone id to TZConvert.WindowsToIana and avoid InvalidTimeZoneException
and unintended UTC fallback for callTimeUtc.

---

Outside diff comments:
In `@Core/Resgrid.Model/Helpers/TimeConverterHelper.cs`:
- Line 69: The TimeConverterToString method is inconsistent: unlike
TimeConverter and GetOffsetForDepartment it calls
TZConvert.WindowsToIana(timeZone) directly; change TimeConverterToString to
first normalize the input by calling
DateTimeHelpers.ConvertTimeZoneString(timeZone) and pass that result into
TZConvert.WindowsToIana so all three methods use the same normalized timezone
string (reference methods: TimeConverter, GetOffsetForDepartment,
TimeConverterToString).
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 449279e1-dc60-445d-95d1-a9edd20bab77

📥 Commits

Reviewing files that changed from the base of the PR and between b94da09 and f4eb67e.

📒 Files selected for processing (3)
  • Core/Resgrid.Model/Helpers/TimeConverterHelper.cs
  • Core/Resgrid.Services/CallEmailTemplates/ParklandCounty2Template.cs
  • Core/Resgrid.Services/WorkflowTemplateContextBuilder.cs

Comment thread Core/Resgrid.Services/CallEmailTemplates/ParklandCounty2Template.cs
@ucswift

ucswift commented Jun 11, 2026

Copy link
Copy Markdown
Member Author

Approve

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This PR is approved.

@ucswift ucswift merged commit 674eae9 into master Jun 11, 2026
18 of 19 checks passed
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.

1 participant