Skip to content

Conversation

@vexx32
Copy link
Collaborator

@vexx32 vexx32 commented Aug 26, 2021

PR Summary

Use CurrentCulture when handling conversions to DateTime in Add-History.

PR Context

Fixing a regression in Add-History that was inadvertently introduced in #12495 and made the conversions used by Add-History culture invariant by mistake.

Fixes #15949

PR Checklist

Add-History was not respecting the culture settings and throwing when
given any non-US datetime format.

Fixed by ensuring we use the current culture for the conversion.
@ghost ghost assigned daxian-dbw Aug 26, 2021
@vexx32 vexx32 requested review from daxian-dbw and rjmholt August 26, 2021 16:18
@vexx32 vexx32 force-pushed the 15949/history-datetime-format branch from 62fe083 to 51cc480 Compare August 26, 2021 16:21
}
)

$oldCulture = [cultureinfo]::CurrentCulture
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here and below:

Suggested change
$oldCulture = [cultureinfo]::CurrentCulture
$oldCulture = [CultureInfo]::CurrentCulture

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We seem to have a type accelerator for this, so I'd argue that [cultureinfo] is preferred, like [bool] or [pscustomobject]

@iSazonov iSazonov added the CL-General Indicates that a PR should be marked as a general cmdlet change in the Change Log label Aug 26, 2021
@daxian-dbw daxian-dbw merged commit fde119e into PowerShell:master Aug 27, 2021
@vexx32 vexx32 deleted the 15949/history-datetime-format branch August 27, 2021 04:47
@iSazonov iSazonov added this to the 7.2.0-rc.1 milestone Aug 27, 2021
xtqqczze pushed a commit to xtqqczze/PowerShell-PowerShell that referenced this pull request Sep 2, 2021
@ghost
Copy link

ghost commented Dec 16, 2021

🎉v7.3.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

Backport-7.2.x-Done CL-General Indicates that a PR should be marked as a general cmdlet change in the Change Log

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add-History date behaviour changed from 7.1 to 7.2 - now requires least significant centred format.

5 participants