/**
 * Shared formatting utilities for summary/print/approval views
 *
 * Extracted from hazo_collab_form_summary/utils.ts for use by
 * HazoCollabFormView's various view modes.
 */
import { format_date, format_date_range, DEFAULT_DATE_FORMAT } from '../../../utils/date_format.js';
/**
 * Get display label for combo/radio option value
 * Returns the label for the matching option, or the value itself if not found
 */
export function get_display_label(options, value) {
    if (!options || !value)
        return value || '';
    const option = options.find((opt) => opt.value === value);
    return option ? option.label : value;
}
/**
 * Format date value for display
 * Supports single dates and date ranges (objects with from/to)
 * @param value - Date value to format
 * @param date_format - Format type (iso, dmy, mdy, locale). Default: 'iso'
 */
export function format_date_value(value, date_format = DEFAULT_DATE_FORMAT) {
    if (!value)
        return '';
    // Handle Date object
    if (value instanceof Date) {
        return format_date(value, date_format);
    }
    // Handle date range object
    if (typeof value === 'object' && ('from' in value || 'to' in value)) {
        return format_date_range(value.from, value.to, date_format);
    }
    // Handle string date
    if (typeof value === 'string') {
        return format_date(value, date_format);
    }
    return '';
}
//# sourceMappingURL=summary_utils.js.map