Skip to content

Commit

Permalink
Test for date only value before attempting setTimezone (CFM-509) (#379)
Browse files Browse the repository at this point in the history
  • Loading branch information
arlen authored Mar 30, 2026
1 parent 02d9929 commit 4135f09
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions app/src/View/Helper/FieldHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -349,10 +349,12 @@ public function dateField(string $fieldName,

// Get the existing values, if present
if($date_object !== null) {
// Adjust the time back to the user's timezone
$tz = $this->getView()->get('vv_tz');
if($tz) {
$date_object = $date_object->setTimezone($tz);
if($date_object instanceof \Cake\I18n\DateTime) {
// Adjust the time back to the user's timezone
$tz = $this->getView()->get('vv_tz');
if($tz) {
$date_object = $date_object->setTimezone($tz);
}
}
$coptions['value'] = $date_object->i18nFormat($dateFormat);
$pickerDate = $date_object->i18nFormat($dateFormat);
Expand Down

0 comments on commit 4135f09

Please sign in to comment.