Liferay.Loader.define("frontend-taglib-clay@6.6.20/data_set_display/utilities/dates", ['module', 'exports', 'require'], function (module, exports, require) {
  var define = undefined;
  var global = window;
  {
    Object.defineProperty(exports, "__esModule", {
      value: true
    });
    exports.formatDateObject = formatDateObject;
    exports.getDateFromDateString = getDateFromDateString;
    exports.prettifyDateObject = prettifyDateObject;
    exports.formatDateRangeObject = formatDateRangeObject;
    exports.convertObjectDateToIsoString = convertObjectDateToIsoString;

    function isNativeReflectConstruct() {
      if (typeof Reflect === "undefined" || !Reflect.construct) return false;if (Reflect.construct.sham) return false;if (typeof Proxy === "function") return true;try {
        Date.prototype.toString.call(Reflect.construct(Date, [], function () {}));return true;
      } catch (e) {
        return false;
      }
    }

    function _construct(Parent, args, Class) {
      if (isNativeReflectConstruct()) {
        _construct = Reflect.construct;
      } else {
        _construct = function _construct(Parent, args, Class) {
          var a = [null];a.push.apply(a, args);var Constructor = Function.bind.apply(Parent, a);var instance = new Constructor();if (Class) _setPrototypeOf(instance, Class.prototype);return instance;
        };
      }return _construct.apply(null, arguments);
    }

    function _setPrototypeOf(o, p) {
      _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
        o.__proto__ = p;return o;
      };return _setPrototypeOf(o, p);
    }

    function _slicedToArray(arr, i) {
      return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest();
    }

    function _nonIterableRest() {
      throw new TypeError("Invalid attempt to destructure non-iterable instance");
    }

    function _iterableToArrayLimit(arr, i) {
      if (!(Symbol.iterator in Object(arr) || Object.prototype.toString.call(arr) === "[object Arguments]")) {
        return;
      }var _arr = [];var _n = true;var _d = false;var _e = undefined;try {
        for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {
          _arr.push(_s.value);if (i && _arr.length === i) break;
        }
      } catch (err) {
        _d = true;_e = err;
      } finally {
        try {
          if (!_n && _i["return"] != null) _i["return"]();
        } finally {
          if (_d) throw _e;
        }
      }return _arr;
    }

    function _arrayWithHoles(arr) {
      if (Array.isArray(arr)) return arr;
    }

    /**
     * SPDX-FileCopyrightText: (c) 2000 Liferay, Inc. https://liferay.com
     * SPDX-License-Identifier: LGPL-2.1-or-later OR LicenseRef-Liferay-DXP-EULA-2.0.0-2023-06
     */
    function formatDateObject(dateObject) {
      return "".concat(dateObject.year, "-").concat(('0' + dateObject.month).slice(-2), "-").concat(('0' + dateObject.day).slice(-2));
    }

    function getDateFromDateString(dateString) {
      var _dateString$split = dateString.split('-'),
          _dateString$split2 = _slicedToArray(_dateString$split, 3),
          year = _dateString$split2[0],
          month = _dateString$split2[1],
          day = _dateString$split2[2];

      return {
        day: Number(day),
        month: Number(month),
        year: Number(year)
      };
    }

    function prettifyDateObject(dateObject) {
      var date = new Date(dateObject.year, dateObject.month - 1, dateObject.day);
      return date.toLocaleDateString();
    }

    function formatDateRangeObject(dateRangeObject) {
      if (dateRangeObject.from && dateRangeObject.to) {
        return "".concat(prettifyDateObject(dateRangeObject.from), " - ").concat(prettifyDateObject(dateRangeObject.to));
      }

      if (dateRangeObject.from) {
        return "".concat(Liferay.Language.get('from'), " ").concat(prettifyDateObject(dateRangeObject.from));
      }

      if (dateRangeObject.to) {
        return "".concat(Liferay.Language.get('to'), " ").concat(prettifyDateObject(dateRangeObject.to));
      }
    }

    function convertObjectDateToIsoString(objDate, direction) {
      var time = direction === 'from' ? [0, 0, 0, 0] : [23, 59, 59, 999];

      var date = _construct(Date, [objDate.year, objDate.month - 1, objDate.day].concat(time));

      return date.toISOString();
    }
    //# sourceMappingURL=dates.js.map
  }
});
//# sourceMappingURL=dates.js.map