Skip to content

Commit

Permalink
docs: add momentjs examples
Browse files Browse the repository at this point in the history
  • Loading branch information
Zachatoo committed Jan 9, 2024
1 parent a684697 commit 91dd9ee
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
12 changes: 12 additions & 0 deletions docs/documentation.toml
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,18 @@ example = """<% tp.date.weekday("YYYY-MM-DD", 0, tp.file.title, "YYYY-MM-DD") %>
name = "File's title previous Monday"
example = """<% tp.date.weekday("YYYY-MM-DD", -7, tp.file.title, "YYYY-MM-DD") %>"""

[[tp.date.momentjs.examples]]
name = "Date now"
example = """<% moment(tp.file.title, "YYYY-MM-DD").format("YYYY-MM-DD") %>"""

[[tp.date.momentjs.examples]]
name = "Get start of month from note title"
example = """<% moment(tp.file.title, "YYYY-MM-DD").startOf("month").format("YYYY-MM-DD") %>"""

[[tp.date.momentjs.examples]]
name = "Get end of month from note title"
example = """<% moment(tp.file.title, "YYYY-MM-DD").endOf("month").format("YYYY-MM-DD") %>"""


[tp.file]
name = "file"
Expand Down
11 changes: 11 additions & 0 deletions docs/src/internal-functions/internal-modules/date-module.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,17 @@ Templater gives you access to the `moment` object, with all of its functionaliti

More information on moment.js [here](https://momentjs.com/docs/#/displaying/).

{% if tp.date.momentjs.examples %}
##### Examples

```javascript
{% for example in tp.date.momentjs.examples -%}
// {{ example.name}}
{{ example.example }}
{% endfor -%}
```
{% endif %}

## Examples

```javascript
Expand Down

0 comments on commit 91dd9ee

Please sign in to comment.