Invalid Date
Description/Summary
It’s possible that someone is using an existing Org file to export to Hugo. Some exporters like ox-texinfo recognize dates of style YEAR1-YEAR2 to use them in Copyright headers. But that date is invalid as per the standard date format used by Hugo in date front-matter, and also as per org-parse-time-string. So in that case, don’t allow org-parse-time-string to throw an error and abort the export, but instead simply don’t set the date in the front-matter.
Content
It’s possible that someone is using an existing Org file to export to
Hugo. Some exporters like ox-texinfo recognize dates of style
YEAR1-YEAR2 to use them in Copyright headers.
But that date is invalid as per the standard date format used by Hugo
in date front-matter, and also as per org-parse-time-string.
So in that case, don’t allow org-parse-time-string to throw an error
and abort the export, but instead simply don’t set the date in the
front-matter.
In this post the :EXPORT_DATE: property is set to 2012-2017, but
the export will still happen fine, with the date front-matter not
set.
Page (Debug)
| Page Variable | Value | |
|---|---|---|
| Name | "Invalid Date" | |
| Title | "Invalid Date" | |
| ResourceType | "page" | |
| Kind | "page" | |
| Section | "posts" | |
| Draft | false | |
| Type | "posts" | |
| Layout | "" | |
| Permalink | "https://ox-hugo.scripter.co/test/posts/invalid-date/" | |
| RelPermalink | "/posts/invalid-date/" | |
| Data |
| |
| NextPage | Inlined SVG | |
| PrevPage | Invalid Nocites | |
| NextInSection | Inlined SVG | |
| PrevInSection | Invalid Nocites |
Page Params (Debug)
| Key | Type | Value |
|---|---|---|
| draft | bool | false |
| iscjklanguage | bool | false |
| lastmod | time.Time | 2018-01-23 14:19:10 -0500 -0500 |
| tags | []string | "dates" "date" "invalid" |
| title | string | "Invalid Date" |
File Object (Debug)
| FileInfo Variable | Value |
|---|---|
| UniqueID | "cd4a1c1940a776978bf41c3a76d02af2" |
| BaseFileName | "invalid-date" |
| TranslationBaseName | "invalid-date" |
| Lang | "en" |
| Section | "posts" |
| LogicalName | "invalid-date.md" |
| Dir | "posts/" |
| Ext | "md" |
| Path | "posts/invalid-date.md" |