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

JMOmandown’s picture

Status: Active » Closed (fixed)

Nevermind. 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');