From a83755fc3247421bfde96781736b6eed89056632 Mon Sep 17 00:00:00 2001 From: Dane Bertram Date: Sat, 11 Apr 2026 09:18:50 -0400 Subject: [PATCH 1/6] Refactor date-range rendering to use macros + and duration calcs to experience section MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - add a reusable Nunjucks date-range component for education and experience entries - renderDateRange covers how we rendered date ranges before - renderDateRangeWithDuration adds calculated duration support - compute human-readable month/year durations in shared date utilities - enhance ongoing roles client-side with animated “and counting” durations - add duration-specific styles and accessibility support for reduced motion - wire the new asset entry and duration filter through Eleventy/Vite - ensure we compute durations consistently (we were mixing UTC/local dates previously) --- _includes/components/date-range.njk | 18 ++++ _includes/layouts/base.njk | 1 + _includes/sections/education.njk | 4 +- _includes/sections/experience.njk | 6 +- assets/scripts/main.js | 123 ++++++++++++++++++++++++++++ assets/styles/_duration.scss | 83 +++++++++++++++++++ assets/styles/_layout.scss | 12 +++ assets/styles/main.scss | 1 + eleventy.config.mjs | 15 +++- package.json | 4 +- src/shared/date.mjs | 102 +++++++++++++++++++++-- 11 files changed, 356 insertions(+), 13 deletions(-) create mode 100644 _includes/components/date-range.njk create mode 100644 assets/scripts/main.js create mode 100644 assets/styles/_duration.scss diff --git a/_includes/components/date-range.njk b/_includes/components/date-range.njk new file mode 100644 index 0000000..9783f24 --- /dev/null +++ b/_includes/components/date-range.njk @@ -0,0 +1,18 @@ +{% macro renderDateRange(start, end, includeDuration=false) %} + +{% endmacro %} + +{% macro renderDateRangeWithDuration(start, end) %} + {{ renderDateRange(start, end, true) }} +{% endmacro %} diff --git a/_includes/layouts/base.njk b/_includes/layouts/base.njk index f1c8cdc..77d91b9 100644 --- a/_includes/layouts/base.njk +++ b/_includes/layouts/base.njk @@ -39,6 +39,7 @@ {{ content | safe }} +