import { formatDate } from './index';
import { getRangeValuesWithValueType } from './getValueInRangePicker';
export function getSelectedValueWithDate(value, dateConfig, options) {
    var onChangeValue = null;
    if (!value)
        return onChangeValue;
    var startDate = dateConfig.startDate;
    return startDate(value, options);
}
export function getCallbackValueWithDate(value, valueType, format) {
    switch (valueType) {
        case 'string': {
            return formatDate(format, value);
        }
        case 'number': {
            return value.getTime();
        }
        default:
            return value;
    }
}
export function getCallbackValueRangeWithDate(value, valueType, format, dateConfig, options) {
    var onChangeValue;
    var startDate = dateConfig.startDate, endDate = dateConfig.endDate;
    if (options) {
        onChangeValue = [startDate(value, options), endDate(value, options)];
    }
    else {
        onChangeValue = [startDate(value), endDate(value)];
    }
    return getRangeValuesWithValueType(valueType, format, onChangeValue);
}
