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.
When creating the Date fields from a custom module, defining the field type as 'date' sets the field type to Date ISO Format instead of just the Date field type. What is the appropriate field type for the normal Date field type.
<?php
array(
'field' => array(
'field_name' => 'field_date',
'type' => 'date',
'cardinality' => 1,
'label' => 'Date',
'settings' => array(),
),
'instance' => array(
'field_name' => 'field_date',
'entity_type' => 'field_collection_item',
'bundle' => 'field_test',
'label' => 'Date',
'cardinality' => 1,
'description' => '',
'widget' => array(
'type' => 'text_textfield',
'weight' => 0,
'settings' => array('size' => 50),
),
'display' => array(
'default' => array(
'label' => 'above',
'settings' => array(),
'weight' => 1,
),
'teaser' => array(
'label' => 'above',
'settings' => array(),
'type' => 'hidden',
),
),
'required' => FALSE,
)
),
);
?>
Comments
Comment #1
JMOmandown CreditAttribution: JMOmandown commentedNevermind. The correct type is 'datetime'. This did not originally work for me because I did not invoke module_load_include('inc', 'date_api', 'date_api_elements');