10

I have a content type A and it has a date field.

I'm selecting Day-Month-Year for this date field. But not every content has a day and I want to select only Month and Year for these content.

If I select (enter) only month and year, it gives error:

The value input for field Date is invalid: The value March 1979 does not match the expected format.


I installed and tried the Partial Date module but still couldn't do what I want although it says on the module page:

This module provides date and time fields that allows any individual component to be left blank, while still providing a sortable listing of the fields.


How can I do that? I want to enter full date (Day-Month-Year) for some nodes and for some others partial date (only Month-Year) and maybe for some others only Year. Isn't this possible?

  • Day-Month-Year
  • Month-Year
  • Year

(And also there is an unsolved issue about this: Allow "fuzzy" granularity.)

2
  • 1
    I would recommend also trying the partial date module again. It has worked for me in the past.
    – rooby
    Commented Nov 4, 2015 at 8:40
  • @rooby, thanks. I will try it again and I hope it will work.
    – herci
    Commented Nov 4, 2015 at 9:17

3 Answers 3

1

It is not possible with one date field. But you can achieve it by adding two different date fields with different configuration i.e.:

  • Date, Month and Year for Date1 field.
  • only Month and Year for Date2 field.
2
  • I thought a similar method (one date field for per granularity; one field for day, one field for month and one field for year) but I think it's useless.
    – herci
    Commented Oct 14, 2015 at 13:26
  • Yeah right!! Its useless. May be it can achieve thought custom coding or three different select list for date, month and year. Commented Oct 14, 2015 at 13:52
0

The only way do to that is to set the widget type to Select, and omit the Day part, as seen in the below screenshot.

date field settings

UPDATE: I don't know why I haven't read the question completely; but Nikhil is right, the only way is create two Date components with different configurations.

0

Create three different Date fields, using different date formats. You can specify the Date entry option during Date field creation (click on More settings and values and choose Custom format in Date entry options, the custom input format for only a month would be F, for example)

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.