'use strict';

Object.defineProperty(exports, "__esModule", {
  value: true
});

var _moment = require('moment');

var _moment2 = _interopRequireDefault(_moment);

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

//By default, moment parses and displays in local time.
//If you want to parse or display a moment in UTC, you can use moment.utc() instead of moment().

var getUTCMillisFromDate = function getUTCMillisFromDate(date, format) {
  return _moment2.default.utc(date, format).valueOf();
}; /*
    * *******************************************************************************
    *  * Copyright (c) 2018 Edgeworx, Inc.
    *  *
    *  * This program and the accompanying materials are made available under the
    *  * terms of the Eclipse Public License v. 2.0 which is available at
    *  * http://www.eclipse.org/legal/epl-2.0
    *  *
    *  * SPDX-License-Identifier: EPL-2.0
    *  *******************************************************************************
    *
    */

var getEventStartDate = function getEventStartDate(event, timezone) {
  return _moment2.default.tz(event.startsAt, timezone).format('MMMM Do');
};

var getEventStartTime = function getEventStartTime(event, timezone) {
  return _moment2.default.tz(event.startsAt, timezone).format('h:mm a');
};

var getEventEndTime = function getEventEndTime(event, timezone) {
  var endMillis = null == event.duration ? null : event.startsAt + event.duration;
  return null == endMillis ? null : _moment2.default.tz(endMillis, timezone).format('h:mm a');
};

exports.default = {
  getUTCMillisFromDate: getUTCMillisFromDate,
  getEventEndTime: getEventEndTime,
  getEventStartTime: getEventStartTime,
  getEventStartDate: getEventStartDate
};