Luxon 2.x
I plan on using date- and time-stamps in a variety of formats (human-readable, machine-readable) on mrmurphy.com. Earlier, whilst yak shaving, I discovered Luxon, a powerful, modern and friendly wrapper for JavaScript dates and times.
Eleventy uses Luxon for dates and times and importing DateTime from Luxon provides a comprehensive cross-section of DateTime methods.
You can install Luxon via npm on the command line. Open up a new terminal window, cd to your sites directory and install Luxon:npm install luxon
In your .eleventy.js config file, set up Luxon as a const, as follows:
const { DateTime } = require("luxon");
Luxon will now fire into action whenever DateTime is called.
Credit where credit’s due: Thank you to Anthony Killeen and Stephanie Eckles for their notes on Eleventy and Luxon, which helped me find my feet. Muchos gracias!