import _extends from "@babel/runtime/helpers/esm/extends";
import { getMonthInHumanFormat } from "../../../components/Calendar/CalendarUtils";
export var getDateForNative = function getDateForNative(componentDate) {
  if (!componentDate) {
    return undefined;
  }
  var splittedDate = componentDate.split('.');
  return splittedDate[2] + "-" + splittedDate[1] + "-" + splittedDate[0];
};
export var getDateForComponent = function getDateForComponent(nativeDate) {
  if (!nativeDate) {
    return '';
  }
  var splittedDate = nativeDate.split('-');
  return splittedDate[2] + "." + splittedDate[1] + "." + splittedDate[0];
};
export var getNativeDateFromShape = function getNativeDateFromShape(componentDate) {
  if (!componentDate) {
    return undefined;
  }
  var _map = [componentDate.date, componentDate.month, componentDate.year].map(function (x) {
      return x.toString();
    }),
    date = _map[0],
    month = _map[1],
    year = _map[2];
  return year.padStart(4, '0') + "-" + month.padStart(2, '0') + "-" + date.padStart(2, '0');
};
export var upMonthOfShape = function upMonthOfShape(DateShape) {
  if (!DateShape) {
    return undefined;
  }
  return _extends({}, DateShape, {
    month: getMonthInHumanFormat(DateShape.month)
  });
};
export var getShapeFromNativeDate = function getShapeFromNativeDate(nativeDate) {
  if (!nativeDate) {
    return undefined;
  }
  var splittedDate = nativeDate.split('-').map(function (date) {
    return Number(date);
  });
  return {
    year: splittedDate[0],
    month: splittedDate[1],
    date: splittedDate[2]
  };
};