@robert.tools/eleventy-filter-get-full-date
v1.0.1
Published
Eleventy Filter to get the full date
Downloads
53
Maintainers
Readme
🗂️ Filter: getFullDate
Formats a date range based on the provided start and end dates. It can return the date range in two formats: 'default' and 'block'. If neither start nor end date is provided, it returns an empty string. If an invalid format is specified, it also returns an empty string.
📜 Usage
🟢 Activate the filter
Reference the filter in your eleventy.config.ts file:
// eleventy.config.ts
import getFullDate from '@robert.tools/eleventy-filter-get-full-date';
eleventyConfig.addNunjucksFilter("getFullDate", getFullDate);📝 Sample usage
{{ { start: '2021-01-01', end: '2021-12-31' } | getFullDate() }} {# default format #}
{{ { start: '2021-01-01', end: '2021-12-31' } | getFullDate('block') }} {# block format #}
{{ {} | getFullDate() }} {# returns empty string #}
{{ { start: '2021-01-01', end: '2021-12-31' } | getFullDate('invalid') }} {# returns empty string for invalid format #}⚖️ Notes
This software is hand-crafted, test-driven and assisted by AI tools. I know each line of my code. ✌️
| Tool | Comment | | ------------- | ------------- | | | Test-driven development with Jest | | | Part of the robert.tools ecosystem | | | Code completion | | | chatGPT research |
