apostrophecms / apostrophecms/docs

[DOCS ISSUE] Page: dateAndTime

Open
#304 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
6
Forks
18
Avg merge
5d 7h
Merged PRs (30d)
4

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

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.