mirror of
https://github.com/tiennm99/hugoDocs.git
synced 2026-10-14 04:16:13 +00:00
hugolib: Handle unpecified date for IsFuture and IsExpired
This commit is contained in:
1 parent
673e41bf6a
commit
fb0c1350d4
1 file changed
+6
@@ -491,10 +491,16 @@ func (p *Page) IsDraft() bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (p *Page) IsFuture() bool {
|
func (p *Page) IsFuture() bool {
|
||||||
|
if p.PublishDate.IsZero() {
|
||||||
|
return false
|
||||||
|
}
|
||||||
return p.PublishDate.After(time.Now())
|
return p.PublishDate.After(time.Now())
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *Page) IsExpired() bool {
|
func (p *Page) IsExpired() bool {
|
||||||
|
if p.ExpiryDate.IsZero() {
|
||||||
|
return false
|
||||||
|
}
|
||||||
return p.ExpiryDate.Before(time.Now())
|
return p.ExpiryDate.Before(time.Now())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user