Skip to content

Commit

Permalink
Update The Documentation To List Some Useful Information About The Di…
Browse files Browse the repository at this point in the history
…splay Filter
  • Loading branch information
vthg2themax committed Jun 8, 2024
1 parent f1d3d88 commit a76db44
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions docs/en/docs/syntax/filters.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,35 @@ Example:
## Built-In Filters

Built-In filters can be found in [`sailfish::runtime::filter`](https://docs.rs/sailfish/latest/sailfish/runtime/filter/index.html) module.

## Useful Filters

You can also use the Display filter to do things like format a date, or a UUID.

- Easily Display A Date

=== "Template"

```
<span><%= chrono::NaiveDate::from_ymd_opt(2015, 9, 5).unwrap().and_hms_opt(23, 56, 4).unwrap().format("around %l %p on %b %-d") | disp %></span>
```

=== "Result"

```
<span>around 11 PM on Sep 5</span>
```

- Easily Display A UUID

=== "Template"

```
<span><%= uuid::Uuid::new_v4().urn() | disp %></span>
```

=== "Result"

```
<span>urn:uuid:c3602585-a9a1-43f5-b0e6-8bc05d5444dd</span>
```

0 comments on commit a76db44

Please sign in to comment.