Skip to content

Commit 8dd0966

Browse files
committed
Revert changes from #2931 to fix PS6 conversion problem
1 parent 4e3841b commit 8dd0966

1 file changed

Lines changed: 10 additions & 4 deletions

File tree

lib/core.ps1

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -594,11 +594,17 @@ function show_app($app, $bucket, $version) {
594594
}
595595

596596
function last_scoop_update() {
597-
try {
598-
return [System.DateTime]::Parse((scoop config lastupdate))
599-
} catch {
600-
return $null
597+
# PowerShell 6 returns an DateTime Object
598+
$last_update = (scoop config lastupdate)
599+
600+
if ($null -ne $last_update -and $last_update.GetType() -eq [System.String]) {
601+
try {
602+
$last_update = [System.DateTime]::Parse($last_update)
603+
} catch {
604+
$last_update = $null
605+
}
601606
}
607+
return $last_update
602608
}
603609

604610
function is_scoop_outdated() {

0 commit comments

Comments
 (0)