mirror of
https://github.com/fleschutz/PowerShell.git
synced 2025-04-03 13:40:35 +02:00
Update the scripts
This commit is contained in:
parent
50ea7be8f1
commit
7b5165e34d
@ -14,12 +14,20 @@
|
|||||||
try {
|
try {
|
||||||
$Now = [DateTime]::Now
|
$Now = [DateTime]::Now
|
||||||
$Christmas = [Datetime]("12/25/" + $Now.Year)
|
$Christmas = [Datetime]("12/25/" + $Now.Year)
|
||||||
if ($Now -lt $Christmas) {
|
$Days = ($Christmas - $Now).Days
|
||||||
$Diff = $Christmas – $Now
|
if ($Days -gt 1) {
|
||||||
& "$PSScriptRoot/give-reply.ps1" "Christmas on December 25 is in $($Diff.Days) days."
|
& "$PSScriptRoot/give-reply.ps1" "Christmas is in $Days days."
|
||||||
|
} elseif ($Days -eq 1) {
|
||||||
|
& "$PSScriptRoot/give-reply.ps1" "Christmas is tomorrow."
|
||||||
|
} elseif ($Days -eq 0) {
|
||||||
|
& "$PSScriptRoot/give-reply.ps1" "Christmas is today."
|
||||||
|
} elseif ($Days -eq 1) {
|
||||||
|
& "$PSScriptRoot/give-reply.ps1" "Christmas is tomorrow."
|
||||||
|
} elseif ($Days -eq -1) {
|
||||||
|
& "$PSScriptRoot/give-reply.ps1" "Christmas was yesterday."
|
||||||
} else {
|
} else {
|
||||||
$Diff = $Now - $Christmas
|
$Days = -$Days
|
||||||
& "$PSScriptRoot/give-reply.ps1" "Christmas on December 25 was $($Diff.Days) days ago."
|
& "$PSScriptRoot/give-reply.ps1" "Christmas was $Days days ago."
|
||||||
}
|
}
|
||||||
exit 0 # success
|
exit 0 # success
|
||||||
} catch {
|
} catch {
|
||||||
|
@ -14,8 +14,12 @@
|
|||||||
try {
|
try {
|
||||||
$Now = [DateTime]::Now
|
$Now = [DateTime]::Now
|
||||||
$NewYear = [Datetime]("12/31/" + $Now.Year)
|
$NewYear = [Datetime]("12/31/" + $Now.Year)
|
||||||
$Diff = $NewYear – $Now
|
$Days = ($NewYear – $Now).Days + 1
|
||||||
& "$PSScriptRoot/give-reply.ps1" "New Year is in $($Diff.Days) days."
|
if ($Days -gt 1) {
|
||||||
|
& "$PSScriptRoot/give-reply.ps1" "New Year is in $Days days."
|
||||||
|
} elseif ($Days -eq 1) {
|
||||||
|
& "$PSScriptRoot/give-reply.ps1" "New Year is tomorrow."
|
||||||
|
}
|
||||||
exit 0 # success
|
exit 0 # success
|
||||||
} catch {
|
} catch {
|
||||||
"⚠️ Error: $($Error[0]) ($($MyInvocation.MyCommand.Name):$($_.InvocationInfo.ScriptLineNumber))"
|
"⚠️ Error: $($Error[0]) ($($MyInvocation.MyCommand.Name):$($_.InvocationInfo.ScriptLineNumber))"
|
||||||
|
Loading…
Reference in New Issue
Block a user