Skip to content

Conversation

@ericpohl
Copy link
Contributor

Fix timestamp comparison issues when Product Allocations have timezone-aware timestamps by ensuring all comparisons happen in UTC.

  • SpatialRecordMapper -
    • Rewrite GovernsTimestamp method to properly convert both allocation and spatial record timestamps to UTC before comparison
    • Combine similar logic from Offset and ToUtc methods into a single ToUtc method
    • Remove use of DateTime.ToUniversalTime method, which for local timestamps uses the timezone of the context that the code is running on, and as such can produce different results in different environments.
  • XmlExtensions -
    • When parsing DateTime objects from XML, if the string contains a timezone offset, construct the datetime as UTC instead of Local
  • TaskDataMapper and TimeLogMapper
    • Tighten up timezone offset calculations
    • Round timezone offsets to the nearest minute, as required when creating DateTimeOffset objects.

@kelly-nelson
Copy link
Contributor

Changes look good to me. I ran a few tests and didn't find any regressions. @strhea @dwalgren Please review advise of concerns.

@strhea
Copy link
Contributor

strhea commented Dec 17, 2025

@kelly-nelson It looks good to me.

@kelly-nelson kelly-nelson merged commit d30887f into ADAPT:develop Jan 8, 2026
1 check passed
kelly-nelson added a commit that referenced this pull request Jan 8, 2026
* Handle null representation code when examining workingdatas

* Keep valuable operation information from device when possible

* Two fixes for reading CNH Pro1200 Harvest data:
- Stop forcing CategoryEnum.Variety to OperationTypeEnum.SowingAndPlanting (could be Harvesting)
- In GetOperationTypeFromLoggingDevices, prefer a non-Unknown operation type

* Construct DateTime objects with Local DateTimeKind (#259)

* Construct DateTime objects with Local DateTimeKind

* Consolidate "first day of 1980" fields

---------

Co-authored-by: Eric Pohl <eric.pohl@corteva.com>

* Only add boundary with spatial data (#261)

* Adding FieldBoundary description from polygon designator if present

* only add partfield boundary polygon if spartial data is present

* Multiple partfield boundaries (#260)

* Adding FieldBoundary description from polygon designator if present

* Handle multiple boundaries for fields using the active or first boundary

* Fix ProductAllocation timestamp comparison issues (#263)

* Construct DateTime objects with Local DateTimeKind

* Consolidate "first day of 1980" fields

* More messing with timezones

* Cleanup

---------

Co-authored-by: Eric Pohl <eric.pohl@corteva.com>

---------

Co-authored-by: Eric Pohl <eric.pohl@corteva.com>
Co-authored-by: Stuart Rhea <stuart.rhea@live.com>
Co-authored-by: Andrew Vardeman <andrew.vardeman.dev@gmail.com>
Co-authored-by: Eric Pohl <31418444+ericpohl@users.noreply.github.com>
Co-authored-by: Kenneth Lausdahl <lausdahl@users.noreply.github.com>
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.

3 participants