I have the following datetime field definition for my content entity:
$fields['start_date'] = BaseFieldDefinition::create('datetime')
->setLabel(t('Start date'))
->setDescription(t('Start date in GMT time.'))
->setSettings([
'default_value' => DrupalDateTime::createFromTimestamp(time()),
])
->setDisplayOptions('view', [
'label' => 'above',
'type' => 'string',
'weight' => -4,
])
->setDisplayOptions('form', [
'type' => 'datetime_default',
'weight' => -3,
])
->setDisplayConfigurable('form', TRUE)
->setDisplayConfigurable('view', TRUE);
As a result, when creating a new entity, I get the field display without default value set in a form. I also tried setDefaultValue method but with no luck. What is the proper way to set the default values for the custom content entities?