import Vue from 'vue';
export var dateFilter = function (date, params) {
    var defaultParams = {
        shortMode: false,
        showMonth: true,
        showYear: true,
        showDay: true,
        withTime: false
    };
    var appliedParams = Object.assign(defaultParams, params);
    var options = {
        year: appliedParams.showYear ? 'numeric' : undefined,
        month: appliedParams.showMonth ? (appliedParams.shortMode ? 'short' : 'long') : undefined,
        day: appliedParams.showDay ? 'numeric' : undefined
    };
    var locale = (Vue.prototype).$i18n.getCurrentLocale();
    var formattedDate = date.toLocaleDateString([locale], options);
    formattedDate = addOrdinal(formattedDate, locale);
    return formattedDate;
};
var addOrdinal = function (date, locale) {
    var regexp2 = /(^1 )|(^1$)/;
    var match = regexp2.exec(date);
    if (match && locale === 'fr-CA') {
        return date.replace(match[0], match[0].trim() + "<sup>er</sup> ");
    }
    return date;
};
//# sourceMappingURL=date.js.map