hugolib: Handle unpecified date for IsFuture and IsExpired

This commit is contained in:
Hanchen Wang 2016-06-13 11:37:10 -04:00 committed by Bjørn Erik Pedersen
parent 673e41bf6a
commit fb0c1350d4

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())
}