Views treats datetime fields like strings when filtering

Created on 1 February 2017, almost 8 years ago
Updated 17 May 2023, over 1 year ago

When a custom entity is created, and one of the fields is a datetime FieldType, views filters are not treating this field like a datetime field, but, instead, like a string. Timestamp Fieldtypes on the other hand are presented with the correct filter options.

🐛 Bug report
Status

Needs work

Version

10.1

Component
Views 

Last updated about 1 hour ago

Created by

🇺🇸United States Beakerboy Kentucky

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • 🇳🇮Nicaragua Ada Hernandez Leon

    I faced this issue with my custom entity and views filter, adding field_name as here is suggested and
    the views type filter to handle the date in my getViewsData() method works.

    $data['my_entity']['date_field']['filter'] = [
          'id' => 'datetime',
          'field_name' => 'date_field',
        ];
Production build 0.71.5 2024