How do I allow date-time filtering on my custom entity's ISO date field I have a custom entity with a datetime field. This datetime is saved in the database as an ISO string. I would like to use Views on this entity, and select entities with dates before, after, or between certain dates. I see if I make a view against the system log, these options are presented when filtering on Timestamp. How can I enable the same filtering options on my field?

The field definition is:

$fields['set_datetime'] = BaseFieldDefinition::create('datetime')
  -&gt;setLabel(t('Set DateTime'))
  -&gt;setDescription(t('Date and time fermentor was set.'))
  -&gt;setSettings(array(
    'datetime_type' =&gt; 'datetime',
  ))
  -&gt;setDefaultValue('')
  -&gt;setDisplayOptions('view', array(
    'label' =&gt; 'above',
    'type' =&gt; 'string',
    'weight' =&gt; -4,
  ))
  -&gt;setDisplayOptions('form', array(
    'weight' =&gt; -4,
  ))
  -&gt;setDisplayConfigurable('form', TRUE)
  -&gt;setDisplayConfigurable('view', TRUE);
After checking your module provided for me on github and some reverse-engineering  I find out the problem is on create('datetime') and you should use create('created') So the following code 

$fields['date'] = BaseFieldDefinition::create('created')
  -&gt;setLabel(t('DateTime'))
  -&gt;setDescription(t('Date and time.'))
  -&gt;setDisplayOptions('view', array(
    'label' =&gt; 'above',
    'type' =&gt; 'timestamp',
    'weight' =&gt; -4,
  ))
  -&gt;setDisplayOptions('form', array(
    'type' =&gt; 'datetime_timestamp',
    'weight' =&gt; -4,
  ))
  -&gt;setDisplayConfigurable('form', TRUE)
  -&gt;setDisplayConfigurable('view', TRUE);


Results the below image for me. it seems it's Ok now.