<commit_before>//
//  DateExtension.swift
//  Siren
//
//  Created by <NAME> on 3/21/17.
//  Copyright © 2017 Sabintsev iOS Projects. All rights reserved.
//

import Foundation

// `Date` Extension for Siren.
extension Date {
    /// The amount of days passed from a specific source date.
    ///
    /// - Parameter date: The source date.
    /// - Returns: The amount of days passed since the source date.
    static func days(since date: Date) -> Int {
        let calendar = Calendar.current
        let components = calendar.dateComponents([.day], from: date, to: Date())
        return components.day ?? 0
    }

    /// The amount of days passed from a specific source date string.
    ///
    /// - Parameters:
    ///   - dateString: The source date string.
    /// - Returns: The amount of days passed since the source date.
    static func days(since dateString: String) -> Int? {
        let dateformatter = DateFormatter()
        dateformatter.locale = Locale(identifier: "en_US_POSIX")
        dateformatter.dateFormat = "yyyy-MM-dd'T'HH:mm:ss'Z'"
        dateformatter.timeZone = TimeZone(secondsFromGMT: 0)
        
        guard let date = dateformatter.date(from: dateString) else {
            return nil
        }
        
        return days(since: date)
    }
}<commit_msg>Update DateExtension to remove whitespaces<commit_after>//
//  DateExtension.swift
//  Siren
//
//  Created by <NAME> on 3/21/17.
//  Copyright © 2017 Sabintsev iOS Projects. All rights reserved.
//

import Foundation

// `Date` Extension for Siren.
extension Date {
    /// The amount of days passed from a specific source date.
    ///
    /// - Parameter date: The source date.
    /// - Returns: The amount of days passed since the source date.
    static func days(since date: Date) -> Int {
        let calendar = Calendar.current
        let components = calendar.dateComponents([.day], from: date, to: Date())
        return components.day ?? 0
    }

    /// The amount of days passed from a specific source date string.
    ///
    /// - Parameters:
    ///   - dateString: The source date string.
    /// - Returns: The amount of days passed since the source date.
    static func days(since dateString: String) -> Int? {
        let dateformatter = DateFormatter()
        dateformatter.locale = Locale(identifier: "en_US_POSIX")
        dateformatter.dateFormat = "yyyy-MM-dd'T'HH:mm:ss'Z'"
        dateformatter.timeZone = TimeZone(secondsFromGMT: 0)

        guard let date = dateformatter.date(from: dateString) else {
            return nil
        }

        return days(since: date)
    }
}
{'fraction_non_alphanumeric': 0.11209213051823416, 'fraction_numerical': 0.008445297504798464, 'mean_word_length': 2.253433208489388, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 9, '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': '3089854', 'n_tokens_mistral': 765, 'n_tokens_neox': 715, 'n_words': 252}