import i18n from 'ui-i18n';
import moment from 'moment';
import { DEFAULT_MAX_DATE_IN_POPUP, DEFAULT_MIN_DATE } from './constants';
export var getErrorMessage = function (error) {
    switch (error) {
        case 'maxDate':
            return i18n.text('Date should not be after maximal date');
        case 'minDate':
            return i18n.text('Date should not be before minimal date');
        case 'invalidDate':
            return i18n.text('Invalid Date Format');
        default:
            return '';
    }
};
export var isDateRangeError = function (error) { return ['minDate', 'maxDate'].includes(error); };
export var getEditorMaxDate = function (maxDate) {
    var date = moment(maxDate).isAfter(DEFAULT_MAX_DATE_IN_POPUP) ? DEFAULT_MAX_DATE_IN_POPUP : maxDate;
    return moment(date);
};
export var getEditorMinDate = function (minDate) {
    var date = moment(minDate).isBefore(DEFAULT_MIN_DATE) ? DEFAULT_MIN_DATE : minDate;
    return moment(date);
};
