Title: DateTimeOffset should be treated as a primitive for serialization · Issue #3172 · PowerShell/PowerShell · GitHub
Open Graph Title: DateTimeOffset should be treated as a primitive for serialization · Issue #3172 · PowerShell/PowerShell
X Title: DateTimeOffset should be treated as a primitive for serialization · Issue #3172 · PowerShell/PowerShell
Description: Among the many new types in .NET added to work around problems in the legacy types there is a new System.DateTimeOffset, which is just a System.DateTime plus an Offset (i.e. the original timezone) -- I won't explain why this is useful, b...
Open Graph Description: Among the many new types in .NET added to work around problems in the legacy types there is a new System.DateTimeOffset, which is just a System.DateTime plus an Offset (i.e. the original timezone) ...
X Description: Among the many new types in .NET added to work around problems in the legacy types there is a new System.DateTimeOffset, which is just a System.DateTime plus an Offset (i.e. the original timezone) ...
Opengraph URL: https://github.com/PowerShell/PowerShell/issues/3172
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"DateTimeOffset should be treated as a primitive for serialization","articleBody":"Among the many new types in .NET added to work around problems in the legacy types there is a new `System.DateTimeOffset`, which is just a `System.DateTime` plus an `Offset` (i.e. the original timezone) -- I won't explain why this is useful, but [MSDN does](https://msdn.microsoft.com/en-us/library/system.datetimeoffset#Remarks).\r\n\r\nThis class should _just work_ in PowerShell, just like the original DateTime.\r\n\r\nCurrently it doesn't, because when you pass it over a remote connection it comes out as `Deserialized.DateTimeOffset` and the scripter is forced to manually re-create a DateTimeOffset object.\r\n\r\nSteps to reproduce\r\n------------------\r\n\r\n#### This works great:\r\n\r\n```posh\r\nInvoke-Command { \r\n param([DateTimeOffset]$Time) \r\n $Time.UtcDateTime, $Time.LocalDateTime, $Time.DateTime\r\n} -Args ([DateTimeOffset]::Now)\r\n```\r\n#### But the same command, with a `-ComputerName`, fails, because of remote deserializing...\r\n\r\n```posh\r\nInvoke-Command -ComputerName localhost { \r\n param([DateTimeOffset]$Time) \r\n $Time.UtcDateTime, $Time.LocalDateTime, $Time.DateTime\r\n} -Args ([DateTimeOffset]::Now)\r\n```\r\n\r\nExpected behavior\r\n-----------------\r\n\r\nPassing `DateTimeOffset` should _just work_ even over remote connections.\r\n\r\nActual behavior\r\n---------------\r\n\r\nCannot pass `System.DateTimeOffset` to remote instances. Must re-construct it from `Deserialized.System.DateTimeOffset`\r\n","author":{"url":"https://github.com/Jaykul","@type":"Person","name":"Jaykul"},"datePublished":"2017-02-20T00:42:44Z","url":"https://github.com/PowerShell/PowerShell/issues/3172"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| 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:d5c46c88-f926-ff7d-cdcc-542176598072 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | B284:D036:222C6B:2F5C72:6AFD9F97 |
| html-safe-nonce | 6e3a99df65097c1981989b20fac524466536880c5c1558198f05ca958b3b097e |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCMjg0OkQwMzY6MjIyQzZCOjJGNUM3Mjo2QUZEOUY5NyIsInZpc2l0b3JfaWQiOiI0NzQ5NTE3MDYxMjU4ODQ2MTA0IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | a716868290f1ac703f4056408f4f4b5b107381762389bd2e2c3e7faba39a0a14 |
| hovercard-subject-tag | issue:208760791 |
| 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/PowerShell/PowerShell/3172/issue_layout |
| twitter:image | https://opengraph.githubassets.com/794f92f46ea400d050a735e7314be3173380011da8496d5895e613dd8cf7d9c4/PowerShell/PowerShell/issues/3172 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/794f92f46ea400d050a735e7314be3173380011da8496d5895e613dd8cf7d9c4/PowerShell/PowerShell/issues/3172 |
| og:image:alt | Among the many new types in .NET added to work around problems in the legacy types there is a new System.DateTimeOffset, which is just a System.DateTime plus an Offset (i.e. the original timezone) ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | Jaykul |
| hostname | github.com |
| expected-hostname | github.com |
| None | bc86424ef34a73b386237872800e922d149d65ba907f63d6f150a2dcb8433bea |
| turbo-cache-control | no-preview |
| go-import | github.com/PowerShell/PowerShell git https://github.com/PowerShell/PowerShell.git |
| octolytics-dimension-user_id | 11524380 |
| octolytics-dimension-user_login | PowerShell |
| octolytics-dimension-repository_id | 49609581 |
| octolytics-dimension-repository_nwo | PowerShell/PowerShell |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 49609581 |
| octolytics-dimension-repository_network_root_nwo | PowerShell/PowerShell |
| 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 | 927a6c5ab1c32b38830f1b9d3050c0b9e9aa92e1 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width