<commit_before>//
//  NSDate+Utility.swift
//  apple
//
//  Created by <NAME> on 3/2/16.
//  Copyright © 2016 Duke Institute for Health Innovation. All rights reserved.
//

import Foundation

extension Date {
    
    // MARK: -- formatters
    
    static var ISO8601formatter: DateFormatter {
        let formatter: DateFormatter = DateFormatter()
        formatter.dateFormat = "yyyy-MM-dd'T'HH:mm:ss.SSSZZZZZ"
        formatter.locale = Locale(identifier: "en_US_POSIX")
        return formatter
    }
    static var ISO8601UTCformatter: DateFormatter {
        let formatter: DateFormatter = DateFormatter()
        formatter.dateFormat = "yyyy-MM-dd'T'HH:mm:ss.SSSZZZZZ"
        formatter.locale = Locale(identifier: "en_US_POSIX")
        formatter.timeZone = TimeZone(abbreviation: "UTC")
        return formatter
    }
    static var DefaultShortDateFormatter: DateFormatter {
        let formatter: DateFormatter = DateFormatter()
        formatter.dateFormat = "dd MMM yyyy"
        return formatter
    }
    static var DefaultTimeFormatter: DateFormatter {
        let formatter: DateFormatter = DateFormatter()
        formatter.dateFormat = "h:mm a"
        return formatter
    }
    
    func dateFromISO8601String(_ string: String) -> Date? {
        return Date.ISO8601formatter.date(from: string)
    }
    
    func ISO8601String() -> String? {
        return Date.ISO8601formatter.string(from: self)
    }
    
    func ISO8601StringUTC() -> String? {
        return Date.ISO8601UTCformatter.string(from: self)
    }
    
    func defaultTimeString() -> String? {
        return Date.DefaultTimeFormatter.string(from: self)
    }

    func defaultString() -> String? {
        return ISO8601String()
    }<commit_msg>set formatters as publicly available<commit_after>//
//  NSDate+Utility.swift
//  apple
//
//  Created by <NAME> on 3/2/16.
//  Copyright © 2016 Duke Institute for Health Innovation. All rights reserved.
//

import Foundation

extension Date {
    
    // MARK: -- formatters
    
    public static var ISO8601formatter: DateFormatter {
        let formatter: DateFormatter = DateFormatter()
        formatter.dateFormat = "yyyy-MM-dd'T'HH:mm:ss.SSSZZZZZ"
        formatter.locale = Locale(identifier: "en_US_POSIX")
        return formatter
    }
    public static var ISO8601UTCformatter: DateFormatter {
        let formatter: DateFormatter = DateFormatter()
        formatter.dateFormat = "yyyy-MM-dd'T'HH:mm:ss.SSSZZZZZ"
        formatter.locale = Locale(identifier: "en_US_POSIX")
        formatter.timeZone = TimeZone(abbreviation: "UTC")
        return formatter
    }
    public static var DefaultShortDateFormatter: DateFormatter {
        let formatter: DateFormatter = DateFormatter()
        formatter.dateFormat = "dd MMM yyyy"
        return formatter
    }
    public static var DefaultTimeFormatter: DateFormatter {
        let formatter: DateFormatter = DateFormatter()
        formatter.dateFormat = "h:mm a"
        return formatter
    }
    
    func dateFromISO8601String(_ string: String) -> Date? {
        return Date.ISO8601formatter.date(from: string)
    }
    
    func ISO8601String() -> String? {
        return Date.ISO8601formatter.string(from: self)
    }
    
    func ISO8601StringUTC() -> String? {
        return Date.ISO8601UTCformatter.string(from: self)
    }
    
    func defaultTimeString() -> String? {
        return Date.DefaultTimeFormatter.string(from: self)
    }

    func defaultString() -> String? {
        return ISO8601String()
    }
{'fraction_non_alphanumeric': 0.09691130631907056, 'fraction_numerical': 0.02493624256163219, 'mean_word_length': 2.635427394438723, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 15, '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': '5189961', 'n_tokens_mistral': 1108, 'n_tokens_neox': 1020, 'n_words': 240}