Title: Unexpected GMTOffset when field contains date only · Issue #558 · nHapiNET/nHapi · GitHub
Open Graph Title: Unexpected GMTOffset when field contains date only · Issue #558 · nHapiNET/nHapi
X Title: Unexpected GMTOffset when field contains date only · Issue #558 · nHapiNET/nHapi
Description: Describe the bug When a TS field (such as PID-7 Date/Time of Birth) contains a date and time without an offset, TSComponentOne.GMTOffset contains the placeholder -99. When a TS field contains a date only, without time or offset, TSCompon...
Open Graph Description: Describe the bug When a TS field (such as PID-7 Date/Time of Birth) contains a date and time without an offset, TSComponentOne.GMTOffset contains the placeholder -99. When a TS field contains a dat...
X Description: Describe the bug When a TS field (such as PID-7 Date/Time of Birth) contains a date and time without an offset, TSComponentOne.GMTOffset contains the placeholder -99. When a TS field contains a dat...
Opengraph URL: https://github.com/nHapiNET/nHapi/issues/558
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Unexpected GMTOffset when field contains date only","articleBody":"**Describe the bug**\r\nWhen a `TS` field (such as `PID-7` Date/Time of Birth) contains a date and time without an offset, TSComponentOne.GMTOffset contains the placeholder -99.\r\n\r\nWhen a `TS` field contains a date only, without time or offset, TSComponentOne.GMTOffset contains the local offset instead of the expected placeholder -99.\r\n\r\n**To Reproduce**\r\n``` cs\r\nforeach (var value in new[] { \"20230603\", \"202306031234\", \"20230603+0800\", \"202306031234+0800\" })\r\n{\r\n var message = new NHapi.Model.V24.Message.ADT_A05();\r\n message.PID.DateTimeOfBirth.TimeOfAnEvent.Value = value;\r\n\r\n Console.WriteLine(message.PID.DateTimeOfBirth.TimeOfAnEvent.GMTOffset);\r\n}\r\n\r\n// expected -99, -99, 800, 800\r\n// actual 800, -99, 800, 800\r\n```\r\n\r\n**Expected behaviour**\r\nWhen a `TS` field contains a date only, without time or offset, TSComponentOne.GMTOffset contains the placeholder -99.\r\n\r\n**Environmental Details (please complete the following information):**\r\n\r\n- OS: Windows 10\r\n- Target Framework: netstandard2.0\r\n- Version: 3.1.1\r\n- HL7 Version: 2.3.1 and 2.4\r\n\r\n**Additional context**\r\nThis appears to be specific behavior in the setter for CommonTS.Value as shown below, which seems really strange. I'd expect the offset to be ignored for a date-only value, since it's only meaningful in the presence of a time.\r\n\r\n``` cs\r\n// if the offset does not exist and a time value does not exist then\r\n// we must provide a default offset = to the local time zone\r\nif (timeVal == null \u0026\u0026 offsetExists == false)\r\n{\r\n var defaultOffset = DataTypeUtil.LocalGMTOffset;\r\n tm = new CommonTM();\r\n tm.Offset = defaultOffset;\r\n} // end if\r\n\r\n// if we have a time value then make a new time object and set it to the\r\n// input time value (as long as the time val has time + offset or just time only)\r\nif (timeVal != null \u0026\u0026 timeValIsOffsetOnly == false)\r\n{\r\n // must make sure that the time component contains both hours and minutes\r\n // at the very least -- must be at least 4chars in length.\r\n if (timeValLessOffset.Length \u003c 4) { ... }}\r\n\r\n tm = new CommonTM();\r\n tm.Value = timeVal;\r\n}\r\n``` ","author":{"url":"https://github.com/stormcrow79","@type":"Person","name":"stormcrow79"},"datePublished":"2024-04-26T08:15:02.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":1},"url":"https://github.com/558/nHapi/issues/558"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:e8b7e6f3-77eb-9e3c-89e3-2e7aa07c39f7 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 9E4E:320964:EA3361:13B1C2B:6A4C61EC |
| html-safe-nonce | bc871ee75cf97cf8681ee0d9025eb57b074c3032c26c27b44459ce27615c89d5 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5RTRFOjMyMDk2NDpFQTMzNjE6MTNCMUMyQjo2QTRDNjFFQyIsInZpc2l0b3JfaWQiOiI4NDU4MTAwMzEwNjM5NjY1NjQ0IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 5414de19f5e7cbe18cbb8039dece648dd7d79eaed8300206dce70816e09d4538 |
| hovercard-subject-tag | issue:2265224916 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/nHapiNET/nHapi/558/issue_layout |
| twitter:image | https://opengraph.githubassets.com/f4d8751b715f014f40a8167adab5d85cc6c0c2fdacadfbb5f3ea1d0aa904360a/nHapiNET/nHapi/issues/558 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/f4d8751b715f014f40a8167adab5d85cc6c0c2fdacadfbb5f3ea1d0aa904360a/nHapiNET/nHapi/issues/558 |
| og:image:alt | Describe the bug When a TS field (such as PID-7 Date/Time of Birth) contains a date and time without an offset, TSComponentOne.GMTOffset contains the placeholder -99. When a TS field contains a dat... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | stormcrow79 |
| hostname | github.com |
| expected-hostname | github.com |
| None | 3d11bb817438277de2a940854450e83a7d32b6aeb5014e9e6b00a6423900251c |
| turbo-cache-control | no-preview |
| go-import | github.com/nHapiNET/nHapi git https://github.com/nHapiNET/nHapi.git |
| octolytics-dimension-user_id | 70870423 |
| octolytics-dimension-user_login | nHapiNET |
| octolytics-dimension-repository_id | 29993598 |
| octolytics-dimension-repository_nwo | nHapiNET/nHapi |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 29993598 |
| octolytics-dimension-repository_network_root_nwo | nHapiNET/nHapi |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 14099438da5379150f15a2892474c7c7e6c0e55e |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width