Repository: gohugoio/hugo (language: go)

Issue:
hugo list future/expired ignores clock flag
### What version of Hugo are you using (`hugo version`)?

<pre>
$ hugo version
hugo v0.121.2-6d5b44305eaa9d0a157946492a6f319da38de154+extended darwin/arm64 BuildDate=2024-01-05T12:21:15Z VendorInfo=brew
</pre>

### Does this issue reproduce with the latest release?
Yes

---
When running `hugo list future` the ``--clock`` option is ignored.

For example, I have the following page:
```
---
title: "A few Hugo Shortcodes"
date: 2024-01-22T00:00:00
---
bla bla
```

This is the output of `hugo list future` as right now:
```
% hugo list future                                       
path,slug,title,date,expiryDate,publishDate,draft,permalink
content/posts/2024-01-22 Hugo Shortcodes/index.md,,A few Hugo Shortcodes,2024-01-22T00:00:00+01:00,0001-01-01T00:00:00Z,2024-01-22T00:00:00+01:00,false,https://oli.fyi/2024/a-few-hugo-shortcodes/
```

And this is the output if I try to set the clock for later:
```
% hugo list future --clock "2024-01-25T00:00:00.00+01:00"
path,slug,title,date,expiryDate,publishDate,draft,permalink
content/posts/2024-01-22 Hugo Shortcodes/index.md,,A few Hugo Shortcodes,2024-01-22T00:00:00+01:00,0001-01-01T00:00:00Z,2024-01-22T00:00:00+01:00,false,https://oli.fyi/2024/a-few-hugo-shortcodes/
``` 
I would expect this to not be a future page anymore, having set the clock on the 25th. It does work, and it will build it after the 22nd, but the future command is not working.


Discussion / hints:
Same issue with expired content.
This is regression introduced in v0.112.0, related to the [fix](https://github.com/gohugoio/hugo/commit/e6dc8053bfb94063268fa56404ff076208dc6dc2) for https://github.com/gohugoio/hugo/issues/10972.

Fix patch:
diff --git a/commands/list.go b/commands/list.go
index 41a45e40223..8debe5ca5f7 100644
--- a/commands/list.go
+++ b/commands/list.go
@@ -23,7 +23,6 @@ import (
 	"time"
 
 	"github.com/bep/simplecobra"
-	"github.com/gohugoio/hugo/config"
 	"github.com/gohugoio/hugo/hugolib"
 	"github.com/gohugoio/hugo/resources/page"
 	"github.com/gohugoio/hugo/resources/resource"
@@ -46,7 +45,7 @@ func newListCommand() *listCommand {
 
 	list := func(cd *simplecobra.Commandeer, r *rootCommand, shouldInclude func(page.Page) bool, opts ...any) error {
 		bcfg := hugolib.BuildCfg{SkipRender: true}
-		cfg := config.New()
+		cfg := flagsToCfg(cd, nil)
 		for i := 0; i < len(opts); i += 2 {
 			cfg.Set(opts[i].(string), opts[i+1])
 		}


Test patch:
diff --git a/testscripts/commands/list.txt b/testscripts/commands/list.txt
index 42d74cec750..8cbf93266bf 100644
--- a/testscripts/commands/list.txt
+++ b/testscripts/commands/list.txt
@@ -28,6 +28,9 @@ stdout 'expired.md'
 stdout 'draftexpired.md'
 stdout 'draftfuture.md'
 
+hugo list expired --clock 2000-01-01T00:00:00Z
+! stdout 'expired.md'
+
 -- hugo.toml --
 baseURL = "https://example.org/"
 disableKinds = ["taxonomy", "term"]