-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use HUGO 0.87's date formatting feature with time.Format #555
Use HUGO 0.87's date formatting feature with time.Format #555
Conversation
Kudos, SonarCloud Quality Gate passed!
|
Hi @Saxodwarf , the same Do you think these occurrences should be changed too? |
Hi @RoneoOrg, I believe the I saw the use of For the sake of coherence, we could edit |
Hi @Saxodwarf
You're right, I scanned the whole repo in its current version!
As Thanks for your reference of the RFC, enlightening! |
This is cool, but doesn't work as expected on non-English sites. How I solved the problem:
|
Hello @JoCat I think the issue here might have something to do with the date formatting layout. Combined with the I'm far from being an expert in the arcane of internationalization, so I might be missing something, but I tested both your solution and the one I proposed, and they gave me the same result with both the language parameter set to french (my mother tongue) and to Russian. Without the I guess we would need more people to try it out themselves, maybe with different languages, but as far as I'm concerned, I'm good with either your solution or mine. |
Hello @Saxodwarf Yes, it works correctly, by the way, I did so initially, when I tested )) Initially, I used the same option that you suggested, but it seemed to me that it does not correspond to what is already there (in the screenshot below, I did not know that the previous format is also supported, and not only the new one). And so i offered the second option as another example of a solution to the problem.
I'm still using what I have now and I'm waiting for the PR to be accepted and add it to the release)) |
Kudos, SonarCloud Quality Gate passed!
|
Hi all, |
Tested it with my multilingual site and works perfect! @adityatelange can this be merged? |
@Saxodwarf @nielsbrakel Does this have backwards compatibility? Would this change work with Hugo 0.83 or do we need to update the min Hugo version also? It would be nice if anyone could test this.. |
@adityatelange This is a new feature since 0.87 so I suspect it is not backwards compatible. I would suggest raising the min supported version in the next major release. |
@adityatelange Yes. Although the internationalized date format feature is new in 0.87, the date.time function is not. If we keep the current, non-internationalized default, as I did in the PR, the change should be backward-compatible, and those of us who want to use the new feature can just put a |
What does this PR change? What problem does it solve?
In the
post_meta.html
partial file, use.Date | time.Format
instead of.Date.Format
to format the date, to take advantage of HUGO's new localized date formatting feature when formatting the date in the meta informations.This time.Format's behaviour was included in HUGO 0.87, as described in the documentation.
Was the change discussed in an issue or in the Discussions before?
No
PR Checklist