aboutsummaryrefslogtreecommitdiffhomepage
path: root/hugolib/site.go
diff options
context:
space:
mode:
authorsatotake <[email protected]>2022-04-27 02:57:04 +0900
committerBjørn Erik Pedersen <[email protected]>2022-05-08 16:56:26 +0200
commite77ca3c105bd64c5077d823d2127f6f812a4f681 (patch)
treeebbe9c310bfab1e34f9fd2e36b738fd2a37d6f11 /hugolib/site.go
parentf2946da9e806c2bafbdd26707fe339db79bd980b (diff)
downloadhugo-e77ca3c105bd64c5077d823d2127f6f812a4f681.tar.gz
hugo-e77ca3c105bd64c5077d823d2127f6f812a4f681.zip
Add `clock` cli flag
Close #8787
Diffstat (limited to 'hugolib/site.go')
-rw-r--r--hugolib/site.go6
1 files changed, 4 insertions, 2 deletions
diff --git a/hugolib/site.go b/hugolib/site.go
index cf7f0ff82..cbfc4d836 100644
--- a/hugolib/site.go
+++ b/hugolib/site.go
@@ -30,6 +30,7 @@ import (
"strings"
"time"
+ "github.com/gohugoio/hugo/common/htime"
"github.com/gohugoio/hugo/common/hugio"
"github.com/gohugoio/hugo/common/types"
"github.com/gohugoio/hugo/modules"
@@ -1910,10 +1911,11 @@ func shouldBuild(buildFuture bool, buildExpired bool, buildDrafts bool, Draft bo
if !(buildDrafts || !Draft) {
return false
}
- if !buildFuture && !publishDate.IsZero() && publishDate.After(time.Now()) {
+ hnow := htime.Now()
+ if !buildFuture && !publishDate.IsZero() && publishDate.After(hnow) {
return false
}
- if !buildExpired && !expiryDate.IsZero() && expiryDate.Before(time.Now()) {
+ if !buildExpired && !expiryDate.IsZero() && expiryDate.Before(hnow) {
return false
}
return true