Skip to content

Commit c622faf

Browse files
author
Peter Bengtsson
authored
effectiveDate might be falsy (#23002)
Part of #1185
1 parent 68e64f2 commit c622faf

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

middleware/render-page.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,10 @@ export default async function renderPage(req, res, next) {
3434

3535
// Updating the Last-Modified header for substantive changes on a page for engineering
3636
// Docs Engineering Issue #945
37-
if (context.page.effectiveDate !== '') {
37+
if (context.page.effectiveDate) {
38+
// Note that if a page has an invalidate `effectiveDate` string value,
39+
// it would be caught prior to this usage and ultimately lead to
40+
// 500 error.
3841
res.setHeader('Last-Modified', new Date(context.page.effectiveDate).toUTCString())
3942
}
4043

0 commit comments

Comments
 (0)