<commit_before>//
//  Date-Formatter.swift
//  MSSNGR
//
//  Created by <NAME> on 11/10/16.
//  Copyright © 2016 Promptus. All rights reserved.
//

import Foundation

public enum ISO8601Type: String {
  case year					= "yyyy"
  case yearMonth				= "yyyy-MM"
  case date					= "yyyy-MM-dd"
  case hourMinute             = "HH:mm"
  case time                   = "HH:mm:ss"
  case dateTime				= "yyyy-MM-dd'T'HH:mmZZZZZ"
  case full					= "yyyy-MM-dd'T'HH:mm:ssZZZZZ"
  case extended				= "yyyy-MM-dd'T'HH:mm:ss.SSSZZZZZ"
}

public struct DateFormat {
  static let Default = "yyyy-MM-dd'T'HH:mm:ss"
  static let DateTimeShort = "ddMMYYHH:mm"
  static let TimeShort = "jj:mm"
  static let DayMonth = "EEEEdMMMM"
  static let LongDateTimeFormat = "EEEdMMMM jj:mm"
  static let Date = "EEEEdMMMMYYYY"
  static let DateShort = "EEEdMM"
}

public extension Date {
  
  public static func parseISO8601String(_ isoStringDate: Any?, isoType: ISO8601Type = .full) -> Date?  {
    guard let isoString = isoStringDate as? String else { return nil }
    let formatter = CustomDateFormatter.formatter
    formatter.dateFormat = isoType.rawValue
    return formatter.date(from: isoString)
  }
  
  func toISO8601String(isoType iso8601type: ISO8601Type = .full) -> String? {<commit_msg>- mark constants as public<commit_after>//
//  Date-Formatter.swift
//  MSSNGR
//
//  Created by <NAME> on 11/10/16.
//  Copyright © 2016 Promptus. All rights reserved.
//

import Foundation

public enum ISO8601Type: String {
  case year					= "yyyy"
  case yearMonth				= "yyyy-MM"
  case date					= "yyyy-MM-dd"
  case hourMinute             = "HH:mm"
  case time                   = "HH:mm:ss"
  case dateTime				= "yyyy-MM-dd'T'HH:mmZZZZZ"
  case full					= "yyyy-MM-dd'T'HH:mm:ssZZZZZ"
  case extended				= "yyyy-MM-dd'T'HH:mm:ss.SSSZZZZZ"
}

public struct DateFormat {
  public static let Default = "yyyy-MM-dd'T'HH:mm:ss"
  public static let DateTimeShort = "ddMMYYHH:mm"
  public static let TimeShort = "jj:mm"
  public static let DayMonth = "EEEEdMMMM"
  public static let LongDateTimeFormat = "EEEdMMMM jj:mm"
  public static let Date = "EEEEdMMMMYYYY"
  public static let DateShort = "EEEdMM"
}

public extension Date {
  
  public static func parseISO8601String(_ isoStringDate: Any?, isoType: ISO8601Type = .full) -> Date?  {
    guard let isoString = isoStringDate as? String else { return nil }
    let formatter = CustomDateFormatter.formatter
    formatter.dateFormat = isoType.rawValue
    return formatter.date(from: isoString)
  }
  
  func toISO8601String(isoType iso8601type: ISO8601Type = .full) -> String? {
{'fraction_non_alphanumeric': 0.11269230769230769, 'fraction_numerical': 0.026153846153846153, 'mean_word_length': 3.12202852614897, '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': '1562801', 'n_tokens_mistral': 1024, 'n_tokens_neox': 920, 'n_words': 237}