Liferay.Loader.define("portal-workflow-metrics-web@2.0.46/js/shared/util/date.es", ['module', 'exports', 'require', './moment.es'], function (module, exports, require) {
  var define = undefined;
  var global = window;
  {
    Object.defineProperty(exports, "__esModule", {
      value: true
    });
    exports.isValidDate = exports.getMaskByDateFormat = exports.getLocaleDateFormat = exports.formatDate = exports.defaultDateFormat = void 0;

    var _moment = _interopRequireDefault(require("./moment.es"));

    function _interopRequireDefault(obj) {
      return obj && obj.__esModule ? obj : { default: obj };
    }

    /**
     * Copyright (c) 2000-present Liferay, Inc. All rights reserved.
     *
     * The contents of this file are subject to the terms of the Liferay Enterprise
     * Subscription License ("License"). You may not use this file except in
     * compliance with the License. You can obtain a copy of the License by
     * contacting Liferay, Inc. See the License for the specific language governing
     * permissions and limitations under the License, including but not limited to
     * distribution rights of the Software.
     */
    var defaultDateFormat = 'YYYY-MM-DD\\THH:mm:ss\\Z';
    exports.defaultDateFormat = defaultDateFormat;

    var formatDate = function formatDate(date) {
      var format = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'L';
      var fromFormat = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
      return _moment.default.utc(date, fromFormat).format(format);
    };

    exports.formatDate = formatDate;

    var getLocaleDateFormat = function getLocaleDateFormat() {
      var format = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'L';
      return _moment.default.localeData().longDateFormat(format);
    };

    exports.getLocaleDateFormat = getLocaleDateFormat;

    var getMaskByDateFormat = function getMaskByDateFormat(format) {
      var mask = [];

      for (var i = 0; i < format.length; i++) {
        if (/[a-z]/i.test(format[i])) {
          mask.push(/\d/);
        } else {
          mask.push("".concat(format[i]));
        }
      }

      return mask;
    };

    exports.getMaskByDateFormat = getMaskByDateFormat;

    var isValidDate = function isValidDate(date) {
      var format = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'L';
      return _moment.default.utc(date, format, true).isValid();
    };

    exports.isValidDate = isValidDate;
    //# sourceMappingURL=date.es.js.map
  }
});
//# sourceMappingURL=date.es.js.map