I've created a CCK Date field of type datetime (name field_date), but in Views, it does not appear as an option in Filters. Other CCK date fields do appear, such as field_time, a text field.

Is it not supposed to be available, or should I be doing something to make it visible to Views filters?

I'm using the field to hold an event From and To dates, and I want to be able to filter the events to show only those that are from "today" onwards.

CommentFileSizeAuthor
no-datetime-filter.txt5.04 KBiantresman

Comments

millionleaves’s picture

I believe this discussion has the answer:

http://drupal.org/node/251128

Regards

David

iantresman’s picture

Thanks for the suggestions, which seem to apply to Views 6.x-2.0-beta1. I tried the suggestions anyway, cleared the Drupal cache, cleared the views cache and Disabled views data caching.

Alas the CCK Date field of type datetime still does not appear in Filters.

crystaldawn’s picture

Priority: Normal » Critical

I have this same exact problem. Any CCK Date fields simply do not show up as selectable fields in the fields dropdown list in both Filters AND Arguments. The do however show up just fine in the "Fields" dropdown. But displaying the fields simply isnt enough. They need to be filter fields for sorting and what not. This bug has persisted for quite sometime but I believe has gone un-noticed.

@#1 That post is about 2 yrs old and it does not fix this problem anyways so its completely useless. Besides, if this bug had been around for 2yrs, that would just be disgusting :P So I hardly doubt its cache related :)

The real reason that it doesnt work is most likely that it has no argument/filter handlers. At first glance at the source I dont even see a handler at all other than the field handler which isnt enough. So therefore no amount of "cache clearing" would fix anything at all. I have not looked deeply into this problem yet, but I'm sure as I dig deeper I'll either find the handlers and fix the problem or end up creating them myself if they dont even exist to begin with. I cant imagine no one else running into this so before I even look further I'm going to just keep looking through the issues. There has to be a patch to this. I mean its like selling a car with no door. Kind of an obvious part of the machine is missing lol.

crystal_alexandre_froger’s picture

No one has never wanted to filter some results depending on a Date custom field?
Is a fix being developped at the moment, or will a next version available soon?

bkno’s picture

I've ran into this problem too. Subscribing.

crystal_alexandre_froger’s picture

Priority: Normal » Critical
Status: Closed (works as designed) » Active

Well, the filter exists, after all...
I know it is not really user friendly (cf the number of posts about the problem) but here is the method:

- add a "Date: Date (node)" filter
- select your Date field, e.g "Content: Year of birth (field_birth_year)"
- configure the other parameters (user friendly, from this step xD)

And it's done -_-'.

arlinsandbulte’s picture

Priority: Critical » Normal
Status: Active » Closed (works as designed)

Yes, there is a second step involved with date fields.
I think this is due to the way date fields integrate with other date info that is available to views (node creation date, for instance, which is not a cck field... I think).

iantresman’s picture

Title: Date: Datetime field doesn't appear in Views filter » Date: Datetime field doesn't appear in Views filter [Solved]
Priority: Critical » Normal
Status: Active » Closed (works as designed)

Thanks to cryalex, that seems to do the trick, easy when you know how. The solution is indeed to:

  • In Views|Filter, first select the filter: Date: Date (node), and then:
  • Select Content: Date (field_date) From date (or To date)
seanr’s picture

Title: Date: Datetime field doesn't appear in Views filter [Solved] » Better UI needed - Date: Datetime field doesn't appear in Views filter [Solved]
Category: support » bug
Status: Closed (works as designed) » Active
Issue tags: +User interface

This is REALLY bad UI - doesn't even make any sense, especially given that it never used to work this way. No new user or existing user used to the old method is going to expect to find it completely buried like that when all other CCK fields show up listed under Content.

karens’s picture

Status: Active » Closed (works as designed)

It has ALWAYS worked this way, changing it now will confuse people who know where it is. This is not a change.

It was done this way because it can be used for non-CCK date fields as well as CCK date fields and it can only show up in one place. It is its own kind of field, one that transcends CCK and core.

iantresman’s picture

You could have both options, keeping everyone happy.

The intuitive option is have the ability to select the CCK date field, where a newby would expect it (ie, show and select Content: Date (field_date)).

But keep the non-intuitive option, requiring oldies who know to select Date: Date (node).

karens’s picture

Views doesn't support that, it can't be in two places.

harriska2’s picture

At least a note in the arguments area "Select CCK date field within date:date area" would have saved me 1 days worth of scratching my head. I've been using Drupal since about 2004 and views and calendar shortly thereafter. It took me the whole day to find this post (I had to search on "calendar view argument" and sort by date).

arlinsandbulte’s picture

Actually, I think Karen has retracted her statement in #12 above and 'fixed' this issue.
See #963844: "Missing" date filter and argument for more.

mbohner’s picture

Thanks for that. Yes, Date (node) brings up the cck datetime fields.