Skip to content

Commit

Permalink
feat: pass timeZone to date format filter
Browse files Browse the repository at this point in the history
  • Loading branch information
paulrobertlloyd committed Apr 19, 2024
1 parent 16af3b9 commit 4a7a08b
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion packages/endpoint-posts/includes/post-types/published.njk
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<dl class="prose--caption">
<dt class="-!-visually-hidden">{{ __("posts.form.published.label") }}</dt>
<dd><time datetime="{{ property }}">{{ property | date("PPPppp", { locale: opts.locale }) }}</time></dd>
<dd><time datetime="{{ property }}">{{ property | date("PPPppp", { locale: opts.locale, timeZone: application.timeZone }) }}</time></dd>
</dl>
2 changes: 1 addition & 1 deletion packages/endpoint-posts/views/post-form.njk
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
name: "publication-date",
values: fieldData("publication-date").value,
items: [{
label: __("posts.form.published.now") if postStatus !== "published" else fieldData("published").value | date("PPPppp", { locale: opts.locale }),
label: __("posts.form.published.now") if postStatus !== "published" else fieldData("published").value | date("PPPppp", { locale: opts.locale, timeZone: application.timeZone }),
value: "now",
checked: true
}, {
Expand Down
2 changes: 1 addition & 1 deletion packages/frontend/components/card/template.njk
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
{{ badge(item) | indent(6) if item }}
{% endfor %}
<time datetime="{{ opts.published }}">
{{ opts.published | date("PPp", { locale: opts.locale }) }}
{{ opts.published | date("PPp", { locale: opts.locale, timeZone: application.timeZone }) }}
</time>
</footer>
{% endif %}
Expand Down
2 changes: 1 addition & 1 deletion packages/frontend/components/share-preview/template.njk
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@
<output for="{{ opts.url.for }}" data-placeholder="{{ opts.url.placeholder }}">{{ opts.url.value }}</output>
</p>
<p class="share-preview__date">
<time>{{ opts.date | date("PPPppp", { locale: opts.locale }) }}</time>
<time>{{ opts.date | date("PPPppp", { locale: opts.locale, timeZone: application.timeZone }) }}</time>
</p>
</share-preview>
4 changes: 2 additions & 2 deletions packages/post-type-event/includes/post-types/start.njk
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
{%- set endFormat = "PPp" if properties.end | includes("T") else "PP" -%}
{%- set html -%}
{{ icon("event") }}
{{- property | date(startFormat, { locale: opts.locale }) -}}
{{- "" + properties.end | date(endFormat, { locale: opts.locale }) if properties.end -}}
{{- property | date(startFormat, { locale: opts.locale, timeZone: application.timeZone }) -}}
{{- "" + properties.end | date(endFormat, { locale: opts.locale, timeZone: application.timeZone }) if properties.end -}}
{%- endset -%}
{{- prose({
classes: "prose--caption",
Expand Down

0 comments on commit 4a7a08b

Please sign in to comment.