Prerequisites
Steps to reproduce
This repros on any version, trunk or latest release (7.6.2), but it's an old issue.
The test Should not serialize ETS properties added to DateTime here in ConvertTo-Json.Tests.ps1 is broken if it's being run on a system in a timezone >= UTC+1.
This is simply due to the string here being 2021-06-24T15:54:06.796999-07:00. - or 15:54 in UTC-7. However, on a system that has a local time zone of UTC+1 or greater offset, this will be in local time an hour on 2021-06-25T..., like for me 2021-06-25T00:54:06.796999+02:00.
However, the test matches the output with 2021-06-24T* here, which the date in my local time zone isn't - causing the test to fail erroneously. I would suggest as a resolution to either use .ToUniversalTime() and make the test not based on local time or to change the output expectations of the test.
Expected behavior
Actual behavior
[-] Should not serialize ETS properties added to DateTime 2ms
Expected like wildcard '"2021-06-24T*' to match '"2021-06-25T00:54:06.796999+02:00"', but it did not match.
140: $d | ConvertTo-Json -Compress | Should -BeLike '"2021-06-24T*'
at <ScriptBlock>, /home/aurutils/.cache/aurutils/sync/powershell/src/PowerShell/test/powershell/Modules/Microsoft.PowerShell.Utility/ConvertTo-Json.Tests.ps1: line 140
Error details
Environment data
Name Value
---- -----
PSVersion 7.6.2
PSEdition Core
GitCommitId 7.6.2-0-g0d3c290a8737d4252ee75c052d16190ffcdb7d19
OS Arch Linux
Platform Unix
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.4
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
Visuals
No response
Prerequisites
Steps to reproduce
This repros on any version, trunk or latest release (7.6.2), but it's an old issue.
The test
Should not serialize ETS properties added to DateTimehere inConvertTo-Json.Tests.ps1is broken if it's being run on a system in a timezone >= UTC+1.This is simply due to the string here being
2021-06-24T15:54:06.796999-07:00. - or 15:54 in UTC-7. However, on a system that has a local time zone of UTC+1 or greater offset, this will be in local time an hour on2021-06-25T..., like for me2021-06-25T00:54:06.796999+02:00.However, the test matches the output with
2021-06-24T*here, which the date in my local time zone isn't - causing the test to fail erroneously. I would suggest as a resolution to either use.ToUniversalTime()and make the test not based on local time or to change the output expectations of the test.Expected behavior
No error.Actual behavior
Error details
Environment data
Visuals
No response