datetime doesn't work with CCK
kenorb - December 8, 2008 - 16:17
| Project: | Resource Conflict |
| Version: | 6.x-2.x-dev |
| Component: | Code |
| Category: | feature request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | needs work |
Description
What's about support for date time field?
There is:
elseif ($field['type'] == 'date' && $field['todate'] == 'required' && $field['required']) {
$date_fields[$field['field_name']] = $field['widget']['label'];
}My solution:
elseif (($field['type'] == 'date' || $field['type'] == 'datetime') && $field['todate'] == 'required' && $field['required']) {
$date_fields[$field['field_name']] = $field['widget']['label'];
}But I didn't test it if it will work.

#1
#2
Are there any plans to address this feature request?
#3
I would expand this feature request as follows:
Support all date field types. RC should not fail to work just because a content type doesn't use its preferred date field type.
#4
I would have expected this behaviour (not supporting datetime) I too think it is a must have.
So +1
#5
I have made a patch to resource_conflict.module including the code from knorb and changed _resource_conflict_overlaps_from_date tp support date_make_date from DATE_DATETIME format. It is my first contributed patch, if there is a problem please tell me and i'll correct it. Note that the patch has been made against version 2.0
@@ -147,7 +147,7 @@ function resource_conflict_form_alter(&$if ($field['type'] == 'nodereference') {
$nodereference_fields[$field['field_name']] = $field['widget']['labe$
}
- elseif ($field['type'] == 'date' && $field['todate'] == 'required' && $
+ elseif (($field['type'] == 'date' || $field['type'] == 'datetime') && $
$date_fields[$field['field_name']] = $field['widget']['label'];
}
}
@@ -326,8 +326,13 @@ function _resource_conflict_get_node_res
* An array of node ID's
*/
function _resource_conflict_overlaps_from_date($date_start, $date_end) {
- $start = date_make_date($date_start, 'GMT', DATE_ISO);
- $end = date_make_date($date_end, 'GMT', DATE_ISO);
+ // make default type to DATE_ISO
+ $type = DATE_ISO;
+ // if date_start is not in DATE_ISO set type to DATE_DATETIME
+ if (!date_is_valid($date_start,DATE_ISO)) $type = DATE_DATETIME;
+
+ $start = date_make_date($date_start, 'GMT', $type);
+ $end = date_make_date($date_end, 'GMT', $type);
return _resource_conflict_get_overlaps($start, $end);
}
#6
Forgot to mention that i tested it with my datetime field and it worked as expected :-)
#7
Thanks redben for the patch. A few notes:
Otherwise, it looks good - it'd be great if someone else tested this too.