[Bug] Cache Expiry and non-US date format

[Bug] Cache Expiry and non-US date format

avatar
(anonymous user)
Product: PowerShell Universal
Version: 5.5.1


I can’t get a valid but non-US formatted date into the -AbsoluteExpiration parameter of Set-PSUCache

It reports invalid date format. I’m fairly sure that this is when day > 12

# Current date 30/04/2025 (Day > 12)
$Date = (Get-Date).AddHours(2)
$Date
$Date.GetType() | Select FullName
Set-PSUCache -Key Test -Value Test -AbsoluteExpiration $Date -Persist

# Calculated date 02/05/2025 (Day < 12)
$Date = (Get-Date).AddDays(2)
$Date
$Date.GetType() | Select FullName
Set-PSUCache -Key Test -Value Test -AbsoluteExpiration $Date -Persist




ee7f5a49dd0674b0c404b1e4d89a7608fef94929

ee7f5a49dd0674b0c404b1e4d89a7608fef94929.png

All Comments (1)

avatar

Adam Driscoll
PowerShell Expert and Developer at Devolutions