PSGSuite icon indicating copy to clipboard operation
PSGSuite copied to clipboard

New-GSCalendarEvent creates all day events (ignoring StartDate and EndDate)

Open Hooch76 opened this issue 11 months ago • 3 comments

Describe the bug The following example ca be found on https://psgsuite.io/Function%20Help/Calendar/New-GSCalendarEvent/#example-1 New-GSCalendarEvent "Go to the gym" -StartDate (Get-Date "21:00:00") -EndDate (Get-Date "22:00:00") This creates an "all day" event instead of an event starting at 21:00 and ending at 22:00.

To Reproduce Steps to reproduce the behavior:

  1. Run the powershell example: New-GSCalendarEvent "Go to the gym" -StartDate (Get-Date "21:00:00") -EndDate (Get-Date "22:00:00")
  2. Examine calendar. It will show an "all day" event:

Image

Expected behavior The event should start and end at the given times. It should not be an all day event.

Screenshots See above at step 2.

Environment (please complete the following information):

  • OS: Windows 11 24H2 (10.0.26100.2894)
  • PowerShell Version: Windows PowerShell 5.1
  • PSGSuite Version: 2.36.4

Additional context Add any other context about the problem here.

Hooch76 avatar Feb 04 '25 12:02 Hooch76

I think we would need clarification on how this is intended to work. The examples state that you should be able to set the time, however the code deals only with the date element, not time.

https://github.com/SCRT-HQ/PSGSuite/blob/main/PSGSuite/Public/Calendar/New-GSCalendarEvent.ps1#L301

I believe the examples are incorrect and shouldn't show the use of the time with -StartDate and -EndDate, instead you should be using either -LocalStartDateTime and -LocalEndDateTime, or -UTCStartDateTime and -UTCEndDateTime depending on your desired outcome.

Buenno avatar Feb 04 '25 13:02 Buenno

I believe the examples are incorrect and shouldn't show the use of the time with -StartDate and -EndDate, instead you should be using either -LocalStartDateTime and -LocalEndDateTime,

Great! It works when using LocalStartDateTime and LocalEndDateTime. I must admit that I haven't even tried those parameters. So it's just the documentation that should be improved. Thanks.

Hooch76 avatar Feb 04 '25 13:02 Hooch76

No problem. I'll discuss the issue with the maintainers as I noticed a number of inconsistencies within this function.

Buenno avatar Feb 04 '25 15:02 Buenno