Skip to content

Task/hets 1366 pdt - #2249

Open
ionwyn wants to merge 9 commits into
masterfrom
task/HETS-1366-pdt
Open

ionwyn wants to merge 9 commits into
masterfrom
task/HETS-1366-pdt

Conversation

@ionwyn

@ionwyn ionwyn commented Aug 13, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

This PR updates HETS server-side date handling so Pacific business dates and UTC/Pacific conversions continue to use UTC−7 after that change.

Changes

  • Adds a permanent-Pacific rule to DateUtils:
    • for instants/local dates from the 2026-03-08 03:00 Pacific spring-forward onward, conversion uses a fixed UTC−7 offset;
    • dates before the effective date continue through the operating system's America/Vancouver / Windows Pacific timezone rules.
  • Adds DateUtils.GetPacificNow() and replaces server-local/current-time use where HETS needs a Pacific calendar date.
  • Keeps event/audit/other server metadata timestamps in UTC (e,g, server response timestamps).
  • Pins the OpenShift .NET builder to the validated RHEL 8 image registry.redhat.io/rhel8/dotnet-80:8.0.129-1786585358 (amd64 digest sha256:37066d6a49a1eb97958fe2ecef672f8d992c7fc81215b6dca62c0b5ea7a1ad7b).
    • because for some reason :latest is pointing to April 2025 image...???

HETS features affected

Essentially everything that uses dates

  • Fiscal-year and current-business-date decisions for districts, service areas, equipment usage, rotation documents, rental agreements, and equipment processing.
  • District local-area lookup's current-date boundary.
  • Equipment's eligibility calculation.
  • Generated seniority lists, owner verification letters/reports, and mailing-label document/report dates and filenames.
  • Rental-request expected dates, which now derive from the Pacific calendar date and are stored as UTC midnight.

Verification

  • DateUtils test 6 passed, 0 failed.
  • Ran the exact RHEL 8 builder image in OpenShift:
    • rpm -q tzdata → tzdata-2026c-1.el8_10.noarch
    • TZ=America/Vancouver date -d "2026-12-15 12:00:00 UTC" → 05:00 MST (still UTC−7).

What would happen if someone outside Pacific Time visits:

  • browsers and user workstations: client-side local-time display/conversion still relies on each device's OS/browser timezone data;

The builder is intentionally pinned for reproducibility. Future RHEL image updates should be tested for tzdata version and the December-2026 conversion before changing the pinned tag.

Image tkaen

@ionwyn
ionwyn requested a balanced review from Copilot August 13, 2026 17:50
@ionwyn ionwyn self-assigned this Aug 13, 2026
@ionwyn ionwyn added dependencies Pull requests that update a dependency file enhancement .NET Pull requests that update .net code labels Aug 13, 2026

Copilot AI 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.

Pull request overview

Updates date handling for permanent Pacific time while preserving UTC storage semantics.

Changes:

  • Adds permanent UTC−7 conversion logic and tests.
  • Applies Pacific business dates across API, data, and import workflows.
  • Pins the OpenShift .NET 8 build image.

Reviewed changes

Copilot reviewed 19 out of 19 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
Server/HetsImport/Import/ImportUtility.cs Uses UTC audit timestamps.
Server/HetsImport/Import/ImportServiceArea.cs Uses Pacific fiscal dates.
Server/HetsImport/Import/ImportRotationDoc.cs Uses Pacific fiscal dates.
Server/HetsImport/Import/ImportOwner.cs Uses Pacific year in generated keys.
Server/HetsImport/Import/ImportEquipUsage.cs Uses Pacific fiscal dates.
Server/HetsImport/Import/ImportBlock.cs Normalizes imported request timestamps.
Server/HetsData/Repositories/OwnerRepository.cs Uses Pacific report dates.
Server/HetsData/Helpers/RentalAgreementHelper.cs Uses Pacific fiscal-year calculations.
Server/HetsData/Helpers/EquipmentHelper.cs Uses Pacific current year.
Server/HetsCommon/FiscalHelper.cs Calculates fiscal years in Pacific time.
Server/HetsCommon/DateUtils.cs Adds permanent UTC−7 handling and Pacific-now helper.
Server/HetsCommon.Tests/HetsCommon.Tests.csproj Adds the common-library test project.
Server/HetsCommon.Tests/DateUtilsTests.cs Tests permanent Pacific conversions.
Server/HetsApi/Controllers/RentalRequestController.cs Uses Pacific document dates.
Server/HetsApi/Controllers/OwnerController.cs Uses Pacific dates and key years.
Server/HetsApi/Controllers/EquipmentController.cs Uses Pacific fiscal and document dates.
Server/HetsApi/Controllers/DistrictController.cs Uses Pacific local and fiscal dates.
Server/HetsApi.sln Registers the new test project.
openshift/api-build-config.yaml Pins the .NET 8 builder image.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread Server/HetsImport/Import/ImportBlock.cs
Comment thread Server/HetsCommon/DateUtils.cs Outdated

Copilot AI 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.

Pull request overview

Copilot reviewed 19 out of 19 changed files in this pull request and generated no new comments.

Suppressed comments (1)

Server/HetsCommon/DateUtils.cs:66

  • The XML summary now contradicts this branch: after the cutoff, the method returns fixed UTC−7 even when neither system time zone is available, rather than returning UTC. Update the public documentation so callers understand the cutoff and historical fallback behavior.
            if (utcDate >= PermanentPacificTimeEffectiveUtc)

RentalRequestStatusTypeId = (int) statusIdComplete,
ExpectedStartDate = DateTime.Now,
ExpectedEndDate = DateTime.Now,
ExpectedStartDate = DateUtils.AsUTC(DateUtils.GetPacificNow().Date),

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This is a bit odd. Should we use something like this (similar to DistrictController.cs:95):

ExpectedStartDate = DateUtils.ConvertPacificToUtcTime( new DateTime(now.Year, now.Month, now.Day, 0, 0, 0, DateTimeKind.Unspecified));

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

DistrictController isn't the same as this functionally.

  • ExpectedStartDate and ExpectedEndDate are date-only values. Rental-request CRUD endpoints preserve calendar fields with DateUtils.AsUTC. Converting Pacific midnight like that would instead store 07:00Z under permanent UTC−7. It will trigger ExpectedStartDate <= endDtUtc filter which will exclude the record.

  • AsUTC(GetPacificNow().Date) deliberately takes today’s Pacific calendar date and stores it as the established UTC date-only representation, so I think the current code is fine.

@ionwyn
ionwyn force-pushed the task/HETS-1366-pdt branch 3 times, most recently from 306a1df to 5117930 Compare August 24, 2026 16:20
ionwyn added 8 commits August 24, 2026 09:21
Signed-off-by: Ionwyn Sean <ionwynsean@gmail.com>
Signed-off-by: Ionwyn Sean <ionwynsean@gmail.com>
Replace local DateTime.Now/DateTime.UtcNow calls with the new Pacific-aware DateUtils.GetPacificNow() helper across controllers, helpers, and import jobs so fiscal-year, report-date, and key-generation logic stays correct under Permanent Daylight Time.

Signed-off-by: Ionwyn Sean <ionwynsean@gmail.com>

asd

Signed-off-by: Ionwyn Sean <ionwynsean@gmail.com>
Signed-off-by: Ionwyn Sean <ionwynsean@gmail.com>
Signed-off-by: Ionwyn Sean <ionwynsean@gmail.com>
Signed-off-by: Ionwyn Sean <ionwynsean@gmail.com>
@ionwyn
ionwyn force-pushed the task/HETS-1366-pdt branch from 5117930 to e3f853a Compare August 24, 2026 16:21
Signed-off-by: Ionwyn Sean <ionwynsean@gmail.com>

This branch was successfully deployed

3 active deployments
prod — 6a0016e7 Deployed Aug 24, 2026 by ionwyn via deploy-to-prod #243
uat — 6a0016e7 Deployed Aug 24, 2026 by ionwyn via deploy-to-uat #243
test — 6a0016e7 Deployed Aug 24, 2026 by ionwyn via deploy-to-test #243
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies Pull requests that update a dependency file enhancement .NET Pull requests that update .net code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants