Fix inconsistent CLI output format for GitCommitDate #1246
Merged
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.
The CLI output format for
GitCommitDate
was inconsistent between different output methods, making it difficult to parse dates reliably in scripts and automation.Problem:
nbgv get-version -v GitCommitDate
outputs locale-specific format:08/10/2025 19:10:07 +00:00
nbgv get-version -f json
outputs ISO 8601 format:"GitCommitDate": "2025-08-10T19:10:07+00:00"
This inconsistency made it challenging to write portable automation scripts that needed to parse commit dates, as the format would vary depending on the system locale and output method used.
Solution:
Modified the individual variable output logic in
Program.cs
to formatDateTimeOffset
properties using the ISO 8601 standard ("o" format specifier) to match the JSON output behavior. This ensures all CLI output methods use a consistent, machine-readable date format.After the fix:
nbgv get-version -v GitCommitDate
:2025-08-10T19:10:07.0000000+00:00
(ISO 8601)nbgv get-version -f json
:"GitCommitDate": "2025-08-10T19:10:07+00:00"
(ISO 8601)The change also applies to
GitCommitAuthorDate
and any otherDateTimeOffset
properties, while maintaining full compatibility with all other property types.Fixes #485.
Warning
Firewall rules blocked me from connecting to one or more addresses
I tried to connect to the following addresses, but was blocked by firewall rules:
aka.ms
curl -I -sSL --retry 5 --retry-delay 2 --connect-timeout 15 REDACTED
(dns block)dotnetbuilds.azureedge.net
curl --retry 20 --retry-delay 2 --connect-timeout 15 -sSL -f --create-dirs REDACTED
(dns block)curl -I -sSL --retry 5 --retry-delay 2 --connect-timeout 15 REDACTED
(dns block)If you need me to access, download, or install something from one of these locations, you can either:
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.