text: 
  import moment from 'moment-timezone';
  
  const formatTo2Digits = (number) => (number < 10 ? '0' : '') + number;
  
  export const formatTimeSpan = (startDate, endDate) => {
      let diff = endDate.getTime() - startDate.getTime();
  
      const hours = Math.floor(diff / (1000 * 60 * 60));
      diff -= hours * (1000 * 60 * 60);
  
      const mins = Math.floor(diff / (1000 * 60));
      diff -= mins * (1000 * 60);
  
      const seconds = Math.floor(diff / (1000));
      diff -= seconds * (1000);
  
      return {
          hours:   formatTo2Digits(hours),
          minutes: formatTo2Digits(mins),
          seconds: formatTo2Digits(seconds),
      };
  };
  
  export const formatDateRoundedByMinutes = (date) =>
      `${formatTo2Digits(date.getHours())}:${formatTo2Digits(date.getMinutes())}`;
  
  export const formatMathDate = (date) => `${date.getUTCFullYear()}/
          ${formatTo2Digits(date.getUTCMonth() + 1)}/
          ${formatTo2Digits(date.getUTCDate())}`;
  
  export const formatToNumberDate = (date) => date.getUTCFullYear()
          + formatTo2Digits(date.getUTCMonth() + 1)
          + formatTo2Digits(date.getUTCDate());
  
  export const isToday = (date) => formatToNumberDate(new Date()) === formatToNumberDate(date);
  
  export const calculateTimestampDifferenceInHours = (date1, date2) => (date2 - date1) / (1000 * 60 * 60);
  
  export const getLocalDateTime = (dateTime, timezone) => moment
      .tz(dateTime, timezone)
      // Works in supported browsers to determine the user's time zone.
      .tz(moment.tz.guess())
      .format('YYYY-MM-DD HH:mm');
  
  /**
   * Get the difference between two dates
   * @returns  Time difference in seconds
   */
  export const getDifferenceInSeconds = (date) => {
      const currentDate = moment.utc((new Date()));
      const formattedDate = moment.utc((date));
      const duration = moment.duration(formattedDate.diff(currentDate));
  
      return duration.asSeconds();
  };
  
  /**
  * Format time in seconds to hours, minutes and seconds
  * @returns  Time in hours, minutes and seconds
  */
  export const secondsToTime = (secs) => {
      const hours = Math.floor(secs / (60 * 60));
      const minutes = Math.floor((secs % (60 * 60)) / 60);
      const seconds = Math.floor(secs % 60);
  
      return {
          hours: `${hours}`,
          mins:  minutes > 9 ? `${minutes}` : `0${minutes}`,
          secs:  seconds > 9 ? `${seconds}` : `0${seconds}`,
      };
  };
  