mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-17 21:01:26 +02:00
hugolib: Handle unpecified date for IsFuture and IsExpired
This commit is contained in:
committed by
Bjørn Erik Pedersen
parent
673e41bf6a
commit
fb0c1350d4
@@ -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())
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user