<commit_before>//
//  Date+Utils.swift
//  APExtensions
//
//  Created by <NAME> on 6/21/17.
//  Copyright © 2017 <NAME>. All rights reserved.
//

import Foundation

//-----------------------------------------------------------------------------
// MARK: - Components
//-----------------------------------------------------------------------------

public extension Date {
    public static var today: Date {
        var components = Date().components
        components.hour = 0
        components.minute = 0
        components.second = 0
        
        return Calendar.current.date(from: components)!
    }
    
    public var components: DateComponents {
        return Calendar.current.dateComponents([.year, .month, .day, .hour, .minute, .second], from: self)
    }
    
    public func isSameDay(withDate date: Date) -> Bool {
        let selfComponents = components
        let otherComponents = date.components
        
        return selfComponents.year == otherComponents.year && selfComponents.month == otherComponents.month && selfComponents.day == otherComponents.day
    }
    
    public func isToday() -> Bool {
        return self.isSameDay(withDate: Date.today)
    }
}

//-----------------------------------------------------------------------------
// MARK: - String Representation
//-----------------------------------------------------------------------------

public extension Date {
    public func getString(dateStyle: DateFormatter.Style = .short, timeStyle: DateFormatter.Style = .short, doesRelativeDateFormatting: Bool = false) -> String {
        let formatter = DateFormatter()
        formatter.dateStyle = dateStyle
        formatter.timeStyle = timeStyle
        formatter.doesRelativeDateFormatting = doesRelativeDateFormatting
        
        return formatter.string(from: self)
    }
}<commit_msg>- Var instead of func<commit_after>//
//  Date+Utils.swift
//  APExtensions
//
//  Created by <NAME> on 6/21/17.
//  Copyright © 2017 <NAME>. All rights reserved.
//

import Foundation

//-----------------------------------------------------------------------------
// MARK: - Components
//-----------------------------------------------------------------------------

public extension Date {
    public static var today: Date {
        var components = Date().components
        components.hour = 0
        components.minute = 0
        components.second = 0
        
        return Calendar.current.date(from: components)!
    }
    
    public var components: DateComponents {
        return Calendar.current.dateComponents([.year, .month, .day, .hour, .minute, .second], from: self)
    }
    
    public var isToday: Bool {
        return self.isSameDay(withDate: Date.today)
    }
    
    public func isSameDay(withDate date: Date) -> Bool {
        let selfComponents = components
        let otherComponents = date.components
        
        return selfComponents.year == otherComponents.year && selfComponents.month == otherComponents.month && selfComponents.day == otherComponents.day
    }
}

//-----------------------------------------------------------------------------
// MARK: - String Representation
//-----------------------------------------------------------------------------

public extension Date {
    public func getString(dateStyle: DateFormatter.Style = .short, timeStyle: DateFormatter.Style = .short, doesRelativeDateFormatting: Bool = false) -> String {
        let formatter = DateFormatter()
        formatter.dateStyle = dateStyle
        formatter.timeStyle = timeStyle
        formatter.doesRelativeDateFormatting = doesRelativeDateFormatting
        
        return formatter.string(from: self)
    }
}
{'fraction_non_alphanumeric': 0.2529235790046233, 'fraction_numerical': 0.006527060103345118, 'mean_word_length': 1.4684563758389262, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 12, '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': '3815082', 'n_tokens_mistral': 874, 'n_tokens_neox': 819, 'n_words': 220}