beautifulhugo icon indicating copy to clipboard operation
beautifulhugo copied to clipboard

[Question] How to change dateFormat

Open yamila-moreno opened this issue 5 years ago • 4 comments

Hi!

as I have my blog in spanish (DefaultContentLanguage = "es"), I'd like to have the dates translated; i've seen the dateFormat param, but no matter which changes I make, it doesn't work; could you give me a hint?

I've tried with:

dateFormat = "2 de Enero de 2006" dateFormat = "21/10/2006"

thanks in advance for your time,

yamila-moreno avatar Oct 11 '19 15:10 yamila-moreno

Hi @yamila-moreno

You may need to try any of these format, I don't think / is valid for date formats. Please check this and let me know. Even I am interested to know about Spanish formats (because I am adding Spanish contents in my blog for cross language), I don't know Spanish :)

Cheers

ibnunowshad avatar Nov 29 '19 13:11 ibnunowshad

Maybe it could be useful... If you want to translate the days, you need to create a file in /data I link here the doc.

gio-remo avatar Aug 08 '20 08:08 gio-remo

You can get some more infos here: https://gohugo.io/functions/format/

iootaa avatar Aug 21 '20 21:08 iootaa

In language "es" the es.yaml is actually not working. The format string "2 de enero, 2006" is not correctly parsed so dates are wrongly formatted in es. You can try replacing "02/01/2006" in the string format in es.yaml to get the dates in the slash format. It is not so nice but works.

kakila avatar Mar 22 '22 21:03 kakila