Timestamp field type uses numeric filter plugin rather than date filter plugin

Created on 19 March 2021, about 4 years ago
Updated 28 September 2023, over 1 year ago

Problem/Motivation

When using a custom timestamp field to filter a view the filter type used is the numeric filter, rather than the expected date filter, this prevents the view from being filtered by an offset of the timestamp, and also results in an exposed filter on a timestamp field expecting the user to input a valid unix timestamp value, rather than being presented with a date picker element.

note that this only applies to custom fields of the type timestamp, fields such as creayed date and updated date, which are stored in the db as timestamps are handled as expected, using the date filter plugin.

Steps to reproduce

create a content type with a custom field of type timestamp, or add a custom field of type timestamp to the user object, populate the field with data.

create a view displaying the the content type, or users, and add a filter on the created timestamp field, the filter interface will use the numeric plugin, rather than the date plugin, removing the option to use an offset value in the filter, and displaying the exposed filter as a text input rather than as a date picker.

I've checked this on a simplytest.me instance on drupal 8.9.13 with no additional modules installed to ensure that the issue is present in a base drupal install

Proposed resolution

Ensure that the timestamp field type uses the date filter rather than the numeric filter.

User interface changes

in the views admin the user will be able to select to use an offset, rather than a specific date, where the filter is exposed a date picker will be used rather than an standard text input

🐛 Bug report
Status

Active

Version

9.5

Component
Views 

Last updated 18 minutes ago

Created by

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

Merge Requests

Comments & Activities

Not all content is available!

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

Production build 0.71.5 2024