<commit_before>﻿using System;
using System.Globalization;
using Newtonsoft.Json;
using Skybrud.Essentials.Json.Converters.Time;
using Skybrud.Essentials.Time.Iso8601;

namespace Skybrud.Essentials.Time {

    /// <summary>
    /// Class representing a date without a time.
    /// </summary>
    [JsonConverter(typeof(TimeConverter))]
    public class EssentialsDate : IComparable, IComparable<EssentialsDate> {

        private readonly DateTime _dateTime;

        #region Properties

        /// <summary>
        /// Gets the year.
        /// </summary>
        public int Year => _dateTime.Year;

        /// <summary>
        /// Gets the month.
        /// </summary>
        public int Month => _dateTime.Month;

        /// <summary>
        /// Gets the day.
        /// </summary>
        public int Day => _dateTime.Day;

        /// <summary>
        /// Returns the day-of-week part of this <see cref="EssentialsDate"/>. The returned value is an integer
        /// between <c>0</c> and <c>6</c>, where <c>0</c> indicates <strong>Sunday</strong>,
        /// <c>1</c> indicates <strong>Monday</strong>, <c>2</c> indicates <strong>Tuesday</strong>,
        /// <c>3</c> indicates <strong>Wednesday</strong>, <c>4</c> indicates <strong>Thursday</strong>,
        /// <c>5</c> indicates <strong>Friday</strong>, and <c>6</c> indicates <strong>Saturday</strong>.
        /// </summary>
        public DayOfWeek DayOfWeek => _dateTime.DayOfWeek;

        /// <summary>
        /// Gets the day-of-year part of this <see cref="EssentialsDate"/>. The returned value is an integer between <c>1</c> and <c>366</c>.
        /// </summary>
        public int DayOfYear => _dateTime.DayOfYear;

        /// <summary>
        /// Returns a numeric value representing both the year and date.
        /// </summary>
        public int YearAndDay => Year * 1000 + DayOfYear;

        /// <summary>
        /// Gets whether the year of this <see cref="EssentialsDate"/> is a leap year.
        /// </summary>
        public bool IsLeapYear => TimeUtils.IsLeapYear(_dateTime);

        /// <summary>
        /// Gets whether the day of this <see cref="EssentialsDate"/> is within a weekend.
        /// </summary>
        public bool IsWeekend => TimeUtils.IsWeekend(_dateTime);

        /// <summary>
        /// Gets whether the day of this <see cref="EssentialsDate"/> is a weekday.
        /// </summary>
        public bool IsWeekday => TimeUtils.IsWeekday(_dateTime);

        /// <summary>
        /// Gets the week number the <strong>ISO 8601</strong> week of this <see cref="EssentialsDate"/>.
        /// </summary>
        public int WeekNumber => Iso8601Utils.GetWeekNumber(_dateTime);

        /// <summary>
        /// Gets the amount of days in the month.
        /// </summary>
        public int DaysInMonth => DateTime.DaysInMonth(Year, Month);

        /// <summary>
        /// Gets the English ordinal suffix of the day.
        /// </summary>
        public string DaySuffix => TimeUtils.GetDaySuffix(_dateTime);

        /// <summary>
        /// Gets a string representation of the instance as specified by the <strong>ISO 8601</strong> format.
        /// </summary>
        public string Iso8601 => _dateTime.ToString("yyyy-MM-dd");

        /// <summary>
        /// Gets whether the date is today.
        /// </summary>
        public bool IsToday => Iso8601 == DateTime.Now.ToString("yyyy-MM-dd");

        /// <summary>
        /// Gets an instance of <see cref="EssentialsDate"/> representing the current day.
        /// </summary>
        public static EssentialsDate Today => new EssentialsDate(DateTime.Today);

        #endregion

        #region Constructors

        /// <summary>
        /// Initializes a new instance from the specified <paramref name="time"/>.
        /// </summary>
        /// <param name="time">An instance of <see cref="DateTime"/>.</param>
        public EssentialsDate(DateTime time) {
            _dateTime = time;
        }

        /// <summary>
        /// Initializes a new instance from the specified <paramref name="time"/>.
        /// </summary>
        /// <param name="time">An instance of <see cref="DateTimeOffset"/>.</param>
        public EssentialsDate(DateTimeOffset time) {
            _dateTime = time.DateTime;<commit_msg>Added new IsTomorrow and IsYesterday properties to the EssentialsDate class<commit_after>﻿using System;
using System.Globalization;
using Newtonsoft.Json;
using Skybrud.Essentials.Json.Converters.Time;
using Skybrud.Essentials.Time.Iso8601;

namespace Skybrud.Essentials.Time {

    /// <summary>
    /// Class representing a date without a time.
    /// </summary>
    [JsonConverter(typeof(TimeConverter))]
    public class EssentialsDate : IComparable, IComparable<EssentialsDate> {

        private readonly DateTime _dateTime;

        #region Properties

        /// <summary>
        /// Gets the year.
        /// </summary>
        public int Year => _dateTime.Year;

        /// <summary>
        /// Gets the month.
        /// </summary>
        public int Month => _dateTime.Month;

        /// <summary>
        /// Gets the day.
        /// </summary>
        public int Day => _dateTime.Day;

        /// <summary>
        /// Returns the day-of-week part of this <see cref="EssentialsDate"/>. The returned value is an integer
        /// between <c>0</c> and <c>6</c>, where <c>0</c> indicates <strong>Sunday</strong>,
        /// <c>1</c> indicates <strong>Monday</strong>, <c>2</c> indicates <strong>Tuesday</strong>,
        /// <c>3</c> indicates <strong>Wednesday</strong>, <c>4</c> indicates <strong>Thursday</strong>,
        /// <c>5</c> indicates <strong>Friday</strong>, and <c>6</c> indicates <strong>Saturday</strong>.
        /// </summary>
        public DayOfWeek DayOfWeek => _dateTime.DayOfWeek;

        /// <summary>
        /// Gets the day-of-year part of this <see cref="EssentialsDate"/>. The returned value is an integer between <c>1</c> and <c>366</c>.
        /// </summary>
        public int DayOfYear => _dateTime.DayOfYear;

        /// <summary>
        /// Returns a numeric value representing both the year and date.
        /// </summary>
        public int YearAndDay => Year * 1000 + DayOfYear;

        /// <summary>
        /// Gets whether the year of this <see cref="EssentialsDate"/> is a leap year.
        /// </summary>
        public bool IsLeapYear => TimeUtils.IsLeapYear(_dateTime);

        /// <summary>
        /// Gets whether the day of this <see cref="EssentialsDate"/> is within a weekend.
        /// </summary>
        public bool IsWeekend => TimeUtils.IsWeekend(_dateTime);

        /// <summary>
        /// Gets whether the day of this <see cref="EssentialsDate"/> is a weekday.
        /// </summary>
        public bool IsWeekday => TimeUtils.IsWeekday(_dateTime);

        /// <summary>
        /// Gets the week number the <strong>ISO 8601</strong> week of this <see cref="EssentialsDate"/>.
        /// </summary>
        public int WeekNumber => Iso8601Utils.GetWeekNumber(_dateTime);

        /// <summary>
        /// Gets the amount of days in the month.
        /// </summary>
        public int DaysInMonth => DateTime.DaysInMonth(Year, Month);

        /// <summary>
        /// Gets the English ordinal suffix of the day.
        /// </summary>
        public string DaySuffix => TimeUtils.GetDaySuffix(_dateTime);

        /// <summary>
        /// Gets a string representation of the instance as specified by the <strong>ISO 8601</strong> format.
        /// </summary>
        public string Iso8601 => _dateTime.ToString("yyyy-MM-dd");

        /// <summary>
        /// Gets whether the date is today.
        /// </summary>
        public bool IsToday => Iso8601 == DateTime.Now.ToString("yyyy-MM-dd");
        
        /// <summary>
        /// Gets whether the date matches the day after the current day.
        /// </summary>
        public bool IsTomorrow => Iso8601 == DateTime.Now.AddDays(+1).ToString("yyyy-MM-dd");

        /// <summary>
        /// Gets whether the date matches the day before the current day.
        /// </summary>
        public bool IsYesterday => Iso8601 == DateTime.Now.AddDays(-1).ToString("yyyy-MM-dd");

        /// <summary>
        /// Gets an instance of <see cref="EssentialsDate"/> representing the current day.
        /// </summary>
        public static EssentialsDate Today => new EssentialsDate(DateTime.Today);

        #endregion

        #region Constructors

        /// <summary>
        /// Initializes a new instance from the specified <paramref name="time"/>.
        /// </summary>
        /// <param name="time">An instance of <see cref="DateTime"/>.</param>
        public EssentialsDate(DateTime time) {
            _dateTime = time;
        }

        /// <summary>
        /// Initializes a new instance from the specified <paramref name="time"/>.
        /// </summary>
        /// <param name="time">An instance of <see cref="DateTimeOffset"/>.</param>
        public EssentialsDate(DateTimeOffset time) {
            _dateTime = time.DateTime;
{'fraction_non_alphanumeric': 0.14408082582912365, 'fraction_numerical': 0.010103228640456841, 'mean_word_length': 2.0346551149616796, 'pattern_counts': {'":': 0, '<': 191, '<?xml version=': 0, '>': 223, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4144041', 'n_tokens_mistral': 2598, 'n_tokens_neox': 2446, 'n_words': 738}