hugolib: Handle unpecified date for IsFuture and IsExpired

This commit is contained in:
Hanchen Wang authored and Bjørn Erik Pedersen committed 2016-06-14 15:45:26 +02:00
1 parent 673e41bf6a
commit fb0c1350d4
1 file changed
+6
+6
View File
@@ -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())
}