-
Notifications
You must be signed in to change notification settings - Fork 16
Description
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