hugo

Unnamed repository; edit this file 'description' to name the repository.

git clone git://git.shimmy1996.com/hugo.git
commit fb0c1350d4cc732e553591f093c17b2e50f83b8c
parent 673e41bf6a5a7c84ef780b274a822ff56b26607c
Author: Hanchen Wang <hanchen.wang@mail.utoronto.ca>
Date:   Mon, 13 Jun 2016 11:37:10 -0400

hugolib: Handle unpecified date for IsFuture and IsExpired

Diffstat:
Mhugolib/page.go | 6++++++
1 file changed, 6 insertions(+), 0 deletions(-)
diff --git 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())
 }