1

I D8 installed the module Optional End Date in order to add an optional end date within a date field.

When I had a single date field value I could get the value by using:

 $datum_deelname = $node->get('field_normaldate')->value;

If I change this in the new field name:

 $datum_deelname = $node->get('field_optional_enddate')->value;

I get back NULL.

How should I get this value?

1 Answer 1

3

Try using:

 $datum_deelname = $node->get('field_optional_enddate')->end_value;

This will give the optional end date.

If you want to get the normal date as you mentioned you can use as:

 $datum_deelname = $node->get('field_optional_enddate')->value;

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.