"use strict";exports.__esModule = true;exports.toString = exports.isLessOrEqual = exports.isLess = exports.isGreaterOrEqual = exports.isGreater = exports.isEqual = exports.isBetween = exports.fromString = exports.create = exports.comparator = void 0;







var isEqual = exports.isEqual = function isEqual(a, b) {return (
    Boolean(!a && !b || a && b && a.year === b.year && a.month === b.month && a.date === b.date));};

var comparator = exports.comparator = function comparator(a, b) {
  if (a.year < b.year) {
    return -1;
  } else if (a.year > b.year) {
    return 1;
  } else if (a.month < b.month) {
    return -1;
  } else if (a.month > b.month) {
    return 1;
  } else if (a.date < b.date) {
    return -1;
  } else if (a.date > b.date) {
    return 1;
  }
  return 0;
};

var create = exports.create = function create(date, month, year) {return { date: date, month: month, year: year };};

var isLess = exports.isLess = function isLess(left, right) {return comparator(left, right) === -1;};

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

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

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

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

var fromString = exports.fromString = function fromString(dateString) {
  var _dateString$split$map = dateString.split('.').map(Number),date = _dateString$split$map[0],month = _dateString$split$map[1],year = _dateString$split$map[2];
  return create(date, month, year);
};

var toString = exports.toString = function toString(_ref) {var date = _ref.date,month = _ref.month,year = _ref.year;
  var _map = [date, month, year].map(function (x) {return x.toString();}),d = _map[0],m = _map[1],y = _map[2];
  return d.padStart(2, '0') + "." + m.padStart(2, '0') + "." + y.padStart(4, '0');
};