Skip to content

Test for date only value before attempting setTimezone (CFM-509) #379

Merged
merged 1 commit into from
Mar 30, 2026
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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