Future post displaying when it should not`

My Jekyll website is designed to allow for future posts and this has always worked until this week. I do not know if this is related to the new Jekyll updates, @ashmaroli?

I have not modified my code other than updating to the new version of Jekyll 4.3.1.

Here is how the date is formatted (and has always been formatted) in the front matter for my future post:

(front matter stuff like layout, title, etc)
date: 2022-11-01

Today is October 31, 2022 so this post should not display.

However, if I display the site time with:

 site time: {{site.time}}

The result is:

site time: 2022-11-01 01:29:14 +0000

And here is a screenshot from my computer’s clock:
Screenshot 2022-10-31 at 6.31.04 PM

The code I use to prevent displaying future posts looks like this:

{%- assign posts = site.posts 
    | where_exp: 'post', 'post.date <= site.time' 
    | where_exp: 'post', 'post.guest-details != nil'-%}

I am thinking the 4.3.0 update included some changes as documented here:

However, I am unsure as to what I should do to fix my code.

In my mind this feels like a bug because I am using Jekyll to handle dates the way I have for years. However, if I need to change my code, could someone please provide some support?

I need the code to run locally and also recognize the time while running in a GitHub Action.

If it is useful, here is my GitHub repo for the site in question:

And here is the post in question (which when you are reading this might not be a future date):

Note: I do understand that I can be very specific with dates (eg not just typing 2022-11-01), I am using Forestry as a headless CRM and that is the date it puts into the field. I am sure I can add more granularity, but I am concerned about Jekyll not thinking today is really today.


1 Like

Interesting Features developed, Bill, sometimes listen to your podcasts too. It seems like an excellent time.
I subscribe to this topic in case people have a solution for it as I am going to add the future feature post as the same Bill does.

1 Like

Hello @BillRaymond, thanks for bringing this issue to my attention. I haven’t cloned your repo yet, but from what you have described, there definitely is a bug.

The {{ site.time }} result that you have shared above, was it from a build on your local computer or from a build via a cloud-based container such as GitHub Actions (or Forestry?)? If it is the latter, the discrepancy could be between the timezone of the remote container and your local computer and could be normalised by setting a timezone: America/Los_Angeles (or whatever be your desired timezone) declaration in the site’s config file. However, if it was the former case, I am not sure how site.time gets assigned a future time in a certain timezone. Will have to investigate.

If you can reproduce this with a barebones site at around the same time as your local time in this ticket, please file an issue at Jekyll’s GitHub repository mentioning the steps to reproduce. That will be enough ground for me to test objectively and if necessary, revert the commit that made the change.

Hi @ashmaroli, when I tested that post last night, it was around 6:30 pm PT, and I ran the site.time code locally in a Docker container. Nothing about my computer or code has changed for the last two weeks. It is possible that maybe there was a Docker update. However, that would be a huge bug since the code showed the same time after processing through a GitHub action.

I will, however, wait until 6:30 pm PT again today, then run the code locally with the following tests:

  1. Local with Jekyll installed on my machine
  2. Local with Jekyll in a container on my machine (my preferred method)

Note: I already know that the GitHub Action will not work and display the future date because we have proof it did so from the automated build on Monday, showing the Tuesday date.

I will test this with my website and a clean new Jekyll site.


Hi @ashmaroli I was not able to test last night as planned, so performed the tests again today. Good news and bad news I guess. Maybe not bad for Jekyll? I’m not sure?

I ran the following tests with the same results whether using Jekyll 3.9.2 and Jekyll 4.3.1:

  1. Make note of the local date and time, which was around Wednesday, November 2, 2022:

  2. Run Jekyll locally on the computer and include site.time: {{site.time}} on the page. As you can see this information is correct:

  3. Run the same code locally on the computer but this time in a Docker container. Note that I did not specify a date/time in Docker the app or the dockerfile. As you can see, the {{site.time}} is Thursday, November 3, 2022 and not the same time.

  4. Run date in the Docker container’s terminal:

  5. Run date in a local (non-docker) terminal:

I guess this comes down to my never having pushed code up at a late hour for the future post to display on GitHub. That said, I feel like I did do that before with different results.

It does seem to me this is a Docker issue though and not a good one at that since future posts are building when they should not.

Do you have any thoughts on how to address this issue and also is there anything I can do in Jekyll (assuming not) to avoid this in say the _config.yml file?

Thanks again

Have you tried setting the timezone configuration in _config.yml that @ashmaroli mentioned? Docs: Configuration Options | Jekyll • Simple, blog-aware, static sites

1 Like

No, but I will test that this evening and see what I get for a result. I forgot to include that last night as I had a long day and forgot :slight_smile:

One useful timezone to test with is Pacific/Kiritimati (UTC+14), where it is often already tomorrow (relative to the Americas).