Skip to content

Commit 6bd0081

Browse files
committed
fix(container): normalize build dates to utc
Ensure container image build timestamps are converted from PowerShell DateTime values into UTC ISO 8601 strings before they are returned or stored. This avoids ambiguous unspecified kinds and keeps timer-driven update checks and container management responses consistent.
1 parent cf9fc1d commit 6bd0081

2 files changed

Lines changed: 10 additions & 0 deletions

File tree

Modules/CIPPCore/Public/Entrypoints/Timer Functions/Start-ContainerUpdateCheck.ps1

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,11 @@ function Start-ContainerUpdateCheck {
167167
}
168168
}
169169

170+
if ($RemoteBuildDate -is [datetime]) {
171+
if ($RemoteBuildDate.Kind -eq [System.DateTimeKind]::Unspecified) { $RemoteBuildDate = [DateTime]::SpecifyKind($RemoteBuildDate, [System.DateTimeKind]::Utc) }
172+
$RemoteBuildDate = $RemoteBuildDate.ToUniversalTime().ToString("yyyy-MM-dd'T'HH:mm:ss'Z'")
173+
}
174+
170175
$RunningVersion = $env:APP_VERSION
171176
$UpdateAvailable = $false
172177
if ($RemoteVersion -and $RunningVersion -and $RemoteVersion -ne $RunningVersion) {

Modules/CIPPHTTP/Public/Entrypoints/HTTP Functions/CIPP/Settings/Invoke-ExecContainerManagement.ps1

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,11 @@ function Invoke-ExecContainerManagement {
7979
}
8080
}
8181

82+
if ($created -is [datetime]) {
83+
if ($created.Kind -eq [System.DateTimeKind]::Unspecified) { $created = [DateTime]::SpecifyKind($created, [System.DateTimeKind]::Utc) }
84+
$created = $created.ToUniversalTime().ToString("yyyy-MM-dd'T'HH:mm:ss'Z'")
85+
}
86+
8287
return [pscustomobject]@{
8388
Digest = [string]$digest
8489
Version = [string]$version

0 commit comments

Comments
 (0)