import { format, parse } from 'date-fns';
import ruLocale from 'date-fns/locale/ru';
import { isDefined } from './type-guards';
export var DATE_FORMAT = 'dd.MM.yyyy';
export var parseDate = function (date) {
    return parse(date, DATE_FORMAT, new Date(), { locale: ruLocale });
};
export var formatDate = function (date, dateFormat) {
    if (dateFormat === void 0) { dateFormat = DATE_FORMAT; }
    return format(date, dateFormat);
};
export var getMonthTitle = function (date) {
    return format(date, 'LLLL', { locale: ruLocale });
};
export var isDateRange = function (value) {
    return Array.isArray(value) &&
        value.length === 2 &&
        value.every(function (date) { return date instanceof Date || !isDefined(date); });
};
export var isOnlyOneDateInRange = function (range) {
    return Boolean((range[0] && !range[1]) || (!range[0] && range[1]));
};
