<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 {

    // ReSharper disable InconsistentNaming
    
    /// <summary>
    /// Class wrapping an instance of <see cref="DateTime"/> (as an alternative to using <see cref="Nullable{DateTime}"/>).
    /// </summary>
    [JsonConverter(typeof(TimeConverter))]
    [Obsolete("Use EssentialsTime class instead.")]
    public class EssentialsDateTime : IComparable, IComparable<EssentialsDateTime>, IComparable<DateTime> {

        #region Properties

        /// <summary>
        /// Gets a <see cref="EssentialsDateTime"/> object that is set to the current date and time on this computer,
        /// expressed as the local time.
        /// </summary>
        public static EssentialsDateTime Now => new EssentialsDateTime(DateTime.Now);

        /// <summary>
        /// Gets the current UNIX timestamp (amount of seconds since the start of the Unix Epoch).
        /// </summary>
        public static long CurrentUnixTimestamp => TimeUtils.GetUnixTimeFromDateTime(DateTime.Now);

        /// <summary>
        /// Gets an instance of <see cref="EssentialsDateTime"/> representing the start of the Unix Epoch
        /// (AKA <c>0</c> seconds).
        /// </summary>
        public static EssentialsDateTime Zero => FromUnixTimestamp(0);

        /// <summary>
        /// Gets the current date.
        /// </summary>
        public static EssentialsDateTime Today => new EssentialsDateTime(DateTime.Today);

        /// <summary>
        /// Gets a <see cref="EssentialsDateTime"/> object that is set to the current date and time on this computer,
        /// expressed as the Coordinated Universal Time (UTC).
        /// </summary>
        public static EssentialsDateTime UtcNow => new EssentialsDateTime(DateTime.UtcNow);

        /// <summary>
        /// Gets the wrapped <see cref="DateTime"/>.
        /// </summary>
        public DateTime DateTime { get; }

        /// <summary>
        /// Returns the day-of-month part of this <see cref="EssentialsDateTime"/>. The returned value is an integer
        /// between <c>1</c> and <c>31</c>.
        /// </summary>
        public int Day => DateTime.Day;

        /// <summary>
        /// Returns the day-of-week part of this <see cref="EssentialsDateTime"/>. 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="EssentialsDateTime"/>. The returned value is an integer
        /// between <c>1</c> and <c>366</c>.
        /// </summary>
        public int DayOfYear => DateTime.DayOfYear;

        /// <summary>
        /// Gets the hour part of this <see cref="EssentialsDateTime"/>. The returned value is an integer between
        /// <c>0</c> and <c>23</c>.
        /// </summary>
        public int Hour => DateTime.Hour;

        /// <summary>
        /// Gets the kind of the underlying <see cref="DateTime"/>.
        /// </summary>
        public DateTimeKind Kind => DateTime.Kind;

        /// <summary>
        /// Gets the millisecond part of this <see cref="EssentialsDateTime"/>. The returned value is an integer between
        /// <c>0</c> and <c>999</c>.
        /// </summary>
        public int Millisecond => DateTime.Millisecond;

        /// <summary>
        /// Gets the minute part of this <see cref="EssentialsDateTime"/>. The returned value is an integer between
        /// <c>0</c> and <c>59</c>.
        /// </summary>
        public int Minute => DateTime.Minute;

        /// <summary>
        /// Gets the month part of this <see cref="EssentialsDateTime"/>. The returned value is an integer between
        /// <c>1</c> and <c>12</c>.
        /// </summary>
        public int Month => DateTime.Month;

        /// <summary>
        /// Gets the second part of this <see cref="EssentialsDateTime"/>. The returned value is an integer between
        /// <c>0</c> and <c>59</c>.
        /// </summary>
        public int Second => DateTime.Second;

        /// <summary>
        /// Gets the tick count for this <see cref="EssentialsDateTime"/>. The returned value is the number of
        /// 100-nanosecond intervals that have elapsed since <c>1/1/0001 12:00am</c>.
        /// </summary>
        public long Ticks => DateTime.Ticks;

        /// <summary>
        /// Gets the time-of-day part of this <see cref="EssentialsDateTime"/>. The returned value is a
        /// <see cref="TimeSpan"/> that indicates the time elapsed since midnight.
        /// </summary>
        public TimeSpan TimeOfDay => DateTime.TimeOfDay;

        /// <summary>
        /// Returns the year part of this <see cref="EssentialsDateTime"/>. The returned value is an integer between
        /// <c>1</c> and <c>9999</c>.
        /// </summary>
        public int Year => DateTime.Year;

        /// <summary>
        /// Gets the UNIX timestamp (amount of seconds since the start of the Unix Epoch) for this
        /// <see cref="EssentialsDateTime"/>.
        /// </summary>
        public long UnixTimestamp => TimeUtils.GetUnixTimeFromDateTime(DateTime);

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

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

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

        /// <summary>
        /// Gets the week number the ISO8601 week of this <see cref="EssentialsDateTime"/>.
        /// </summary>
        public int WeekNumber => Iso8601Utils.GetWeekNumber(DateTime);

        /// <summary>
        /// Gets a reference to an instance of <see cref="EssentialsDateWeek"/> representing the
        /// <strong>ISO 8601</strong> week of this
        /// <see cref="EssentialsDateTime"/>.
        /// </summary>
        public EssentialsDateWeek Week => new EssentialsDateWeek(DateTime);

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

        /// <summary>
        /// Gets whether the Unix timestamp of this <see cref="EssentialsDateTime"/> is <c>0</c>.
        /// </summary>
        public bool IsZero => UnixTimestamp == 0;

        /// <summary>
        /// Gets whether the Unix timestamp of this <see cref="EssentialsDateTime"/> is less than <c>0</c>.
        /// </summary>
        public bool IsNegative => UnixTimestamp < 0;

        /// <summary>
        /// Gets whether the Unix timestamp of this <see cref="EssentialsDateTime"/> is greater than <c>0</c>.
        /// </summary>
        public bool IsPositive => UnixTimestamp > 0;

        /// <summary>
        /// Gets a string representation of the instance as specified by the <strong>ISO 8601</strong> format.
        /// </summary>
        public string Iso8601 => TimeUtils.ToIso8601(this);

        /// <summary>
        /// Gets a string representation of the instance as specified by the <strong>ISO 8601</strong> format.
        /// </summary>
        [Obsolete("Use the Iso8601 property instead.")]
        public string ToIso8601 => TimeUtils.ToIso8601(this);

        /// <summary>
        /// Gets a string representation of the instance as specified by the <strong>RFC 822</strong> format.
        /// </summary>
        public string Rfc822 => TimeUtils.ToRfc822(this);<commit_msg>Added "DaySuffix" property to the "EssentialsDateTime" 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 {

    // ReSharper disable InconsistentNaming
    
    /// <summary>
    /// Class wrapping an instance of <see cref="DateTime"/> (as an alternative to using <see cref="Nullable{DateTime}"/>).
    /// </summary>
    [JsonConverter(typeof(TimeConverter))]
    [Obsolete("Use EssentialsTime class instead.")]
    public class EssentialsDateTime : IComparable, IComparable<EssentialsDateTime>, IComparable<DateTime> {

        #region Properties

        /// <summary>
        /// Gets a <see cref="EssentialsDateTime"/> object that is set to the current date and time on this computer,
        /// expressed as the local time.
        /// </summary>
        public static EssentialsDateTime Now => new EssentialsDateTime(DateTime.Now);

        /// <summary>
        /// Gets the current UNIX timestamp (amount of seconds since the start of the Unix Epoch).
        /// </summary>
        public static long CurrentUnixTimestamp => TimeUtils.GetUnixTimeFromDateTime(DateTime.Now);

        /// <summary>
        /// Gets an instance of <see cref="EssentialsDateTime"/> representing the start of the Unix Epoch
        /// (AKA <c>0</c> seconds).
        /// </summary>
        public static EssentialsDateTime Zero => FromUnixTimestamp(0);

        /// <summary>
        /// Gets the current date.
        /// </summary>
        public static EssentialsDateTime Today => new EssentialsDateTime(DateTime.Today);

        /// <summary>
        /// Gets a <see cref="EssentialsDateTime"/> object that is set to the current date and time on this computer,
        /// expressed as the Coordinated Universal Time (UTC).
        /// </summary>
        public static EssentialsDateTime UtcNow => new EssentialsDateTime(DateTime.UtcNow);

        /// <summary>
        /// Gets the wrapped <see cref="DateTime"/>.
        /// </summary>
        public DateTime DateTime { get; }

        /// <summary>
        /// Returns the day-of-month part of this <see cref="EssentialsDateTime"/>. The returned value is an integer
        /// between <c>1</c> and <c>31</c>.
        /// </summary>
        public int Day => DateTime.Day;

        /// <summary>
        /// Returns the day-of-week part of this <see cref="EssentialsDateTime"/>. 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="EssentialsDateTime"/>. The returned value is an integer
        /// between <c>1</c> and <c>366</c>.
        /// </summary>
        public int DayOfYear => DateTime.DayOfYear;

        /// <summary>
        /// Gets the hour part of this <see cref="EssentialsDateTime"/>. The returned value is an integer between
        /// <c>0</c> and <c>23</c>.
        /// </summary>
        public int Hour => DateTime.Hour;

        /// <summary>
        /// Gets the kind of the underlying <see cref="DateTime"/>.
        /// </summary>
        public DateTimeKind Kind => DateTime.Kind;

        /// <summary>
        /// Gets the millisecond part of this <see cref="EssentialsDateTime"/>. The returned value is an integer between
        /// <c>0</c> and <c>999</c>.
        /// </summary>
        public int Millisecond => DateTime.Millisecond;

        /// <summary>
        /// Gets the minute part of this <see cref="EssentialsDateTime"/>. The returned value is an integer between
        /// <c>0</c> and <c>59</c>.
        /// </summary>
        public int Minute => DateTime.Minute;

        /// <summary>
        /// Gets the month part of this <see cref="EssentialsDateTime"/>. The returned value is an integer between
        /// <c>1</c> and <c>12</c>.
        /// </summary>
        public int Month => DateTime.Month;

        /// <summary>
        /// Gets the second part of this <see cref="EssentialsDateTime"/>. The returned value is an integer between
        /// <c>0</c> and <c>59</c>.
        /// </summary>
        public int Second => DateTime.Second;

        /// <summary>
        /// Gets the tick count for this <see cref="EssentialsDateTime"/>. The returned value is the number of
        /// 100-nanosecond intervals that have elapsed since <c>1/1/0001 12:00am</c>.
        /// </summary>
        public long Ticks => DateTime.Ticks;

        /// <summary>
        /// Gets the time-of-day part of this <see cref="EssentialsDateTime"/>. The returned value is a
        /// <see cref="TimeSpan"/> that indicates the time elapsed since midnight.
        /// </summary>
        public TimeSpan TimeOfDay => DateTime.TimeOfDay;

        /// <summary>
        /// Returns the year part of this <see cref="EssentialsDateTime"/>. The returned value is an integer between
        /// <c>1</c> and <c>9999</c>.
        /// </summary>
        public int Year => DateTime.Year;

        /// <summary>
        /// Gets the UNIX timestamp (amount of seconds since the start of the Unix Epoch) for this
        /// <see cref="EssentialsDateTime"/>.
        /// </summary>
        public long UnixTimestamp => TimeUtils.GetUnixTimeFromDateTime(DateTime);

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

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

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

        /// <summary>
        /// Gets the week number the ISO8601 week of this <see cref="EssentialsDateTime"/>.
        /// </summary>
        public int WeekNumber => Iso8601Utils.GetWeekNumber(DateTime);

        /// <summary>
        /// Gets a reference to an instance of <see cref="EssentialsDateWeek"/> representing the
        /// <strong>ISO 8601</strong> week of this
        /// <see cref="EssentialsDateTime"/>.
        /// </summary>
        public EssentialsDateWeek Week => new EssentialsDateWeek(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 whether the Unix timestamp of this <see cref="EssentialsDateTime"/> is <c>0</c>.
        /// </summary>
        public bool IsZero => UnixTimestamp == 0;

        /// <summary>
        /// Gets whether the Unix timestamp of this <see cref="EssentialsDateTime"/> is less than <c>0</c>.
        /// </summary>
        public bool IsNegative => UnixTimestamp < 0;

        /// <summary>
        /// Gets whether the Unix timestamp of this <see cref="EssentialsDateTime"/> is greater than <c>0</c>.
        /// </summary>
        public bool IsPositive => UnixTimestamp > 0;

        /// <summary>
        /// Gets a string representation of the instance as specified by the <strong>ISO 8601</strong> format.
        /// </summary>
        public string Iso8601 => TimeUtils.ToIso8601(this);

        /// <summary>
        /// Gets a string representation of the instance as specified by the <strong>ISO 8601</strong> format.
        /// </summary>
        [Obsolete("Use the Iso8601 property instead.")]
        public string ToIso8601 => TimeUtils.ToIso8601(this);

        /// <summary>
        /// Gets a string representation of the instance as specified by the <strong>RFC 822</strong> format.
        /// </summary>
        public string Rfc822 => TimeUtils.ToRfc822(this);
{'fraction_non_alphanumeric': 0.1403206650831354, 'fraction_numerical': 0.013182897862232779, 'mean_word_length': 2.1071955719557196, 'pattern_counts': {'":': 0, '<': 361, '<?xml version=': 0, '>': 422, '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': '408741', 'n_tokens_mistral': 4698, 'n_tokens_neox': 4406, 'n_words': 1501}