mirror of
https://github.com/gohugoio/hugo.git
synced 2024-11-21 20:46:30 -05:00
hugolib: Handle unpecified date for IsFuture and IsExpired
This commit is contained in:
parent
673e41bf6a
commit
fb0c1350d4
1 changed files with 6 additions and 0 deletions
|
@ -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())
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue