[Bug] Cache Expiry and non-US date format

[Bug] Cache Expiry and non-US date format

avatar
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




All Comments (1)

avatar

Issue added here:


github.com/ironmansoftware/powershell-universal

Adam Driscoll

PowerShell Expert and Software Architect at Devolutions