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

[DOCS ISSUE] Page: dateAndTime #304

Open
ytilis opened this issue Feb 21, 2023 · 0 comments
Open

[DOCS ISSUE] Page: dateAndTime #304

ytilis opened this issue Feb 21, 2023 · 0 comments

Comments

@ytilis
Copy link

ytilis commented Feb 21, 2023

Per the docs here for the date nunjucks filter provided by apostrophe:
https://v3.docs.apostrophecms.org/reference/field-types/dateAndTime.html#use-in-templates

To print them in the format of your choice pass a momentjs/datejs compliant format string to the date Nunjucks filter

The problem is that what's actually being used is dayjs, per the following line:
https://github.com/apostrophecms/apostrophe/blob/4dbfe8e5fc2b470bcee08e8f7cca5f4d925e3a66/modules/%40apostrophecms/template/index.js#L493

This can cause confusion because, aside from the fact that datejs is not actually used anywhere, those libraries don't necessarily have cross-compatible format options. As an example, the docs link directly to the format options for momentjs in the line above, which has had the formatting option X for Unix timestamp since moment v2.0. This is not available in dayjs, which is the actual library used.

I'd suggest removing any mentions of momentjs, since that's only used in the launder dependency now, fixing the incorrect datejs reference to dayjs, and linking to dayjs' formatting docs:
https://day.js.org/docs/en/display/format

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant