Skip to content

Commit

Permalink
Do not apply site's timezone offset to Date fields (#2258)
Browse files Browse the repository at this point in the history
  • Loading branch information
mrcasual authored Jan 10, 2025
2 parents bd6838b + 66d8603 commit 2aeed8b
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 0 deletions.
5 changes: 5 additions & 0 deletions includes/class-gravityview-merge-tags.php
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,11 @@ private static function modifier_format( $raw_value, $matches, $value, $field, $
}

if ( $field instanceof GF_Field_Date ) {
if ( false === strpos( $modifier, 'no_tz_offset' ) ) {
$modifier = 'no_tz_offset:' . $modifier;
}

// Skip the timezone offset.
return self::format_date( $raw_value, $modifier );
}

Expand Down
5 changes: 5 additions & 0 deletions includes/fields/class-gravityview-field-date.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,11 @@ public function apply_format_date_modifiers( $return, $raw_value = '', $value =
return $return;
}

// Skip the timezone offset.
if ( false === strpos( $modifier, 'no_tz_offset' ) ) {
$modifier = 'no_tz_offset:' . $modifier;
}

$return = GravityView_Merge_Tags::format_date( $raw_value, $modifier );
}

Expand Down
1 change: 1 addition & 0 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ Beautifully display your Gravity Forms entries. Learn more on [gravitykit.com](h
#### 🐛 Fixed
* Fatal error when searching entries by Approval Status in Views joined with another form using the Multiple Forms extension.
* Some merge tag modifiers (e.g., `maxwords`) were not being processed.
* WordPress's timezone offset was not being applied to the Date field's output when using the `:format` merge tag modifier.

#### ✨ Improved
* Entries added via the Gravity Forms API or while GravityView is inactive can now be filtered using the "Unapproved" status on the Entries page.
Expand Down

0 comments on commit 2aeed8b

Please sign in to comment.