From c8ae7edc0751c0f0ed0c14b61d7713735e67d579 Mon Sep 17 00:00:00 2001 From: Azure SDK Bot <53356347+azure-sdk@users.noreply.github.com> Date: Fri, 2 Feb 2024 10:41:08 -0800 Subject: [PATCH] Sync eng/common directory with azure-sdk-tools for PR 7615 (#22335) * Prepare-Release.ps1: Make dateTime.ToString("MM/dd/yyyy") to work on exotic set-ups On my machine, I experimented with the registry, and the worst part is that I don't remember/know how to reset it back. The work items that script produces, do have datetimes for the upcoming releases in the `MM-dd-yyyy` format, and then I have to correct them by hand. `dateTime.ToString("MM/dd/yyyy")` does produce the date in the format of `MM-dd-yyyy` on my machine. This also happens if I write a corresponding .NET app. The fix that I am proposing makes it work on my specific setup and hopefully breaks no one else. I understand if you are hesitant to take it. Let me know, I'll see how I can restore my setting. But on the other hand, I don't think it makes anything worse, it only makes things more robust, so maybe take it? * Use [CultureInfo]::InvarialtCulture Co-authored-by: Wes Haggard * Update eng/common/scripts/Prepare-Release.ps1 * Update eng/common/scripts/Prepare-Release.ps1 --------- Co-authored-by: Anton Kolesnyk <41349689+antkmsft@users.noreply.github.com> Co-authored-by: Wes Haggard --- eng/common/scripts/Prepare-Release.ps1 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/eng/common/scripts/Prepare-Release.ps1 b/eng/common/scripts/Prepare-Release.ps1 index e3c18af350e0..269fd113fd69 100644 --- a/eng/common/scripts/Prepare-Release.ps1 +++ b/eng/common/scripts/Prepare-Release.ps1 @@ -109,7 +109,8 @@ else $ParsedReleaseDate = [datetime]$ReleaseDate } -$releaseDateString = $ParsedReleaseDate.ToString("MM/dd/yyyy") +# Use InvariantCulture so that the date format is consistent on all machines +$releaseDateString = $ParsedReleaseDate.ToString("MM/dd/yyyy", [CultureInfo]::InvariantCulture) $month = $ParsedReleaseDate.ToString("MMMM") Write-Host "Assuming release is in $month with release date $releaseDateString" -ForegroundColor Green