diff --git a/PSCalendar.psd1 b/PSCalendar.psd1 index 5767464..1b635e0 100644 --- a/PSCalendar.psd1 +++ b/PSCalendar.psd1 @@ -7,7 +7,7 @@ RootModule = 'PSCalendar.psm1' # Version number of this module. -ModuleVersion = '1.5.1' +ModuleVersion = '1.6' # Supported PSEditions CompatiblePSEditions = @("Desktop","Core") @@ -22,7 +22,7 @@ Author = 'Jeff Hicks' CompanyName = 'JDH Information Technology Solutions, Inc.' # Copyright statement for this module -Copyright = '(c) 2018-19 Jeff Hicks. All rights reserved.' +Copyright = '(c) 2018-19 JDH Information Technology Solutions, Inc. All rights reserved.' # Description of the functionality provided by this module Description = 'A PowerShell module to display a calendar in the console.' @@ -64,7 +64,12 @@ PowerShellVersion = '5.1' # NestedModules = @() # Functions to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no functions to export. -FunctionsToExport = 'Get-Calendar','Show-Calendar','Show-GuiCalendar' + FunctionsToExport= If ($PSedition -eq 'Core') { + 'Get-Calendar', 'Show-Calendar' + } + else { + 'Get-Calendar', 'Show-Calendar', 'Show-GuiCalendar' + } # Cmdlets to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no cmdlets to export. CmdletsToExport = '' @@ -73,7 +78,12 @@ CmdletsToExport = '' VariablesToExport = '' # Aliases to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no aliases to export. -AliasesToExport = 'cal','scal','gcal' + AliasesToExport = if ($PSEdition -eq 'Core') { + 'cal', 'scal' + } + else { + 'cal', 'scal', 'gcal' + } # DSC resources to export from this module # DscResourcesToExport = @() diff --git a/README.md b/README.md index 906c606..1f6e3cc 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,8 @@ # PSCalendar -This module contains a few functions for displaying a calendar in the PowerShell console. The primary function is based on code originally published by Lee Holmes at http://www.leeholmes.com/blog/2008/12/03/showing-calendars-in-your-oof-messages/ +[![PSGallery Version](https://img.shields.io/powershellgallery/v/PSCalendar.png?style=for-the-badge&logo=powershell&label=PowerShell%20Gallery)](https://www.powershellgallery.com/packages/PSCalendar/) [![PSGallery Downloads](https://img.shields.io/powershellgallery/dt/PSCalendar.png?style=for-the-badge&label=Downloads)](https://www.powershellgallery.com/packages/PSCalendar/) + +This module contains a few functions for displaying a calendar in the PowerShell console. The primary function is based on code originally published by Lee Holmes at [http://www.leeholmes.com/blog/2008/12/03/showing-calendars-in-your-oof-messages/](http://www.leeholmes.com/blog/2008/12/03/showing-calendars-in-your-oof-messages/) . You can install this module from the PowerShell Gallery. @@ -55,4 +57,4 @@ PS C:\> Show-GuiCalendar 12/2018 2/2019 -highlight 12/24/18,12/25/18,12/31/18,1/ The calendar form is transparent. But you should be able to click on it to drag it around your screen. You can also use the + and - keys to increase or decrease the calendar's opacity. Be aware that if you close the PowerShell session that launched the calendar, the calendar too will close. This function requires Windows PowerShell. - *last updated 30 January 2019* +_last updated 15 March 2019_ diff --git a/calendar-functions.ps1 b/calendar-functions.ps1 index bde3ee1..3b3ef61 100644 --- a/calendar-functions.ps1 +++ b/calendar-functions.ps1 @@ -69,7 +69,9 @@ Function Get-Calendar { #Convert the highlight dates into real dates #using the .NET Class to parse because this works better for culture-specific datetime strings [DateTime[]]$highlightDates = foreach ($item in $highlightDate) { - [datetime]::parse($item) + #parse datetime using current culture + $cult = Get-Culture + [datetime]::parse($item,$cult) } #Retrieve the DateTimeFormat information so that we can manipulate the calendar $dateTimeFormat = (Get-Culture).DateTimeFormat @@ -117,7 +119,6 @@ Function Get-Calendar { $displayDay = "*" + ("{0,2}" -f $currentDay.Day) + "*" } - #Add in the day of week and day number as note properties. $currentWeek | Add-Member NoteProperty $dayName $displayDay diff --git a/changelog.md b/changelog.md index 1a039a4..ce40700 100644 --- a/changelog.md +++ b/changelog.md @@ -1,5 +1,11 @@ # Change Log for PSCalendar +## v1.6.0 + ++ Fixing date parsing bug for different cultures (Issue #9) ++ Manifest updates to better accommodate PowerShell Core and Windows PowerShell ++ Updated `README.md` + ## v1.5.1 + Modified `Show-Calendar` to use a different highlight color for today.