From 9c5f358483b1a5ffefac9ff4cf0e0953bfc94401 Mon Sep 17 00:00:00 2001 From: Dirk Heilig Date: Mon, 19 Feb 2024 21:14:18 +0100 Subject: [PATCH] highlight today'S calendar item! --- themes/hugo-theme-flat/static/css/style.css | 4 ++++ themes/hugo-theme-flat/static/js/calendar.js | 11 ++++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/themes/hugo-theme-flat/static/css/style.css b/themes/hugo-theme-flat/static/css/style.css index 814248d..2d170ad 100644 --- a/themes/hugo-theme-flat/static/css/style.css +++ b/themes/hugo-theme-flat/static/css/style.css @@ -228,6 +228,10 @@ a.external:after { cursor: pointer; } +#calendar .today{ + color: var(--color-dark-fg-font-hyper-hover); +} + /********** set up break point **********/ .main-wrapper, diff --git a/themes/hugo-theme-flat/static/js/calendar.js b/themes/hugo-theme-flat/static/js/calendar.js index 3edc9e8..74eac7e 100644 --- a/themes/hugo-theme-flat/static/js/calendar.js +++ b/themes/hugo-theme-flat/static/js/calendar.js @@ -24,7 +24,16 @@ const calRefresh=function () { let li = $("
  • "); //li.text(item.summary) let startDate = new Date(item.start * 1000); - let date = $(""); + + //check if the date is within today, not tomorrow, not yesterday + let today = new Date(); + let todayString = today.getFullYear() + "-" + zeropad(today.getMonth() + 1) + "-" + zeropad(today.getDate()); + let startDateString = startDate.getFullYear() + "-" + zeropad(startDate.getMonth() + 1) + "-" + zeropad(startDate.getDate()); + let todayClass="" + if (todayString === startDateString) todayClass=" today"; + + + let date = $(""); date.text( zeropad(startDate.getDate()) + "." +