Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

(#15949) Fix regression in Add-History#16005

Merged
daxian-dbw merged 2 commits into
PowerShell:masterPowerShell/PowerShell:masterfrom
vexx32:15949/history-datetime-formatvexx32/PowerShell:15949/history-datetime-formatCopy head branch name to clipboard
Aug 27, 2021
Merged

(#15949) Fix regression in Add-History#16005
daxian-dbw merged 2 commits into
PowerShell:masterPowerShell/PowerShell:masterfrom
vexx32:15949/history-datetime-formatvexx32/PowerShell:15949/history-datetime-formatCopy head branch name to clipboard

Conversation

@vexx32

@vexx32 vexx32 commented Aug 26, 2021

Copy link
Copy Markdown
Collaborator

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
Copy Markdown
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
Copy Markdown
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

ghost commented Dec 16, 2021

Copy link
Copy Markdown

🎉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

Morty Proxy This is a proxified and sanitized view of the page, visit original site.