<commit_before>interface IDateRange {
    key: string;
    label: string;
    elasticSearchDateRange: {
        lte?: string,
        gte?: string,
    };
}

const before1MonthFilter: IDateRange = {
    key: 'before_next_month',
    label: gettext('Next Month'),
    elasticSearchDateRange: {
        lte: 'now+1M/d',
    },
};

const before3MonthsFilter: IDateRange = {
    key: 'before_3_months_ahead',
    label: gettext('Next 3 Months'),
    elasticSearchDateRange: {
        lte: 'now+3M/d',
    },
};

const lastMonthFilter: IDateRange = {
    key: 'last_month',
    label: gettext('Last Month'),
    elasticSearchDateRange: {
        lte: 'now-1M/M',
        gte: 'now-1M/M',
    },
};

const lastWeekFilter: IDateRange = {
    key: 'last_week',
    label: gettext('Last Week'),
    elasticSearchDateRange: {
        lte: 'now-1w/w',
        gte: 'now-1w/w',
    },
};

const lastDayFilter: IDateRange = {
    key: 'last_day',
    label: gettext('Last Day'),
    elasticSearchDateRange: {
        lte: 'now-1d/d',
        gte: 'now-1d/d',
    },
};

const last24hoursFilter: IDateRange = {
    key: 'last_24_hours',
    label: gettext('Last 24 Hours'),
    elasticSearchDateRange: {
        gte: 'now-24H',
    },
};

const last8hoursFilter: IDateRange = {
    key: 'last_8_hours',
    label: gettext('Last 8 Hours'),
    elasticSearchDateRange: {
        gte: 'now-8H',
    },
};

export const dateRangesByKey: Dictionary<string, IDateRange> = {
    before_next_month: before1MonthFilter,
    before_3_months_ahead: before3MonthsFilter,
    last_month: lastMonthFilter,
    last_week: lastWeekFilter,
    last_day: lastDayFilter,
    last_24_hours: last24hoursFilter,
    last_8_hours: last8hoursFilter,
};

export const getDateFilters = (gettext) => [
    {
        labelBlock: gettext('Date created'),
        labelFrom: gettext('Created from'),
        labelTo: gettext('Created to'),
        fieldname: 'firstcreated',
        predefinedFilters: [lastDayFilter, lastWeekFilter, lastMonthFilter],
        isEnabled: () => true,
    },
    {
        labelBlock: gettext('Date modified'),
        labelFrom: gettext('Modified from'),
        labelTo: gettext('Modified to'),
        fieldname: 'versioncreated',
        predefinedFilters: [lastDayFilter, lastWeekFilter, lastMonthFilter],
        isEnabled: () => true,
    },
    {
        labelBlock: gettext('Date published'),
        labelFrom: gettext('Published from'),
        labelTo: gettext('Published to'),
        fieldname: 'firstpublished',
        predefinedFilters: [lastDayFilter, lastWeekFilter, lastMonthFilter],
        isEnabled: () => true,<commit_msg>fixed: Date filters expected behaviour<commit_after>interface IDateRange {
    key: string;
    label: string;
    elasticSearchDateRange: {
        lte?: string,
        gte?: string,
    };
}

const before1MonthFilter: IDateRange = {
    key: 'before_next_month',
    label: gettext('Next Month'),
    elasticSearchDateRange: {
        lte: 'now+1M/d',
    },
};

const before3MonthsFilter: IDateRange = {
    key: 'before_3_months_ahead',
    label: gettext('Next 3 Months'),
    elasticSearchDateRange: {
        lte: 'now+3M/d',
    },
};

const last30daysFilter: IDateRange = {
    key: 'last_30_days',
    label: gettext('Last 30 Days'),
    elasticSearchDateRange: {
        gte: 'now-30d',
    },
};

const last7daysFilter: IDateRange = {
    key: 'last_7_days',
    label: gettext('Last 7 Days'),
    elasticSearchDateRange: {
        gte: 'now-7d',
    },
};

const last24hoursFilter: IDateRange = {
    key: 'last_24_hours',
    label: gettext('Last 24 Hours'),
    elasticSearchDateRange: {
        gte: 'now-24H',
    },
};

const last8hoursFilter: IDateRange = {
    key: 'last_8_hours',
    label: gettext('Last 8 Hours'),
    elasticSearchDateRange: {
        gte: 'now-8H',
    },
};

export const dateRangesByKey: Dictionary<string, IDateRange> = {
    before_next_month: before1MonthFilter,
    before_3_months_ahead: before3MonthsFilter,
    last_30_days: last30daysFilter,
    last_7_days: last7daysFilter,
    last_24_hours: last24hoursFilter,
    last_8_hours: last8hoursFilter,
};

export const getDateFilters = (gettext) => [
    {
        labelBlock: gettext('Date created'),
        labelFrom: gettext('Created from'),
        labelTo: gettext('Created to'),
        fieldname: 'firstcreated',
        predefinedFilters: [last24hoursFilter, last7daysFilter, last30daysFilter],
        isEnabled: () => true,
    },
    {
        labelBlock: gettext('Date modified'),
        labelFrom: gettext('Modified from'),
        labelTo: gettext('Modified to'),
        fieldname: 'versioncreated',
        predefinedFilters: [last24hoursFilter, last7daysFilter, last30daysFilter],
        isEnabled: () => true,
    },
    {
        labelBlock: gettext('Date published'),
        labelFrom: gettext('Published from'),
        labelTo: gettext('Published to'),
        fieldname: 'firstpublished',
        predefinedFilters: [last24hoursFilter, last7daysFilter, last30daysFilter],
        isEnabled: () => true,
{'fraction_non_alphanumeric': 0.1279873592731582, 'fraction_numerical': 0.01836855619198104, 'mean_word_length': 3.0382775119617227, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6879444', 'n_tokens_mistral': 1703, 'n_tokens_neox': 1628, 'n_words': 328}