Add clock cli flag

Close #8787
This commit is contained in:
satotake
2022-04-27 02:57:04 +09:00
committed by Bjørn Erik Pedersen
parent f2946da9e8
commit e77ca3c105
26 changed files with 193 additions and 37 deletions

View File

@@ -13,7 +13,11 @@
package resource
import "time"
import (
"time"
"github.com/gohugoio/hugo/common/htime"
)
var _ Dated = Dates{}
@@ -55,7 +59,8 @@ func IsFuture(d Dated) bool {
if d.PublishDate().IsZero() {
return false
}
return d.PublishDate().After(time.Now())
return d.PublishDate().After(htime.Now())
}
// IsExpired returns whether the argument is expired.
@@ -63,7 +68,7 @@ func IsExpired(d Dated) bool {
if d.ExpiryDate().IsZero() {
return false
}
return d.ExpiryDate().Before(time.Now())
return d.ExpiryDate().Before(htime.Now())
}
// IsZeroDates returns true if all of the dates are zero.