Skip to content
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

Can't use page.date.toUTCString() in Liquid template #603

Closed
codeinpink opened this issue Jul 9, 2019 · 4 comments
Closed

Can't use page.date.toUTCString() in Liquid template #603

codeinpink opened this issue Jul 9, 2019 · 4 comments
Labels
documentation education: template language Learning about a template language.
Milestone

Comments

@codeinpink
Copy link

Describe the bug
The docs on using dates in templates (https://www.11ty.io/docs/dates/) suggests using {{ page.date.toUTCString() }} to display a UTC time zone date, but when I try to do that it displays function toUTCString() { [native code] } instead of the actual date.

To Reproduce
Steps to reproduce the behavior:

  1. Attempt to use {{ page.date.toUTCString() }} in your template

Expected behavior
It should display the date.

Screenshots

Environment:

  • OS and Version: Ubuntu 16.04.5 LTS
  • Eleventy Version: 0.8.3

Additional context
I'm using the default template engine (liquid) but I've also tried using nunjucks. I also get the same results for toString(). Seems related to #447

@zachleat
Copy link
Member

I was able to reproduce this in Liquid but Nunjucks seems to operate just fine.

@zachleat zachleat added bug and removed needs-triage labels Jul 24, 2019
@zachleat zachleat changed the title Can't use page.date.toUTCString() in template Can't use page.date.toUTCString() in Liquid template Jul 24, 2019
@zachleat
Copy link
Member

Hmm, I’m not sure this is a bug—I don’t think Liquid supports calling functions like this. I will update the documentation to be more accurate—sorry about that!

@zachleat zachleat added documentation education: template language Learning about a template language. and removed bug labels Jul 24, 2019
@zachleat
Copy link
Member

(The accepted method for this in Liquid is to use a custom filter to output the correct string format for the date )

https://www.11ty.io/docs/filters/

zachleat added a commit that referenced this issue Jul 24, 2019
zachleat added a commit to 11ty/11ty-website that referenced this issue Jul 24, 2019
@zachleat
Copy link
Member

Docs updated! https://www.11ty.io/docs/dates/#dates-off-by-one-day

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation education: template language Learning about a template language.
Projects
None yet
Development

No branches or pull requests

2 participants