Repository navigation
Conversation
Reading Year, Month, Day or another part of a TSComponentOne builds the cached CommonTS detail, and the Value getter then returned the detail's value. CommonTS adds the local GMT offset to a value that has none, so "20100101" became "20100101-0500" and GetAsDate() then threw. Value now always returns the stored value. The Offset setter and the SetDatePrecision, SetDateMinutePrecision and SetDateSecondPrecision methods write the detail's result back to it, so they still update the value as before. Adds DtmPartsTest26: three of its cases fail on master.
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Complexity | 4 |
NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Fixes #917.
Problem
Reading
.Year,.Month,.Dayor any other part of aDTM(or anyTSComponentOne) changes its.Valuewhen the value has no time zone. The first read builds the cachedCommonTSdetail, and from then on theValuegetter returned the detail's value instead of the stored one.CommonTSadds the local GMT offset to a value that has none, so:Fix
TSComponentOne.Valuenow always returns the stored value, so reading a part never changes it. The methods that do change the detail write its result back to the stored value: theOffsetsetter,SetDatePrecision,SetDateMinutePrecisionandSetDateSecondPrecision. They updateValueexactly as before. SettingValuestill updates the cached detail, so the parts follow a new value.Tests
New
DtmPartsTest26, using the issue's ADT^A05 / PID-7 example:Valueunchanged for a date, a date-time, a date-time with seconds, and a value that already has an offset.GetAsDate()still return the right values.Valueafter reading the parts updates them.Value.Three of these fail on master. The full
NHapi.NUnitsuite passes on net8.0 (971 passed, 2 skipped) with the container set to UTC, America/New_York and Asia/Kolkata. No new StyleCop warnings.This touches the same file as #915 (
GetAsDateformats) but different lines, and the two merge cleanly.