Skip to content

Commit

Permalink
Changed my mind about false from addDateParsing callback. Any falsy…
Browse files Browse the repository at this point in the history
… return will fallback to the previous behavior. #867
  • Loading branch information
zachleat committed Jun 27, 2024
1 parent d81d8a7 commit 97ce2bf
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 5 deletions.
5 changes: 1 addition & 4 deletions src/Template.js
Original file line number Diff line number Diff line change
Expand Up @@ -924,10 +924,7 @@ class Template extends TemplateContent {
dateValue,
);

if (ret === false) {
// Skip out, no date will be assigned to this template!
return false;
} else if (ret) {
if (ret) {
debug("getMappedDate: date value override via `addDateParsing` callback to %o", ret);
dateValue = ret;
}
Expand Down
2 changes: 1 addition & 1 deletion test/EleventyTest-CustomDateParsing.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ test("Custom date parsing callback (return explicit false), Issue #867", async (
elev.disableLogger();

let [result] = await elev.toJSON();
t.deepEqual(result.data.page.date, undefined);
t.deepEqual(result.data.page.date, new Date(Date.UTC(2003,0,1,12)));
});

test("Custom date parsing callbacks (two, last wins, return string), Issue #867", async (t) => {
Expand Down

0 comments on commit 97ce2bf

Please sign in to comment.