Come together with the global Drupal community in Rotterdam, 28 Sept – 1 Oct 2026. Sessions, contribution, connection, and Early Bird savings until 8 June.
I, too, want to list only the year, while taking advantage of the year range parameters and option auto-generation of the date field type. Has anyone already done this?
Off the top of my head it may be easiest to make a little custom module and use hook_form_alter to change the month and day bits of the FAPI array into hidden fields with a default value that will still validate as an actual date (01 and 01 for example)
Comments
Comment #1
quicksketchYes, you just set the starting year to -50. (It defaults to -2).
Comment #3
DrupalKing commentedHmm, I want it to just list the year, not the month and day.
Comment #4
ndewhurst*edited*
Comment #5
ndewhurstI, too, want to list only the year, while taking advantage of the year range parameters and option auto-generation of the date field type. Has anyone already done this?
Comment #6
vernond commentedOff the top of my head it may be easiest to make a little custom module and use hook_form_alter to change the month and day bits of the FAPI array into hidden fields with a default value that will still validate as an actual date (01 and 01 for example)