"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.fromEditorValue = exports.toEditorValue = void 0;
var mdm_sdk_1 = require("@reltio/mdm-sdk");
var toEditorValue = function (dataType) { return function (value) {
    switch (dataType) {
        case mdm_sdk_1.DataTypes.TYPE_DATE:
            return (0, mdm_sdk_1.isDateRangeValue)(value) ? value : mdm_sdk_1.utils.dates.toLocalDate(value);
        case mdm_sdk_1.DataTypes.TYPE_LOCAL_DATE:
        case mdm_sdk_1.DataTypes.TYPE_TIMESTAMP:
        case mdm_sdk_1.DataTypes.TYPE_ACTIVENESS_DATE:
            return (0, mdm_sdk_1.isDateRangeValue)(value) ? value : new Date(value);
        default:
            return value;
    }
}; };
exports.toEditorValue = toEditorValue;
var fromEditorValue = function (dataType) { return function (value) {
    switch (dataType) {
        case mdm_sdk_1.DataTypes.TYPE_DATE:
            return (0, mdm_sdk_1.isDateRangeValue)(value) ? value : Date.UTC(value.getFullYear(), value.getMonth(), value.getDate());
        case mdm_sdk_1.DataTypes.TYPE_LOCAL_DATE:
        case mdm_sdk_1.DataTypes.TYPE_ACTIVENESS_DATE:
        case mdm_sdk_1.DataTypes.TYPE_TIMESTAMP:
            return (0, mdm_sdk_1.isDateRangeValue)(value) ? value : value.valueOf();
        default:
            return value;
    }
}; };
exports.fromEditorValue = fromEditorValue;
