# File for giving sunrise info
#
# This file is part of REMIND.
# Copyright (C) 1992-2026 by Dianne Skoll

set now now()

banner %
MSG <HEAD>%
MSG <TITLE>Sunrise in [$Location]</TITLE>%
MSG <LINK rel="stylesheet" href="%IMAGEBASE%/calendar.css">%
MSG </HEAD>%

MSG <BODY>
MSG <H1>Sunrise in [$Location]</H1>

set tod sunrise(today())
set tom sunrise(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 Sunrise today [iw] at [tod]; in other words, [hstr][astr][mstr] [fn].<P>
msg Sunrise tomorrow is at [tom][aw]<P>
msg The daylight portion of tomorrow will be [slen] today.<P>
msg </BODY>
