Commit 732a3729 authored by merlinofchaos's avatar merlinofchaos
Browse files

allow dates of 0 to have an alternate string using a theme function

parent 45df6d02
......@@ -1617,34 +1617,39 @@ function theme_views_summary($view, $type, $level, $nodes, $args) {
* Format a date.
*/
function views_handler_field_date($fieldinfo, $fielddata, $value, $data) {
return format_date($value);
return $value ? format_date($value) : theme_views_nodate();
}
/**
* Format a date using small representation.
*/
function views_handler_field_date_small($fieldinfo, $fielddata, $value, $data) {
return format_date($value, 'small');
return $value ? format_date($value, 'small') : theme_views_nodate();
}
/**
* Format a date using large representation.
*/
function views_handler_field_date_large($fieldinfo, $fielddata, $value, $data) {
return format_date($value, 'large');
return $value ? format_date($value, 'large') : theme_views_nodate();
}
/**
* Format a date using custom representation.
*/
function views_handler_field_date_custom($fieldinfo, $fielddata, $value, $data) {
return format_date($value, 'custom', $fielddata['options']);
return $value ? format_date($value, 'custom', $fielddata['options']) : theme_views_nodate();
}
/**
* Format a date as "X time ago".
*/
function views_handler_field_since($fieldinfo, $fielddata, $value, $data) {
return format_interval(time() - $value);
return $value ? t('%time ago', array('%time' => format_interval(time() - $value))) : theme_views_nodate();
}
function theme_views_nodate() {
return '<span class="views-nodate">' . t('never') . '</span>';
}
/**
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment