From fb0c1350d4cc732e553591f093c17b2e50f83b8c Mon Sep 17 00:00:00 2001 From: Hanchen Wang Date: Mon, 13 Jun 2016 11:37:10 -0400 Subject: [PATCH] hugolib: Handle unpecified date for IsFuture and IsExpired --- hugolib/page.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/hugolib/page.go b/hugolib/page.go index 3fd5309ed..5e3fe1231 100644 --- a/hugolib/page.go +++ b/hugolib/page.go @@ -491,10 +491,16 @@ func (p *Page) IsDraft() bool { } func (p *Page) IsFuture() bool { + if p.PublishDate.IsZero() { + return false + } return p.PublishDate.After(time.Now()) } func (p *Page) IsExpired() bool { + if p.ExpiryDate.IsZero() { + return false + } return p.ExpiryDate.Before(time.Now()) }