Example #1
0
    /// <summary>
    /// Initializes a new instance of the <see cref="DateRange"/> class.
    /// </summary>
    /// <param name="start">The start.</param>
    /// <param name="end">The end.</param>
    public DateRange(string start, string end)
    {
      _start = new BasicDate(start);
      _end = new BasicDate(end);
      _overYear = false;

      if (_end.Month < _start.Month)
      {
        _overYear = true;
      }
    }
Example #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="DateRange"/> class.
        /// </summary>
        /// <param name="start">The start.</param>
        /// <param name="end">The end.</param>
        public DateRange(string start, string end)
        {
            _start    = new BasicDate(start);
            _end      = new BasicDate(end);
            _overYear = false;

            if (_end.Month < _start.Month)
            {
                _overYear = true;
            }
        }
Example #3
0
        /// <summary>
        /// Determines whether [is in range] [the specified time].
        /// </summary>
        /// <param name="time">The time.</param>
        /// <returns>
        ///     <c>true</c> if [is in range] [the specified time]; otherwise, <c>false</c>.
        /// </returns>
        public bool IsInRange(long time)
        {
            var checkTime = new BasicDate(time);

            if (_overYear)
            {
                if (_start < checkTime && checkTime.Month < 12 ||
                    _end > checkTime && checkTime.Month >= 1)
                {
                    return(true);
                }
            }
            else
            {
                if (_start < checkTime && _end > checkTime)
                {
                    return(true);
                }
            }
            return(false);
        }
Example #4
0
    /// <summary>
    /// Determines whether [is in range] [the specified time].
    /// </summary>
    /// <param name="time">The time.</param>
    /// <returns>
    /// 	<c>true</c> if [is in range] [the specified time]; otherwise, <c>false</c>.
    /// </returns>
    public bool IsInRange(long time)
    {
      var checkTime = new BasicDate(time);

      if (_overYear)
      {
        if (_start < checkTime && checkTime.Month < 12 ||
            _end > checkTime && checkTime.Month >= 1)
        {
          return true;
        }
      }
      else
      {
        if (_start < checkTime && _end > checkTime)
        {
          return true;
        }
      }
      return false;
    }