"use strict";var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;exports.__esModule = true;exports.isLessOrEqual = exports.isLess = exports.isGreaterOrEqual = exports.isGreater = exports.isEqual = exports.isBetween = void 0;var CDS = _interopRequireWildcard(require("../../components/Calendar/CalendarDateShape"));

var _InternalDate = require("./InternalDate");

var stringToDate = function stringToDate(date) {
  return new _InternalDate.InternalDate({ value: date }).getComponentsLikeNumber();
};

var isEqual = exports.isEqual = function isEqual(left, right) {return left === right;};

var isLess = exports.isLess = function isLess(left, right) {
  var leftDate = stringToDate(left);
  var rightDate = stringToDate(right);
  return CDS.isLess(leftDate, rightDate);
};

var isLessOrEqual = exports.isLessOrEqual = function isLessOrEqual(left, right) {
  var leftDate = stringToDate(left);
  var rightDate = stringToDate(right);
  return CDS.isLess(leftDate, rightDate) || CDS.isEqual(leftDate, rightDate);
};

var isGreater = exports.isGreater = function isGreater(left, right) {
  var leftDate = stringToDate(left);
  var rightDate = stringToDate(right);
  return !CDS.isLessOrEqual(leftDate, rightDate);
};

var isGreaterOrEqual = exports.isGreaterOrEqual = function isGreaterOrEqual(left, right) {
  var leftDate = stringToDate(left);
  var rightDate = stringToDate(right);
  return !CDS.isLess(leftDate, rightDate);
};

var isBetween = exports.isBetween = function isBetween(between, left, right) {
  var betweenDate = stringToDate(between);
  if (left && CDS.isLess(betweenDate, stringToDate(left))) {
    return false;
  }
  if (right && CDS.isGreater(betweenDate, stringToDate(right))) {
    return false;
  }
  return true;
};