Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
This project is not covered by Drupal’s security advisory policy.
Description
A simple Form API widget for entering date data using separate text fields for day, month and year. The format of the field uses the site's configured date format in exactly the same way as the default date widget does.
The field supports a #mindate and #maxdate attribute for server side validation. Support for clientside validation, including ensuring dates are valid (e.g. 2015-02-29 will not validate) will be added soon(ish).
Configuration example
$form['date_of_birth'] = array(
'#title' => t('Date of birth'),
'#type' => 'date_fields',
'#required' => TRUE,
'#mindate' => strtotime((date('Y') - 100) . date('-m-d')),
'#maxdate' => time(),
'#mindate_error' => t('Please enter a date within the last 100 years.),
'#mindate' => strtotime((date('Y') - 100) . date('-m-d')),
'#maxdate_error' => t('Please enter a date up to and including today.),
);
Screenshot
Supporting organizations:
Project information
- Minimally maintained
Maintainers monitor issues, but fast responses are not guaranteed. - 34 sites report using this module
- Created by sdrycroft on , updated
- This project is not covered by the security advisory policy.
Use at your own risk! It may have publicly disclosed vulnerabilities.