<commit_before>﻿using System;
using Humanizer;

namespace Repack
{
    internal class Program
    {
        public static void Main(string[] args)
        {
            Console.WriteLine("Usage:   repack [date]");
            Console.WriteLine("Prints how long it is until your birthday.");
            Console.WriteLine("If you don't supply your birthday, it uses mine.");

            DateTime birthDay = GetBirthday(args);
            Console.WriteLine();

            var span = GetSpan(birthDay);

            Console.WriteLine("{0} until your birthday", span.Humanize());
        }

        private static TimeSpan GetSpan(DateTime birthDay)
        {
            if (birthDay < DateTime.Now)
            {
                if (birthDay.Year < DateTime.Now.Year)
                {
                    return GetSpan(new DateTime(DateTime.Now.Year, birthDay.Month, birthDay.Day));
                }
                else
                {
                    return GetSpan(new DateTime(DateTime.Now.Year + 1, birthDay.Month, birthDay.Day));
                }
            }
            var span = birthDay - DateTime.Now;
            return span;
        }

        private static DateTime GetBirthday(string[] args)
        {
            string day = null;
            if (args != null && args.Length > 0)
            {
                day = args[0];
            }

            return GetBirthday(day);
        }

        private static DateTime GetBirthday(string day)
        {
            DateTime parsed;
            if (DateTime.TryParse(day, out parsed))
            {
                return parsed;
            }
            else
            {
                return new DateTime(DateTime.Now.Year, 8, 20);
            }
        }
    }
}<commit_msg>Simplify the code that ensures a birthday is in the future.<commit_after>﻿using System;
using Humanizer;

namespace Repack
{
    internal class Program
    {
        public static void Main(string[] args)
        {
            Console.WriteLine("Usage:   repack [date]");
            Console.WriteLine("Prints how long it is until your birthday.");
            Console.WriteLine("If you don't supply your birthday, it uses mine.");

            DateTime birthDay = GetBirthday(args);
            Console.WriteLine();

            var span = GetSpan(birthDay);

            Console.WriteLine("{0} until your birthday", span.Humanize());
        }

        private static TimeSpan GetSpan(DateTime birthDay)
        {
            var span = birthDay - DateTime.Now;

            if (span.Days < 0)
            {
                // If the supplied birthday has already happened, then find the next one that will occur.
                int years = span.Days / -365;
                span = span.Add(TimeSpan.FromDays((years + 1) * 365));
            }

            return span;
        }

        private static DateTime GetBirthday(string[] args)
        {
            string day = null;
            if (args != null && args.Length > 0)
            {
                day = args[0];
            }

            return GetBirthday(day);
        }

        private static DateTime GetBirthday(string day)
        {
            DateTime parsed;
            if (DateTime.TryParse(day, out parsed))
            {
                return parsed;
            }
            else
            {
                return new DateTime(DateTime.Now.Year, 8, 20);
            }
        }
    }
}
{'fraction_non_alphanumeric': 0.09059131954558695, 'fraction_numerical': 0.006117098747451209, 'mean_word_length': 1.3601374570446736, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 5, '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': '5813724', 'n_tokens_mistral': 894, 'n_tokens_neox': 829, 'n_words': 240}