<commit_before>//
//  DateAdapter.swift
//  WWDC
//
//  Created by <NAME> on 07/02/17.
//  Copyright © 2017 <NAME>. All rights reserved.
//

import Foundation

public let ConfCoreDateFormat = "yyyy-MM-dd'T'HH:mm:ssZZZZZ"

final class DateAdapter: Adapter {
    typealias InputType = String
    typealias OutputType = Date
    
    func adapt(_ input: String) -> Result<Date, AdapterError> {
        let formatter = DateFormatter()
        formatter.dateFormat = "yyyy-MM-dd"
        formatter.locale = Locale.current
        formatter.timeZone = TimeZone.current
        
        if let date = formatter.date(from: input) {
            return .success(date)
        } else {
            return .error(.invalidData)
        }
    }
}

final class DateTimeAdapter: Adapter {
    typealias InputType = String
    typealias OutputType = Date
    
    func adapt(_ input: String) -> Result<Date, AdapterError> {
        let formatter = DateFormatter()
        formatter.dateFormat = ConfCoreDateFormat
        formatter.locale = Locale.current
        formatter.timeZone = TimeZone.current
        
        if let date = formatter.date(from: input) {
            return .success(date)
        } else {
            return .error(.invalidData)
        }
    }<commit_msg>Fixed locale for date adapter (Closes #225)<commit_after>//
//  DateAdapter.swift
//  WWDC
//
//  Created by <NAME> on 07/02/17.
//  Copyright © 2017 <NAME>. All rights reserved.
//

import Foundation

public let ConfCoreDateFormat = "yyyy-MM-dd'T'HH:mm:ssZZZZZ"

final class DateAdapter: Adapter {
    typealias InputType = String
    typealias OutputType = Date
    
    func adapt(_ input: String) -> Result<Date, AdapterError> {
        let formatter = DateFormatter()
        formatter.dateFormat = "yyyy-MM-dd"
        formatter.locale = Locale(identifier: "en-US")
        formatter.timeZone = TimeZone.current
        
        if let date = formatter.date(from: input) {
            return .success(date)
        } else {
            return .error(.invalidData)
        }
    }
}

final class DateTimeAdapter: Adapter {
    typealias InputType = String
    typealias OutputType = Date
    
    func adapt(_ input: String) -> Result<Date, AdapterError> {
        let formatter = DateFormatter()
        formatter.dateFormat = ConfCoreDateFormat
        formatter.locale = Locale(identifier: "en-US")
        formatter.timeZone = TimeZone.current
        
        if let date = formatter.date(from: input) {
            return .success(date)
        } else {
            return .error(.invalidData)
        }
    }
{'fraction_non_alphanumeric': 0.1010061919504644, 'fraction_numerical': 0.00890092879256966, 'mean_word_length': 2.1953028430160693, 'pattern_counts': {'":': 0, '<': 11, '<?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': '6312931', 'n_tokens_mistral': 779, 'n_tokens_neox': 734, 'n_words': 190}