Kind of solved: I removed a day from the date field and the content is published.
Time here is 2020-10-19 00:50, and I had put date: 2020-10-19 (the date when I create the file, so “today”, as usual). hugo server -F outputs the file but hugo server does not. So I guess the date is considered to be “a date in the future”, why so? Is it a bug?
This sounds like a time zone issue. Try using a full timestamp with time zone offset and see if you still get the same issue. (2020-10-18T16:17:34-07:00)
If it is 2020-10-19 12:00 here, date: 2020-10-19T11:00:00 does not publish the content but date: 2020-10-19T11:00:00+01:00 does.
Shouldn’t Hugo base its date on the environment/OS date instead of T...+/-00:00 ?
It is an overhead (not technically but conceptually) to add a T...+/-XX:XX to each file, and even more so when working with CMS/content editors.
Regarding using the env/os date: I’m not sure that makes it any easier conceptually. The server that runs your Hugo build may be in a time zone different to yours or your audience’s. For example, I edit my site in the US, it’s built and hosted on a machine in Germany, and part of the intended audience is in Spain. The date will tick over at different moments in those three places (maybe Germany and Spain are in the same time zone). IMO, it’s best to specify an unambiguous timestamp for publication, because it’s unclear to me which of those three options is the best default interpretation of the zoneless time.
You can use UTC if you prefer. That’s 2020-10-19T20:30:00Z. I’ve also noticed that the date with no time (2020-10-19) is enough to render a date in a Hugo template, but I don’t know how that would behave when filtering “future” posts.
Ok I agree, it’s better to be specific.
I’ll miss the minimalistic yyyy-mm-dd format but I’ll have to get used to yyyy-mm-ddThh:mm±hh:mm, it’s for a good cause. Life’s harsh sometimes
The problem for me is that when I create a content file between 00:00 and 01:00 (or 02:00 if Daylight Saving Time) with date: yyyy-mm-dd (being the date corresponding to “today”, the date of creation of the file), then the page is not published, I guess because the date is considered to be in the future, because (again I guess) a date with no time is interpreted as UTC (+00:00 or Z), but my OS is UTC+01:00 (or UTC+02:00 if DST). When I specify the timezone with date: yyyy-mm-ddThh:mm+01/02:00 then the page is published.
Technically I have this VSCode snippet that takes care of this now (I don’t use archetypes as I find them less practical/quick to use than a simple VSC snippet):