blog post date error

MarieRavn
Tourist
3 0 1

Hi!

I just wrote my first blogpost and just below the title it says: 

 

 

 

 

 

michaelPeterson
Explorer
51 6 37

Hey that error means that in one of your liquid files it is supplying an incorrect format for the date. What theme are you using? If it is a free one I can test it out and see if I can find the error. To just clarify all you did was try to create and share your first blog post?

MarieRavn
Tourist
3 0 1

Yes, that was all I did - I believe!

I'm using the Debut free theme and would love your help checking it, thanks!!

0 Likes
michaelPeterson
Explorer
51 6 37

Hey there so I tried creating a couple blog posts with the Debut theme and wasn't able to recreate the error, the blog post can be seen here https://debut-slide-test.myshopify.com/blogs/news/first-blog-post with that said there are still a couple options. First can you try recreating/publishing the blog post? First I would say try copying and pasting the content of the blog post into a new blog post and try posting that.

 

If that still gives you the error could you try from the Shopify admim click on online store > themes > customize. From there navigate to a blog post like you normally would. When you reach the blog post you should see the options change in the left side menu. In the menu click on posts and uncheck the show date option. Let me know if the blog post will display after unchecking that option. If it does work then I think I know where in the code it is not working. Unfortunately it is difficult to figure out the problem when I can't recreate it myself, but try changing that setting and we can go from there.

MarieRavn
Tourist
3 0 1

So I unchecked the show date and author options and it works, and I actually prefer it without the date so I'm satisfied - thanks!!
If it's not much trouble for you, I might like to know how it's fixed anyway though, if I should want the date again some day. But if it's any trouble this is fine for now :):)

0 Likes
michaelPeterson
Explorer
51 6 37

Yeah for sure no problem. I am still confused as to why your code is having problems with the date. Looking through Shopify's documentation it looks like the format option for creating a date is dependent on your language selected. I think based on the language selected Shopify is passing the wrong timestamp, so that seems like a bigger bug on Shopify's end. Anyways as a short term solution in your blog.liquid and article.liquid files you will find this code:

 

{{ article.published_at | time_tag: format: 'date' }}

Within the article.liquid file you will find it once and in the blog.liquid file you will find it twice. Try replacing it with this code:

 

 

{{ article.published_at | date: "%a, %b %d, %y" }}

This is telling your code to display the article.published_at timestamp into Day Name (Monday, Tuesday, etc.), Month Day, Year. Try that and see if that works. This code is bypassing that format option and just telling it how to display the date. If that does work if you really want to dig down the rabbit hole you can check out this https://ruby-doc.org/core-2.6.4/Time.html#method-i-strftime basically those are all the options you could put in the quotes after the date: line. So for example if you did this:

{{ article.published_at | date: "%a, %b %d, %y, %A" }}

This would add the full day name to the end of the date. You can play around with those different options in that link to format the date exactly how you want it. Let me know if there are any issues getting that working!

 

 

BrentWM
New Member
1 0 1

If anyone else runs into this same issue you can also try adding "date_formats" to your locale file:

"date_formats": {
    "month_day_year": "%B %d, %Y"
}

 

AhmedMihoub
Tourist
6 0 5

 

Hy all,
This problem happens on shopify when you are some translation fields missing, as shown below you should fill the empty fields with the right translation on the target language.
1)to resolve all error message of translations words you should fill all blog fields as shown below

AhmedMihoub_0-1602669890974.png
2)

to resolve all error message of month_day_year you should fill all date format fields as shown below

 

AhmedMihoub_0-1602670091988.png

 

 

YOU SIR!!!!  Are a legend. This problem was nagging me so much and unfortunately, the Shopify help assistant (this time) was useless! But in fairness, they are normally great! 

0 Likes
HenrikTønning
New Member
2 0 0

Hi

We have the same issue on our webshop with a: Liquid error: The format option 'month_day_year' is not a supported format.

But we don't have the "Date formats" section as a option in our theme-translation. We are using the Narrative theme on a danish language setting.

Any ideas on how to fix it? Should we make the changes some other place?

0 Likes