Skip to content

Commit

Permalink
update timezone description
Browse files Browse the repository at this point in the history
  • Loading branch information
Yuliya Pazniak committed Jan 21, 2025
1 parent da9b7f7 commit 74e56af
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
4 changes: 3 additions & 1 deletion datapress/using-twig/separate_columns_in_twig.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,4 +105,6 @@ The format of displaying decimal and float columns depends on the settings of yo
{% set record=entities.contact["dad5909a-973c-ef11-a316-000d3ad268c1"] %}
{{ record | formatted_value("cr1d1_decimal")}}<br>
{{ record.cr1d1_decimal }}
```
```

An example output: **50,002.25**.
6 changes: 3 additions & 3 deletions datapress/using-twig/twig_introduction.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,8 @@ The following object members are available:
- `reference` -- *(EntityReference)* reference to the bound record.
- `record` -- *(Entity)* bound record object.
- `wp_user` -- *(WP_User)* information about the current WordPress user.
- `timezone`-- Overrides the date using the current user's timezone.
- `locale` -- Overrides the date using the current user's locale.
- `timezone`-- Returns the timezone for the current user. The timezone should not be null and typically returns as a string. Example output: **America/New_York**, **UTC**. The format "Asia/Tokyo" is known as an [**IANA time zone name**](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones). The exact format depends on how the timezone is stored and managed in your WordPress setup. If you need to convert or manipulate this value further, you can use additional Twig filters or functions as needed.
- `locale` -- Return locale for the current user. Example output: **en_GB**

Notice that `user.record` is more expensive performance-wise -- it retrieves data from Dataverse. `user.reference` only
reads the local database and request parameters to calculate the entity reference.
Expand All @@ -116,7 +116,7 @@ reads the local database and request parameters to calculate the entity referenc
{% endif %}
```

Example of a date override with explicit timezone and locale:
An example of date display with explicit time zone and locale:

```twig
{{ "now"|format_datetime('short', 'short', locale: user.locale, timezone: user.timezone) }}
Expand Down

0 comments on commit 74e56af

Please sign in to comment.