Skip to content

Commit 3202fe9

Browse files
fix: pass timeZone to date format filter
1 parent 40de396 commit 3202fe9

File tree

3 files changed

+5
-3
lines changed

3 files changed

+5
-3
lines changed

packages/endpoint-media/lib/utils.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,9 @@ export const renderPath = async (path, properties, application) => {
3737

3838
// Add date tokens
3939
for (const dateToken of dateTokens) {
40-
tokens[dateToken] = formatDate(properties.published, dateToken, locale, {
40+
tokens[dateToken] = formatDate(properties.published, dateToken, {
41+
locale,
4142
timeZone: timeZone === "server" ? serverTimeZone : timeZone,
42-
// @ts-ignore (https://github.com/marnusw/date-fns-tz/issues/239)
4343
useAdditionalDayOfYearTokens: true,
4444
});
4545
}

packages/endpoint-micropub/lib/utils.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,8 @@ export const renderPath = async (path, properties, application) => {
8888

8989
// Add date tokens
9090
for (const dateToken of dateTokens) {
91-
tokens[dateToken] = formatDate(properties.published, dateToken, locale, {
91+
tokens[dateToken] = formatDate(properties.published, dateToken, {
92+
locale,
9293
timeZone: timeZone === "server" ? serverTimeZone : timeZone,
9394
useAdditionalDayOfYearTokens: true,
9495
});

packages/util/lib/date.js

+1
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ export const dateTokens = [
3939
* @param {object} [options] - Options
4040
* @param {string} [options.locale] - Locale
4141
* @param {string} [options.timeZone] - Time zone
42+
* @param {boolean} [options.useAdditionalDayOfYearTokens] - Allows day of year tokens
4243
* @returns {string} Formatted date
4344
*/
4445
export const formatDate = (string, tokens, options = {}) => {

0 commit comments

Comments
 (0)