Skip to content

Change to use pwsh to have consistent JSON conversion for DateTime #11126

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 26, 2019

Conversation

daxian-dbw
Copy link
Member

@daxian-dbw daxian-dbw commented Nov 19, 2019

PR Summary

ConvertTo-Json has different behavior when it comes to DateTime type in Windows PowerShell and PowerShell Core

## pwsh
PS:6> $dateTime = [datetime]::UtcNow
PS:7> $dateTime = [datetime]::new($dateTime.Ticks - ($dateTime.Ticks % [timespan]::TicksPerSecond), $dateTime.Kind)
PS:8> @{ datetime = $dateTime } | ConvertTo-Json
{
  "datetime": "2019-11-19T22:32:50Z"
}
## powershell.exe
PS:11> $dateTime = [datetime]::UtcNow
PS:12> $dateTime = [datetime]::new($dateTime.Ticks - ($dateTime.Ticks % [timespan]::TicksPerSecond), $dateTime.Kind)
PS:13> @{ datetime = $dateTime } | ConvertTo-Json
{
    "datetime":  "\/Date(1574202819000)\/"
}

tools/releaseBuild/setReleaseTag.ps1 uses the DateTime as a property for the JSON file. Change the ymal file to use pwsh instead of powershell to get consistent behavior.

PR Context

PR Checklist

@daxian-dbw daxian-dbw added the CL-BuildPackaging Indicates that a PR should be marked as a build or packaging change in the Change Log label Nov 19, 2019
@daxian-dbw daxian-dbw assigned daxian-dbw and unassigned TravisEz13 Nov 26, 2019
@daxian-dbw daxian-dbw added this to the 7.0.0-rc.1 milestone Nov 26, 2019
@daxian-dbw
Copy link
Member Author

This is a simple change that make the build use pwsh instead of powershell.exe. I will just merge it.

@ghost
Copy link

ghost commented Mar 26, 2020

🎉v7.1.0-preview.1 has been released which incorporates this pull request.:tada:

Handy links:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CL-BuildPackaging Indicates that a PR should be marked as a build or packaging change in the Change Log
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants