Mike Gerwitz

Activist for User Freedom

aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMike Gerwitz <mtg@gnu.org>2021-02-24 22:06:01 -0500
committerMike Gerwitz <mtg@gnu.org>2021-02-24 22:06:01 -0500
commit825491587fd424a6f70c80751f7cb78a6a28230e (patch)
tree017135f42bd3613efc505dbaf4aeac86a678bd65
parent6ece7769d4927e5603667ec7944f9f8fc9ec0ad8 (diff)
downloadthoughts-825491587fd424a6f70c80751f7cb78a6a28230e.tar.gz
thoughts-825491587fd424a6f70c80751f7cb78a6a28230e.tar.bz2
thoughts-825491587fd424a6f70c80751f7cb78a6a28230e.zip
src/talks.sh: Handle display of future dates
Display future dates as "Will be presented on" rather than "Presented on".
-rwxr-xr-xsrc/talks.sh21
1 files changed, 20 insertions, 1 deletions
diff --git a/src/talks.sh b/src/talks.sh
index 3edbc55..0f12a2e 100755
--- a/src/talks.sh
+++ b/src/talks.sh
@@ -49,6 +49,23 @@ talk-field()
}
+# Produce string to handle past or future dates.
+present-relative()
+{
+ local -r date=${1?Missing date}
+
+ local -i now udate
+ now=$(date +%s)
+ udate=$( date --date="$date" +%s )
+
+ if [ "$now" -lt "$udate" ]; then
+ echo 'Will be presented'
+ else
+ echo Presented
+ fi
+}
+
+
# Generate abstract for talk.
abstract()
{
@@ -72,6 +89,8 @@ abstract()
watch_title="Watch $location Talk"
fi
+ present=$( present-relative "$date" )
+
cat <<EOF
<article class="abstract talk">
<h2 class="title" id="$id">$title</h2>
@@ -87,7 +106,7 @@ abstract()
$abstract_html
- <p class="date">Presented on $date at
+ <p class="date">$present on $date at
<a href="$event_link">$location</a>.</p>
</article>
EOF