Skip to content

Commit

Permalink
Fix empty date field error on event
Browse files Browse the repository at this point in the history
  • Loading branch information
occupant committed Nov 3, 2022
1 parent abc4a89 commit e525e2a
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion kraken.theme
Original file line number Diff line number Diff line change
Expand Up @@ -451,7 +451,8 @@ function kraken_preprocess_node(&$variables)
$node = $variables['node'];
$node_type = $node->getType();

if ( ($node_type == 'ubc_event') ) {
if ( (($node_type == 'ubc_event') && ($node->hasField('field_event_date') && !$node->get('field_event_date')->isEmpty() ))) {

$timezone = date_default_timezone_get();
$formatter = \Drupal::service('date.formatter');
$date = $node->get('field_event_date')->getValue();
Expand Down

0 comments on commit e525e2a

Please sign in to comment.