Skip to content

Commit

Permalink
updated month autocompleter to be better culture aware
Browse files Browse the repository at this point in the history
  • Loading branch information
jdhitsolutions committed Sep 28, 2018
1 parent 04cbfaf commit bc757d8
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion PSCalendar.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ Register-ArgumentCompleter -CommandName Get-Calendar, Show-Calendar -ParameterNa
param($commandName, $parameterName, $wordToComplete, $commandAst, $fakeBoundParameter)

#get month names, filtering out blanks
(Get-Culture).DateTimeFormat.MonthNames | Where-object {$_ -match "\w+" -and $_ -match "$WordToComplete"} |
#(Get-Culture).DateTimeFormat.MonthNames
$Culture = ([system.threading.thread]::currentThread).CurrentCulture
[cultureinfo]::GetCultureInfo($culture).DateTimeFormat.Monthnames | Where-object {$_ -match "\w+" -and $_ -match "$WordToComplete"} |
ForEach-Object {
[System.Management.Automation.CompletionResult]::new($_.Trim(), $_.Trim(), 'ParameterValue', $_)
}
Expand Down

0 comments on commit bc757d8

Please sign in to comment.