Skip to content

Time zone handling to allow fractional hour#787

Merged
poppastring merged 2 commits into
mainfrom
time-zones
Mar 13, 2026
Merged

Time zone handling to allow fractional hour#787
poppastring merged 2 commits into
mainfrom
time-zones

Conversation

@poppastring
Copy link
Copy Markdown
Owner

PR Classification

API change and code enhancement to support fractional time zone offsets.

PR Summary

This pull request updates time zone handling to allow fractional hour offsets and improves configuration flexibility and testability.

  • ISiteConfig.cs, SiteConfig.cs, SiteViewModel.cs: Change DisplayTimeZoneIndex from int to decimal for fractional offsets.
  • TimeZoneProvider.cs: Refactor to use IOptionsMonitor and calculate offsets with hours and minutes.
  • DasBlogSettings.cs: Use ITimeZoneProvider for all time zone calculations and update related methods.
  • DasBlogSettingsMock.cs, DasBlogSettingsTests.cs: Update mocks and unit tests for new time zone logic.
  • TimeZoneIndexViewModel.cs: Expand time zone list to include fractional offsets and descriptive names.

Changed DisplayTimeZoneIndex from int to decimal across config, models, and view models to support fractional UTC offsets. Updated time zone handling in TimeZoneProvider and DasBlogSettings to use NodaTime for accurate conversions. Refactored tests and mocks for new logic. Reformatted config files and updated related classes for consistency.
Switched TimeZoneProvider from IOptions to IOptionsMonitor for dynamic option updates. Updated constructor and GetConfiguredTimeZone method. Replaced OptionsAccessor<T> with OptionsMonitorAccessor<T> in tests to mock IOptionsMonitor<T>. Test logic unchanged, but option accessor infrastructure updated.
@poppastring poppastring merged commit d8f1ff4 into main Mar 13, 2026
3 checks passed
@poppastring poppastring deleted the time-zones branch March 13, 2026 03:50
@poppastring poppastring mentioned this pull request Mar 13, 2026
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