# File for giving sunset info
#
# This file is part of REMIND.
# Copyright (C) 1992-2025 by Dianne Skoll
# SPDX-License-Identifier: GPL-2.0-only

set now now()

banner %

MSG %
MSG Sunset in [$Location]%
MSG %
MSG %

MSG 
MSG 
Sunset in [$Location]

set tod sunset(today())
set tom sunset(today()+1)

set len1 sunset(today())-sunrise(today())
set len2 sunset(today()+1)-sunrise(today()+1)
set dlen len2-len1
set slen iif(dlen==0, "the same length as", dlen<0, abs(dlen)+plural(abs(dlen)," minute", " minutes")+" shorter than", dlen+plural(dlen, " minute", " minutes")+" longer than")

set diff tod-now
set adiff abs(diff)
set hdiff adiff/60
set mdiff adiff%60

set mstr iif(mdiff==0, "", mdiff == 1, "1 minute", mdiff + " minutes")
set hstr iif(hdiff==0, "", hdiff == 1, "1 hour", hdiff + " hours")
set astr iif(mdiff!=0 && hdiff!=0, " and ", "")
set fn iif(diff==0, "now", diff <0, "ago", "from now")
set iw iif(diff<0, "was", "is")
set aw iif(tod==tom, " as well.", ".")
msg Today is %w, %d %m, %y.<P>
msg The local time in [$Location] is [now].<P>
msg Sunset today [iw] at [tod]; in other words, [hstr][astr][mstr] [fn].<P>
msg Sunset tomorrow is at [tom][aw]<P>
msg The daylight portion of tomorrow will be [slen] today.<P>
msg 
