[
  {
    "path": ".github/FUNDING.yml",
    "content": "# These are supported funding model platforms\n\ncustom: https://www.paypal.com/paypalme2/danielemargutti\n"
  },
  {
    "path": ".gitignore",
    "content": "*~\n.DS_Store\n\n# Xcode\n#\n# gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore\n\n## Build generated\nbuild/\n.build/\nDerivedData\n\n## Various settings\n*.pbxuser\n!default.pbxuser\n*.mode1v3\n!default.mode1v3\n*.mode2v3\n!default.mode2v3\n*.perspectivev3\n!default.perspectivev3\nxcuserdata\n\n## Other\n*.xccheckout\n*.moved-aside\n*.xcuserstate\n*.xcscmblueprint\n\n## Other\n*.moved-aside\n*.xccheckout\n*.xcscmblueprint\n\n## Obj-C/Swift specific\n*.hmap\n*.ipa\n\n## Playgrounds\ntimeline.xctimeline\nplayground.xcworkspace\n\n# Swift Package Manager\n#\n# Add this line if you want to avoid checking in source code from Swift Package Manager dependencies.\n# Packages/\n.build/\n\n# Bundler\n.bundle\n\n# CocoaPods\n#\n# We recommend against adding the Pods directory to your .gitignore. However\n# you should judge for yourself, the pros and cons are mentioned at:\n# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control\n#\nPods/\n\n# Carthage\n#\n# Add this line if you want to avoid checking in source code from Carthage dependencies.\n# Carthage/Checkouts\n# Carthage/Build\nCarthage\n\n# fastlane\n#\n# It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the \n# screenshots whenever they are needed.\n# For more information about the recommended setup visit:\n# https://github.com/fastlane/fastlane/blob/master/docs/Gitignore.md\n\nfastlane/report.xml\nfastlane/screenshots\n\n.DS_\n"
  },
  {
    "path": ".sourcery/LinuxMain.stencil",
    "content": "@testable import SwiftDateTests\nimport XCTest\n\n// swiftlint:disable line_length file_length\n\n{% for type in types.classes|based:\"XCTestCase\" %}\nextension {{ type.name }} {\n    static var allTests: [(String, ({{ type.name }}) -> () throws -> Void)] = [\n    {% for method in type.methods where method.parameters.count == 0 and method.shortName|hasPrefix:\"test\" and method|!annotated:\"skipTestOnLinux\" %}    (\"{{ method.shortName }}\", {{ method.shortName }}){% if not forloop.last %},{% endif %}\n    {% endfor %}]\n}\n\n{% endfor %}\nXCTMain([\n{% for type in types.classes|based:\"XCTestCase\" %}    testCase({{ type.name }}.allTests){% if not forloop.last %},{% endif %}\n{% endfor %}])\n"
  },
  {
    "path": ".swiftlint.yml",
    "content": "disabled_rules: # rule identifiers to exclude from running\n  - line_length\n  - function_body_length\n  - cyclomatic_complexity\n  - multiple_closures_with_trailing_closure\n  - xctfail_message\n  - vertical_parameter_alignment\n  - identifier_name\n\n  # Swift 3 rules that do not make sense for Swift 2.3\n  - implicit_getter\n\nidentifier_name:\n  allowed_symbols: \"_\"\n  min_length:\n    warning: 1\n    error: 1\n  max_length:\n    warning: 60\n    error: 80\n  excluded:\n    - id\n\ntype_name:\n  allowed_symbols: \"_\"\n  max_length:\n    warning: 60\n    error: 100\n\ntype_body_length:\n  warning: 400\n  error: 500\n\nfile_length:\n  warning: 700\n  error: 800\n\nexcluded:\n  - Unit Tests/GeneratedCode\n  - Pods\n\nfunction_parameter_count:\n  warning: 7\n  error: 10\n\nlarge_tuple:\n  warning: 3\n\nopt_in_rules: # some rules are only opt-in\n  - closure_end_indentation\n  - closure_spacing\n  - syntactic_sugar\n  - redundant_nil_coalescing\n  - number_separator\n  - sorted_imports\n  - overridden_super_call\n  - object_literal\n  - explicit_init\n  - first_where\n  - operator_usage_whitespace\n\n\nnumber_separator:\n  minimum_length: 7\n\ncustom_rules:\n  double_space: # from https://github.com/IBM-Swift/Package-Builder\n    include: \"*.swift\"\n    name: \"Double space\"\n    regex: '([a-z,A-Z] \\s+)'\n    message: \"Double space between keywords\"\n    match_kinds: keyword\n    severity: warning\n  comments_space: # from https://github.com/brandenr/swiftlintconfig\n    name: \"Space After Comment\"\n    regex: '(^ *//\\w+)'\n    message: \"There should be a space after //\"\n    severity: warning\n  empty_line_after_guard: # from https://github.com/brandenr/swiftlintconfig\n    name: \"Empty Line After Guard\"\n    regex: '(^ *guard[ a-zA-Z0-9=?.\\(\\),><!]*\\{[ a-zA-Z0-9=?.\\(\\),><!]*\\}\\n *(?!(?:return|guard))\\S+)'\n    message: \"There should be an empty line after a guard\"\n    severity: warning\n  unnecessary_type: # from https://github.com/brandenr/swiftlintconfig\n    name: \"Unnecessary Type\"\n    regex: '[ a-zA-Z0-9]*(?:let|var) [ a-zA-Z0-9]*: ([a-zA-Z0-9]*)[ ]*= \\1'\n    message: \"Type Definition Not Needed\"\n    severity: warning\n"
  },
  {
    "path": ".swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<Workspace\n   version = \"1.0\">\n   <FileRef\n      location = \"self:\">\n   </FileRef>\n</Workspace>\n"
  },
  {
    "path": ".travis.yml",
    "content": "language: objective-c\nosx_image: xcode10.2\n\nenv:\n  global:\n  - LC_CTYPE=en_US.UTF-8\n  - LANG=en_US.UTF-8\n  - PROJECT=SwiftDate.xcodeproj\n  - IOS_FRAMEWORK_SCHEME=\"SwiftDate-iOS\"\n  - MACOS_FRAMEWORK_SCHEME=\"SwiftDate-macOS\"\n  - TVOS_FRAMEWORK_SCHEME=\"SwiftDate-tvOS\"\n  - WATCHOS_FRAMEWORK_SCHEME=\"SwiftDate-watchOS\"\n  matrix:\n    - DESTINATION=\"OS=12.2,name=iPhone X\"          SCHEME=\"$IOS_FRAMEWORK_SCHEME\"\n    - DESTINATION=\"OS=12.2,name=Apple TV 4K\"       SCHEME=\"$TVOS_FRAMEWORK_SCHEME\"\n    - DESTINATION=\"arch=x86_64\"                    SCHEME=\"$MACOS_FRAMEWORK_SCHEME\"\n\nscript:\n  # Ensures that the return code from xcodebuild is passed along to xcpretty\n  - set -o pipefail\n  \n  # Runs the tests in Debug and Release configurations | xcpretty\n  - xcodebuild -project \"$PROJECT\" -scheme \"$SCHEME\" -destination \"$DESTINATION\" -configuration Debug ONLY_ACTIVE_ARCH=NO ENABLE_TESTABILITY=YES test | xcpretty\n  - xcodebuild -project \"$PROJECT\" -scheme \"$SCHEME\" -destination \"$DESTINATION\" -configuration Release ONLY_ACTIVE_ARCH=NO ENABLE_TESTABILITY=YES test | xcpretty"
  },
  {
    "path": "Configs/SwiftDate.plist",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n<plist version=\"1.0\">\n<dict>\n\t<key>CFBundleDevelopmentRegion</key>\n\t<string>en</string>\n\t<key>CFBundleExecutable</key>\n\t<string>$(EXECUTABLE_NAME)</string>\n\t<key>CFBundleIdentifier</key>\n\t<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>\n\t<key>CFBundleInfoDictionaryVersion</key>\n\t<string>6.0</string>\n\t<key>CFBundleName</key>\n\t<string>$(PRODUCT_NAME)</string>\n\t<key>CFBundlePackageType</key>\n\t<string>FMWK</string>\n\t<key>CFBundleShortVersionString</key>\n\t<string>$(MARKETING_VERSION)</string>\n\t<key>CFBundleSignature</key>\n\t<string>????</string>\n\t<key>CFBundleVersion</key>\n\t<string>$(CURRENT_PROJECT_VERSION)</string>\n\t<key>NSHumanReadableCopyright</key>\n\t<string>Copyright © 2018 Daniele Margutti. All rights reserved.</string>\n\t<key>NSPrincipalClass</key>\n\t<string></string>\n</dict>\n</plist>\n"
  },
  {
    "path": "Configs/SwiftDateTests.plist",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n<plist version=\"1.0\">\n<dict>\n\t<key>CFBundleDevelopmentRegion</key>\n\t<string>en</string>\n\t<key>CFBundleExecutable</key>\n\t<string>$(EXECUTABLE_NAME)</string>\n\t<key>CFBundleIdentifier</key>\n\t<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>\n\t<key>CFBundleInfoDictionaryVersion</key>\n\t<string>6.0</string>\n\t<key>CFBundleName</key>\n\t<string>$(PRODUCT_NAME)</string>\n\t<key>CFBundlePackageType</key>\n\t<string>BNDL</string>\n\t<key>CFBundleShortVersionString</key>\n\t<string>1.0</string>\n\t<key>CFBundleSignature</key>\n\t<string>????</string>\n\t<key>CFBundleVersion</key>\n\t<string>1</string>\n</dict>\n</plist>\n"
  },
  {
    "path": "Documentation/0.Informations.md",
    "content": "![](./SwiftDateArt.png)\n\n<a name=\"introduction\"/>\n\n- [**Index**: Table Of Contents](#Index.md)\n- [**Next Chapter**: Introduction](#1.Introduction.md)\n\n## Info & Install\n\n- [Methods Documentation](0.Informations.md#methods)\n- [Unit Tests](0.Informations.md#unittest)\n- [Linux Compatibility](0.Informations.md#linux)\n- [Future Plans  (ToDo List)](0.Informations.md#futureplans)\n- [Communication](0.Informations.md#communication)\n- [Requirements](0.Informations.md#compatibility)\n- [Installation (CocoaPods,Carthage,SwiftPM](0.Informations.md#installation)\n- [License](0.Informations.md#license)\n\n<a name=\"methods\"/>\n\n## Methods Documentation\nAll methods and variables have been documented and are available for option+click inspection, just like the SDK classes. This includes an explanation of the methods as well as what their input and output parameters are for. Please raise an issue if you ever feel documentation is confusing or misleading and we will get it fixed up!\n\n<a name=\"unittest\"/>\n\n## Unit Tests\nUnit tests were performed on all the major classes in the library for quality assurance.\nYou can find theses under the \"Tests\" folder at the top of the library.\n\nCurrently SwiftDate has ~90$ of code coverage. \n\nIf you ever find a test case that is incomplete, please open an issue so we can get it fixed.\n\n<a name=\"futureplans\"/>\n\n<a name=\"linux\"/>\n\n## Linux Compatibility\n\nSince SwiftDate 5.0.13 the package compile successfully on Linux environment with the latest Swift 4.2 snapshot.\nHowever there is potential issue with Calendar's compare to granularity method; to know more follow the [issue #596](https://github.com/malcommac/SwiftDate/issues/568) and the radar posted on Swift's group [SR-9101](https://bugs.swift.org/browse/SR-9101).\nLast Update: 2018-10-28\n\n## Future Plans (ToDo List)\n\nCurrent plans for 5.5 are:\n\n- [x] 100% Code Coverage\n- [x] Support for Recurrences support (rrule)\n\nAny other suggestion is welcomed!\n\n<a name=\"compatibility\"/>\n\n## Requirements\n\nSwiftDate 5.x is compatible with Swift 4.x+ and the following platforms:\n\n- iOS 9+\n- macOS 10.10+\n- watchOS 2.0+\n- tvOS 10.0+\n- any Linux platform which supports Swift 4+\n\n<a name=\"communication\"/>\n\n## Communication\n\n- If you **need help**, use [Stack Overflow](http://stackoverflow.com/questions/tagged/swiftdate). (Tag 'swiftdate')\n- If you'd like to **ask a general question**, use [Stack Overflow](http://stackoverflow.com/questions/tagged/swiftdate).\n- If you **found a bug**, open an issue.\n- If you **have a feature request**, open an issue.\n- If you **want to contribute**, submit a pull request.\n\n<a name=\"installation\"/>\n\n## Installation\n\n### CocoaPods\n\n[CocoaPods](http://cocoapods.org) is a dependency manager for Cocoa projects. You can install it with the following command:\n\n```bash\n$ gem install cocoapods\n```\n\n> CocoaPods 1.1+ is required to build SwiftDate.\n\nTo integrate SwiftDate into your Xcode project using CocoaPods, specify it in your `Podfile`:\n\n```ruby\nsource 'https://github.com/CocoaPods/Specs.git'\nplatform :ios, '10.0'\nuse_frameworks!\n\ntarget '<Your Target Name>' do\npod 'SwiftDate', '~> 5.0'\nend\n```\n\nThen, run the following command:\n\n```bash\n$ pod install\n```\n\n### Carthage\n\n[Carthage](https://github.com/Carthage/Carthage) is a decentralized dependency manager that builds your dependencies and provides you with binary frameworks.\n\nYou can install Carthage with [Homebrew](http://brew.sh/) using the following command:\n\n```bash\n$ brew update\n$ brew install carthage\n```\n\nTo integrate SwiftDate into your Xcode project using Carthage, specify it in your `Cartfile`:\n\n```ogdl\ngithub \"malcommac/SwiftDate\" ~> 6.0\n```\n\nRun `carthage update` to build the framework and drag the built `SwiftDate.framework` into your Xcode project.\n\n### Swift Package Manager\n\nThe [Swift Package Manager](https://swift.org/package-manager/) is a tool for automating the distribution of Swift code and is integrated into the `swift` compiler. It is in early development, but SwiftDate does support its use on supported platforms. \n\nOnce you have your Swift package set up, adding SwiftDate as a dependency is as easy as adding it to the `dependencies` value of your `Package.swift`.\n\n```swift\ndependencies: [\n.package(url: \"https://github.com/malcommac/SwiftDate.git\", from: \"5.0.0\")\n]\n```\n\n<a name=\"license\"/>\n\n## License\n\nSwiftDate is released under the MIT license.\n\nThe MIT License (MIT)\n\nCopyright (c) 2018 Daniele Margutti\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n\n\n"
  },
  {
    "path": "Documentation/1.Introduction.md",
    "content": "![](./SwiftDate.png)\n\n<a name=\"introduction\"/>\n\n- [**Index**: Table Of Contents](#Index.md)\n- [**Prev Chapter**: Informations](#0.Informations.md)\n- [**Next Chapter**: Parsing Dates](#2.Parsing_Dates.md)\n\n## Introduction to SwiftDate\n\n- [1.0 - Dates & Cocoa](1.Introduction.md#datesandcocoa)\n- [1.1 - Region & DateInRegion](1.Introduction.md#region_dateinregion)\n- [1.2 - The Default Region](1.Introduction.md#default_region)\n- [1.3 - Create Region](1.Introduction.md#creating_region)\n- [1.4 - Create DateInRegion](1.Introduction.md#creating_dateinregion)\n\t- [1.4.1 - From String](1.Introduction.md#initfromstring)\n\t- [1.4.2 - From Date Components](1.Introduction.md#initfromcomponents)\n\t- [1.4.3 - From TimeInterval](1.Introduction.md#initfromtimeinterval)\n\t- [1.4.4 - From Date](1.Introduction.md#initfromplaindate)\n\n<a name=\"datesandcocoa\"/>\n\n## 1.0 - Dates & Cocoa\n\nGenerally when you talk about dates you are brought to think about a particular instance of time in a particular location of the world. However, in order to get a fully generic implementation Apple made `Date` fully independent from any particular geographic location, calendar or locale.\n\nA plain `Date` object just represent an absolute value: in fact it count the number of seconds elapsed since January 1, 2001.\n\nThis is what we call **Universal Time because it represent the same moment everywhere around the world**.\n\nYou can see absolute time as the moment that someone in the USA has a telephone conversation with someone in Dubai; both have that conversation at the same moment (the absolute time) but the local time will be different due to time zones, different calendars, alphabets or notation methods.\n\n```swift\nlet now = Date()\nprint(\"\\(now.timeIntervalSinceReferenceDate) seconds elapsed since Jan 1, 2001 @ 00:00 UTC\")\n```\n\nHowever, we often need to represent a date in a more specific context: **a particular place in the world, printing them using the rules of a specified locale and more**.\n\nIn order to accomplish it we need to introduce several other objects: a `Calendar`, a `TimeZone` and a `Locale`; combining these attributes we're finally ready to provide a **representation** of the date into the real world.\n\nSwiftDate allows you to parse, create, manipulate and inspect dates in an easy and more natural way than Cocoa itself.\n\n[^ Top](#introduction)\n\n<a name=\"region_dateinregion\"/>\n\n## 1.1 - Region & DateInRegion\n\nIn order to simplify the date management in a specific context SwiftDate introduces two simple structs:\n\n- `Region` is a struct which define a region in the world (`TimeZone`) a language (`Locale`) and reference calendar (`Calendar`).\n- `DateInRegion` represent an absolute date in a specific region. When you work with this object all components are evaluated in the context of the region in which the object was created. Inside a DateInRegion you will have an `absoluteDate` and `region` properties.\n\n<a name=\"default_region\"/>\n\n[^ Top](#introduction)\n\n## 1.2 - The Default Region\n\nIn SwiftDate you can work both with `DateInRegion` and `Date` instances.\nEven plain Date objects uses `Region` when you need to extract time units, compare dates or evaluate specific operations.\n\nHowever this is a special region called **Default Region** and - by default - it has the following attributes:\n\n- **Time Zone** = GMT - this allows to keep a coerent behaviour with the default Date managment unless you change it.\n- **Calendar** = current's device calendar (auto updating)\n- **Locale** = current's device locale (auto updating)\n\nWhile it's a good choice to always uses `DateInRegion` you can also work with `Date` by changing the default region as follow:\n\n```swift\nlet rome = Region(calendar: Calendars.gregorian, zone: Zones.europeRome, locale: Locales.italian)\nSwiftDate.defaultRegion = rome\n```\nSince now all `Date` instances uses `rome` as default region both for parsing and evaluating date components:\n\n```swift\nlet dateInRome = \"2018-01-01 00:00:00\".toDate()!\nprint(\"Current year is \\(dateInRome.year) and hour is \\(dateInRome.hour)\") // \"Current year is 2018 and hour is 0\\n\"\n```\n\nWe can still convert this date to the default absolute representation in UTC using the `convertTo(region:)` function:\n\n```swift\nlet dateInUTC = dateInRome.convertTo(region: Region.UTC)\nprint(\"Current year is \\(dateInUTC.year) and hour is \\(dateInUTC.hour)\") // \"Current year is 2017 and hour is 23\\n\"\n```\n\nBe careful while setting the default region.\nWe still reccomends to use the `DateInRegion` instances instead, this allows you to read the region explicitly. \n\n<a name=\"creating_region\"/>\n\n[^ Top](#introduction)\n\n## 1.3 - Create Region\n\nAs you seen from previous example creating a new `Region` is pretty straightforward; you need to specify the locale (used to print localized values like month or weekday name of the date), a timezone and a calendar (usually gregorian).\n\nRegion instances accept the following parameters in form of protocols:\n\n- Time zone as `ZoneConvertible` conform object. You can pass both a `TimeZone` instance or any of the predefined timezones region defined inside the `Zones` enumeration.\n- Calendar as `CalendarConvertible` conform object. You can pass both a `Calendar` instance or any of the predefined calendars available inside the `Calendars` enumeration.\n- Locale as `LocaleConvertible` conform object. You can pass a both a `Locale` instance or any of the predefined locales available inside the `Locales` enumeration.\n\nUsing `Zones`, `Calendars` and `Locales` enumeration values is the easiest way to create a region and compiler can also suggest you the best match for your search.\n\nThe following example create two regions with different attributes:\n\n```swift\nlet regionNY = Region(calendar: Calendars.gregorian, zone: Zones.americaNewYork, locale: Locales.englishUnitedStates)\nlet regionTokyo = Region(calendar: Calendars.gregorian, zone: Zones.asiaTokyo, locale: Locales.japanese)\n```\n<a name=\"creating_dateinregion\"/>\n\n[^ Top](#introduction)\n\n## 1.4 - Create DateInRegion\nNow you are ready to create a new `DateInRegion`. There are many different ways to create a new date: parsing a string, setting time components, derivating it from another date or from a given time intervals.\n\nEach initialization method require a region parameter which defines the region in which the date is expressed (default values may vary based upon the init and are listed below).\n\n<a name=\"initfromstring\"/>\n\n### 1.4.1 - From String\nThe most common case is to parse a string and transform it to a date. As you know `DateFormatter` is an expensive object to create and if you need to parse multiple strings you should avoid creating a new instance in your loop.\nDon't worry: using SwiftDate the library helps you by reusing its own parser, shared along the caller thread.\n\n`DateInRegion`'s `init(_:format:region)` can be used to initialize a new date from a string (various shortcut are available under the `toXXX` prefix of `String` extensions.\n\nThis object takes three parameters:\n\n- the `string` to parse (`String`)\n- the format of the string (`String`): this represent the format in which the string is expressed. It's a unicode format ([See the table of fields](7.Format_UnicodeTable.md)). If you skip this parameter SwiftDate attempts to parse the date using one of the built-in formats defined in `SwiftDate.autoFormats` array. If you know the format of the date you should explicitly set it in order to get better performances.\n-  the `region` in which the date is expressed (`Region`). By default is set to `SwiftDate.defaultRegion`.\n\n```swift\nlet date1 = DateInRegion(\"2016-01-05\", format: \"yyyy-MM-dd\", region: regionNY)\nlet date2 = DateInRegion(\"2015-09-24T13:20:55\", region: regionNY)\n```\n<a name=\"initfromcomponents\"/>\n\n### 1.4.2 - From Components\nYou can create a `DateInRegion` also by setting the date components.\nThe following method create a date from `DateComponents` instance passed via builder pattern:\n\n```swift\nlet date3 = DateInRegion(components: {\n\t$0.year = 2018\n\t$0.month = 2\n\t$0.day = 1\n\t$0.hour = 23\n}, region: regionNY)\n```\n\nYou can also instance it by passing single (optional) components:\n\n```swift\nlet date4 = DateInRegion(year: 2015, month: 2, day: 4, hour: 20, minute: 00, second: 00, region: regionNY)\n```\n<a name=\"initfromtimeinterval\"/>\n\n### 1.4.3 - From TimeInterval\nAs plain `Date` you can create a new `DateInRegion` just passing an absolute time interval which represent the seconds/milliseconds from Unix epoch.\nThe following method create a date 1 year after the Unix Epoch (1971-01-01T00:00:00Z):\n\n```swift\nlet date5 = DateInRegion(seconds: 1.years.timeInterval, region: regionNY)\nlet date6 = DateInRegion(milliseconds: 5000, region: regionNY)\n```\n\n<a name=\"initfromplaindate\"/>\n\n### 1.4.4 - From Date\nFinally you can init a new `DateInRegion` directly specifyng an absolute `Date` and a destination region:\n\n```swift\nlet absoluteDate: Date = (Date() - 2.months).dateAt(.startOfDay)\nlet date7 = DateInRegion(absoluteDate, region: regionNY)\n```\n\n[^ Top](#introduction)\n\n-- \n\n- [**Index**: Table Of Contents](#Index.md)\n- [**Next Chapter**: Parsing Dates](#2.Parsing_Dates.md)\n"
  },
  {
    "path": "Documentation/10.Upgrading_SwiftDate4.md",
    "content": "![](./SwiftDate.png)\n\n<a name=\"index\"/>\n\n- [**Index**: Table Of Contents](#Index.md)\n\n### → [Searching for old SwiftDate 4 builds?](https://github.com/malcommac/SwiftDate/milestones)\n\n## Old Versions\n- for **Swift 3.x**: Latest compatible version is 4.3.0 [Download here](https://github.com/malcommac/SwiftDate/releases/tag/4.3.0). If you are using CocoaPods be sure to fix the release (`pod 'SwiftDate', '~> 4.3.0'`)\n \n## Upgrading from Swift 4.x\nSwiftDate 5.x is a complete rewrite of the library. While it introduces several new features a great part of the work is about a consistent naming of the functions: some was renamed while deprecated ones was removed.\n\n**If you miss a features or you are interested in a new one create a new Issue.**\n\n### Important Note about Default Region\nIn SwiftDate 4.x the default region is automatically set to local region, where all attributes are set automatically to the current device's locale, timezone and calendar.\n\n**Since SwiftDate 5, in order to be more comply with `Date`'s default behaviour, the default region's timezone is set to GMT+0 (UTC)**.\n\nIf you want to restore the old behaviour just set it to `Region.local` just after the launch of the app.\n\n```swift\nfunc application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {\n\tSwiftDate.defaultRegion = Region.local // set region to local device attributes\n\t// ... do something else\n\treturn true\n}\n```\n\n### Added/Removed/Replaced Methods\n- `Date.defaultRegion` was renamed to `SwiftDate.defaultRegion` and you can both read and set it.\n- `Date.setDefaultRegion(:)` was removed; use `SwiftDate.defaultRegion`'s setter.\n- `TimeZoneName` is now `Zones` and its conform to the new `ZonesConvertible` protocol. All parameters (like `Region` inits function) takes now a generic `ZonesConvertible` instance: this mean you can pass one of the enum values of the zone or just an instance of `TimeZone` object (or you can conform your own class to it).\n- `CalendarName` is now `Calendars` and its conform to the new `CalendarConvertible` protocol. All parameters (like `Region` inits function) takes now a generic `CalendarConvertible ` instance: this mean you can pass one of the enum values of the zone or just an instance of `Calendar` object (or you can conform your own class to it).\n- `LocaleName` is now `Locales` and its conform to the new `LocaleConvertible` protocol. All parameters (like `Region` inits function) takes now a generic `LocaleConvertible ` instance: this mean you can pass one of the enum values of the zone or just an instance of `Calendar` object (or you can conform your own class to it).\n- `Date/DateInRegion`: `isBetween()` function was renamed `isInRange()`\n- `Date/DateInRegion`: `isAfter()` was renamed to `isAfterDate()`\n- `Date/DateInRegion`: `isBefore()` was renamed to `isBeforeDate()`\n- `String` extension methods `date(format:fromRegion)` and `date(formats:fromRegion)` are now replaced by `toDate(_:region)` (while similar shortcuts methods are added to parse common formats: `toISODate()`, `toDotNETDate()`, `toRSSDate()` and `toSQLDate()`.\n- Removed `Int` extension `second,minute,hour,day,week,month,year` due to inconsistencies (use plural versions `seconds,minutes` etc.\n- Related dates generation is now grouped under the `dateAt()` function as enum list. Therefore `nextWeekend`, `previo\n- `DateInRegion`: `roundedAt()` is now replaced by `dateRoundedAt()` which now compacts paramters in a single enum.\n- `DateInRegion`: `startOf()` and `endOf()` are now replaced by `dateAtStartOf()` and `dateAtEndOf()`and include support for both single and multiple units.\n- `DateInRegion`: `atTime()` is now replaced by `dateBySet(hour:min:secs:options)`\n- `DateInRegion`: `DateInRegion`'s static `distantFuture()` and `distantPast` are now `future()` and `past()`\n- `DateInRegion`:`next(day:)` is now part of the `dateAt()` function with enum `.weekday(_)`.\n- `DateInRegion`: `add(components:)` is now replaced by `dateByAdding(_:_:)`\n- `DateInRegion`: `at(unit:value:)` and `at(values:keep:)` are now replaced by `dateBySet()`.\n- `nextDSTTransitionDate` property is now part of the enum of `dateAt()`\n- `recentDate()` and `oldestDate()` are now called `newestIn()` and `oldestIn()`\n- `TimeInterval` Extension: `in(_:toDate:of:)` is now replaced by `toUnits(_:from:)` and `toUnit(_:from:)`\n- `TimeInterval` Extension: `string()` is now replaced by `toString()`\n- `DateTimeInterval` class is now replaced by `TimePeriod` class and its descendants\n- `DateInRegion`: `dates(between:and:increment:)` to enumerate dates is now replaced by `enumerateDates(from:to:increment:)`\n- `DateInRegion`: colloquial formatter `colloquial(toDate:options:)` is now replaced by `toRelative(since:style:locale:)`\n- Formatting method `iso8601()` is now `toISO8601()` and other methods `to..()` was added to simplify formatting task.\n- `Date/DateInRegion`: Introduced `compareCloseTo()` to compare two dates against a precision value.\n- Added several shortcut methods as extensions of `String` to parse dates: `toISODate()`, `toDotNETDate()`, `toRSSDate()` and `toSQLDate()`.\n- Comparison methods are now grouped by `compare()` function and a list of all available enums.\n\n-- \n\n[**Index**: Table Of Contents](#Index.md)\n"
  },
  {
    "path": "Documentation/11.Related_Projects.md",
    "content": "![](./SwiftDate.png)\n\n<a name=\"index\"/>\n\n- [**Index**: Table Of Contents](#Index.md)\n\n## Related Projects\nI'm also working on several other projects you may like.\nTake a look below:\n\n<p align=\"center\" >\n\n| Library         | Description                                      |\n|-----------------|--------------------------------------------------|\n| [**SwiftDate**](https://github.com/malcommac/SwiftDate)       | The best way to manage date/timezones in Swift   |\n| [**Hydra**](https://github.com/malcommac/Hydra)           | Write better async code: async/await & promises  |\n| [**FlowKit**](https://github.com/malcommac/FlowKit) | A new declarative approach to table managment. Forget datasource & delegates. |\n| [**SwiftRichString**](https://github.com/malcommac/SwiftRichString) | Elegant & Painless NSAttributedString in Swift   |\n| [**SwiftLocation**](https://github.com/malcommac/SwiftLocation)   | Efficient location manager                       |\n| [**SwiftMsgPack**](https://github.com/malcommac/SwiftMsgPack)    | Fast/efficient msgPack encoder/decoder           |\n</p>\n"
  },
  {
    "path": "Documentation/12.Timer_Periods.md",
    "content": "![](./SwiftDate.png)\n\n<a name=\"index\"/>\n\n- [**Index**: Table Of Contents](#Index.md)\n\n## Time Periods\n\n*NOTE: The following documentation and part of the implementation is heavely inspired by the original work of Matthew York with its [DateTools](https://github.com/MatthewYork/DateTools/) project.*\n\nDates are important, but the real world is a little less discrete than that. Life is made up of spans of time, like an afternoon appointment or a weeklong vacation. In DateTools, time periods are represented by the TimePeriod class and come with a suite of initializaiton, manipulation, and comparison methods to make working with them a breeze.\n\nTime periods consist of a Date start date and end date.\n\n```swift\nlet toDate = DateInRegion().dateAtStartOf(.day) // now at 00:00\nlet fromDate = toDate - 3.days // 3 days ago at 00:00\nlet period = TimePeriod(start: fromDate , end: toDate)\n```\n\nor, if you would like to create a time period of a known length that starts or ends at a certain time, try out a few other init methods.\n\nThe method below, for example, creates a time period starting at the current time that is exactly 3 days long.\n\n```swift\nlet _ = TimePeriod(start: DateInRegion(), duration: 3.days)\n```\n\n## Time Period Info\n\nA host of methods have been extended to give information about an instance of TimePeriod:\n\n- `hasFiniteRange` - true if period has both start and end date\n- `hasStart`/`hasEnd` - true if period has start/end date\n- `isMoment()` - Returns true if the period has the same start and end date or the difference is between a defined range.\n- `durationIn()` - Returns the length of the time period in the requested unit/s\n\n## Manipulation\n\nTime periods may also be manipulated. They may be shifted earlier or later as well as expanded and contracted.\n\n### Shifting\n\nWhen a time period is shifted, the start dates and end dates are both moved earlier or later by the amounts requested. To shift a time period earlier, call `. p.shifted(by:)` function with positive or negative components to shift earlier or later in time.\n\n```swift\n// Create a time period at the start of the current week and end at the end of the week\nlet fromDate = DateInRegion().dateAtStartOf([.weekOfYear,.day])\nlet toDate = fromDate.dateAtEndOf([.weekOfMonth,.day])\nlet thisWeek = TimePeriod(start: fromDate, end: toDate)\n\n// Shift the period by 7 days in the future\nlet shiftedByOneWeek = thisWeek.shifted(by: 7.days)\n```\n\n\n### Lengthening/Shortening\n\nWhen a time periods is lengthened or shortened, it does so anchoring one date of the time period and then changing the other one. There is also an option to anchor the centerpoint of the time period, changing both the start and end dates.\n\nAn example of lengthening a time period is shown below:\n\n```swift\nlet oneMinutePeriod = TimePeriod(end: DateInRegion(), duration: 1.minutes)\nlet lengthed = oneMinutePeriod.lengthened(by: 1.minutes.timeInterval, at: .end)\n```\n\nThis doubles a time period of duration 1 minute to duration 2 minutes. The end date of \"now\" is retained and only the start date is shifted 1 minute earlier.\n\n### Relationships\n\nThere may come a need, say when you are making a scheduling app, when it might be good to know how two time periods relate to one another. Are they the same? Is one inside of another? All these questions may be asked using the relationship methods of TimePeriod.\n\nBelow is a chart of all the possible relationships between two time periods: \n\n![](TimePeriodRelations.png)\n\nA suite of methods have been extended to check for the basic relationships.\nThey are listed below:\n\n- `isEqualToPeriod`\n- `isInside`\n- `contains`\n- `overlapsWith`\n- `intersects`\n\nYou can also check for the official relationship (like those shown in the chart) with the following method:\n\n```swift\nlet relationship = periodA.relation(to: periodB)\n```\n\nThis function returns the right value from `TimePeriodRelation` enum.\n\n## Time Period Groups\n\nTime period groups are the final abstraction of date and time.\nHere, time periods are gathered and organized into something useful.\n\nThere are two main types of time period groups, `TimePeriodCollection` and `TimePeriodChain`. At a high level, think about a collection as a loose group where overlaps may occur and a chain a more linear, tight group where overlaps are not allowed.\n\nBoth collections and chains operate like an array. You may add, insert and remove `TimePeriod` objects from them just as you would objects in an array.\n\nThe difference is how these periods are handled under the hood.\n\n### Time Period Collections\n\nTime period collections serve as loose sets of time periods. They are unorganized unless you decide to sort them, and have their own characteristics like a StartDate and EndDate that are extrapolated from the time periods within. Time period collections allow overlaps within their set of time periods.\n\n![](TimePeriodCollection.png)\n\nTo make a new collection, call the class method like so:\n\n```swift\n// Create collection\nlet collection = TimePeriodCollection()\n\t\t\n// Create a few time periods\nlet firstPeriod = TimePeriod(start: \"2014-11-05 18:15:12\".toDate()!, end: \"2015-11-05 18:20:12\".toDate()!)\nlet secondPeriod = TimePeriod(start: \"2014-11-05 18:30:12\".toDate()!, end: \"2015-11-05 18:35:12\".toDate()!)\ncollection.append([firstPeriod,secondPeriod])\n```\n\nSorting Sorting time periods in a collection is easy, just call one of the sort methods.\nSorting can take in place (by modifying the original collection) or can return a derivated collection.\nYou can therefore use:\n\n-  `sorted(by type: SortType)`: to return a collection with sorted items\n- `sort(by type: SortType)`: to modify the collection in place\n\nboth of these methods takes a `SortType` enum which defines the type of sorting you can apply:\n\n- `start(_: SortMode)`: sort by start date (`SortMode` can be `.ascending` or `.descending`)\n- `end(_: SortMode)`: sort by end date (`SortMode` can be `.ascending` or `.descending`)\n- `duration(_: SortMode)`: sort by duration (`SortMode` can be `.ascending` or `.descending`)\n- `custom(_: ((TimePeriodProtocol, TimePeriodProtocol) -> Bool))`: sort using custom function\n\nOperations It is also possible to check an Date's or TimePeriod's relationship to the collection.\n\nFor instance, if you would like to see all the time periods that intersect with a certain date, you can call the periodsIntersectedByDate: method. The result is a new TimePeriodCollection with all those periods that intersect the provided date. There are a host of other methods to try out as well, including a full equality check between two collections.\n\n![](TimePeriodCollectionOperations.png)\n\n### Time Period Chains\n\nTime period chains serve as a tightly coupled set of time periods.\nThey are always organized by start and end date, and have their own characteristics like a `start` and `end` that are extrapolated from the time periods within.\nTime period chains do not allow overlaps within their set of time periods.\nThis type of group is ideal for modelling schedules like sequential meetings or appointments.\n\n![](TimePeriodChain.png)\n\nTo make a new chain, call the class method like so:\n\n\n```swift\n\n```\n\nAny time a date is added to the time chain, it retains its duration, but is modified to have its StartDate be the same as the latest period in the chain's EndDate. This helps keep the tightly coupled structure of the chain's time periods. Inserts (besides those at index 0) shift dates after insertion index by the duration of the new time period while leaving those at indexes before untouched. Insertions at index 0 shift the start date of the collection by the duration of the new time period. A full list of operations can be seen below.\n\n**Operations**\nLike collections, chains have an equality check and the ability to be shifted earlier and later. Here is a short list of other operations.\n\n![TimePeriodChainOperations](TimePeriodChainOperations.png)\n"
  },
  {
    "path": "Documentation/2.Date_Parsing.md",
    "content": "![](./SwiftDate.png)\n\n<a name=\"index\"/>\n\n- [**Index**: Table Of Contents](#Index.md)\n- [**Prev Chapter**: Introduction to SwiftDate](#1.Introduction.md)\n- [**Next Chapter**: Manipulate & Derivate Dates](#3.Manipulate_Date.md)\n\n## Date Parsing\n\n- [2.0 - Parse Custom Format](2.Date_Parsing.md#autoparsing)\n- [2.1 - Parse ISO8601](2.Date_Parsing.md#iso8601)\n- [2.2 - Parse .NET](2.Date_Parsing.md#dotnet)\n- [2.3 - Parse RSS & AltRSS](2.Date_Parsing.md#rssaltrss)\n- [2.4 - Parse SQL](2.Date_Parsing.md#sql)\n\nRelated documents:\n\n- [Unicode Format for Strings](7.Format_UnicodeTable.md)\n\nParsing dates is pretty straighforward in SwiftDate; library can parse strings with dates automatically by recognizing one of the most common patterns. Moreover you can provide your own formats or use one of the built-in parsers.\nIn the following chapter you will learn how to transform a string to a date.\n\n<a name=\"autoparsing\"/>\n\n## 2.0 - Parse Custom Format\n\nThe easiest way to transform an input string to a valid date is to use one of the `.toDate()` functions available as `String`'s instance extensions. The purpose of these method is to get the best format can represent the input string and use it to generate a valid `DateInRegion`.\n\nAs like other libs like moment.js, SwiftDate has a list of built-in formats it can use in order to obtain valid results.\nYou can get the list of these formats by calling `SwiftDate.autoFormats`.\nThe order of this array is important because SwiftDate iterates over this list until a valid date is returned (the order itself allows the lib to reduce the list of false positives).\n\nYou can alter this list by adding/removing or replacing the contents of this array.\n\n- `.toDate(_ format: String?, region: Region?)`\n- `.toDate(_ formats: [String]?, region: Region?)`\n\nfunctions takes as input two arguments:\n\n- `format (String|Array)`: it's optional and allows you to set explictly the format (or ordered list of formats) SwiftDate must use to parse the date. Allowed values are listed in Unicode DateTime Table [you can found here](7.Format_UnicodeTable.md). If omitted SwiftDates attempts to parse the string iterating over the list of auto patterns listed in `SwiftDate.autoFormats`.\n- `region (Region)`: describe the region (locale/calendar/timezone) in which the date is expressed. If omitted the default region (`SwiftDate.defaultRegion`) is used istead.\n\nThe result of these functions is an optional `DateInRegion` instance (`nil` is returned if parsing fails).\n\nSome examples:\n\n```swift\nlet _ = \"2018-01-01 15:00\".toDate()\nlet _ = \"15:40:50\".toDate(\"HH:mm:ss\")\nlet _ = \"2015-01-01 at 14\".toDate(\"yyyy-MM-dd 'at' HH\", region: rome)\n\n// Support for locale\nlet itRegion = Region(calendar: Calendars.gregorian, zone: Zones.europeRome, locale: Locales.italian)\nlet enRegion = Region(calendar: Calendars.gregorian, zone: Zones.europeRome, locale: Locales.english)\n\nlet srcString = \"July 15 - 15:30\"\n// it returns nil because itRegion has Locales.italian\nlet _ = srcString.toDate([\"yyyy-MM-dd\",\"MMM dd '-' HH:mm\"], region: itRegion)\n// it's okay because enRegion has locale set to english\nlet _ = srcString.toDate([\"yyyy-MM-dd\",\"MMM dd '-' HH:mm\"], region: enRegion)\n```\n\n> **PERFORMANCES** In order to preserve performances you should pass the `format` parameter if you know the input format.\n\n> **LOCALE PARAMETER** If you use readable unit names (like `MMM` for months) be sure to select the right locale inside the `region` parameter in order to get valid results.\n\n[^ Top](#index)\n\n<a name=\"iso8601\"/>\n\n## 2.1 Parse ISO8601\nA special note must be made for ISO8601. This format (the extended version and all its variants) may include the timezone information.\nIf you need to parse an ISO8601 datetime you should therefore use the `.toISODate()` function of `String` in order to get a complete result.\n\n> **NOTE** ISO8601 parser (via `.toISODate()` func) is capable of recognizing all the variants of the 8601 formats; if your date is in this formt use this function instead of passing custom time format. It will lead in better results.\n\nThe following function:\n\n`func toISODate(_ options: ISOParser.Options?, region: Region) -> DateInRegion?`\n\ntakes 2 arguments:\n\n- `options | ISOParserOptions` allows you to customize some parser attributes: `timeSeparator` (by default is `:`), `calendar` (by default is the gregorian calendar) and the strict parsing behaviour (by default is `false`). Usually you can omit this parameter.\n- `region | Region` used to define the region of the date. By default is set to `Region.ISO` (gregorian/gmt/english posix). If parsed string also contains `timezone` it will override the parameter passed by the region. You can use `convertTo(region:)` to perform any additional conversion.\n\nExamples:\n\n```swift\nlet date = \"2017-08-05T16:04:03+02:00\".toISODate(region: Region.ISO)!\n// returned date's region.zone is GMT+2 not the default's Region.ISO's GMT0.\n// This because value is read from the string itself.\n```\n\n[^ Top](#index)\n\n<a name=\"dotnet\"/>\n\n## 2.2 - Parse .NET\nCSOM DateTime (aka .NET DateTime) is a format defined by Microsoft as the number of 100-nanosecond intervals that have elapsed since 12:00 A.M., January 1, 0001 ([learn more on MSDN documentation page](https://msdn.microsoft.com/en-us/library/dd948679)).\n\nYou can parse a CSOM datetime string using the `toDotNETDate()` function.\n\n> **NOTE:** As for ISO8601 even .NET datetime may contain information about timezone. When you set the region as input parameter of the conversion function remember: it will be overriden by default parsed timezone (GMT if not specified). Region is used for `locale` only.\n\n`func toDotNETDate(region: Region = SwiftDate.defaultRegion) -> DateInRegion?`\n\ntakes a single parameter:\n\n- `region | Region`: the region in which the date is represented (only `locale` parameter is used). If you omit this parameter the `SwiftDate.ISO` is used instead. You can use `convertTo(region:)` to perform any additional conversion.\n\nExample:\n\n```swift\n// This is the 2017-07-22T18:27:02+02:00 date.\nlet _ = \"/Date(1500740822000+0200)/\".toDotNETDate()\n```\n\n[^ Top](#index)\n\n<a name=\"rssaltrss\"/>\n\n## 2.3 - Parse RSS & AltRSS\nRSS & AltRSS datetime format are used in RSS feed files. Parsing in SwiftDate is pretty easy; just call the `.toRSSDate()` function.\n\n> **NOTE:** As for ISO8601 even RSS/AltRSS datetime contain information about timezone. When you set the region as input parameter of the conversion function remember: it will be overriden by default parsed timezone (GMT if not specified). Region is used for `locale` only.\n\n`func toRSSDate(alt: Bool, region: Region = Region.ISO) -> DateInRegion?`\n\ntakes two arguments:\n\n- `alt: Bool`: set to `false` if represented string is RSS standard format, `true` to use the Alt-RSS parser.\n- `region: Region`: region in which the date is expressed. Only the `locale` parameter is used, `timezone` is read from string and calendar is gregorian. If you omit this parameter the `SwiftDate.ISO` is used instead. You can use `convertTo(region:)` to perform any additional conversion.\n\n```swift\n// This is the ISO8601: 2017-07-22T18:27:02+02:00\nlet _ = \"Sat, 22 Jul 2017 18:27:02 +0200\".toRSSDate(alt: false)!\nlet _ = \"22 Jul 2017 18:27:02 +0200\".toRSSDate(alt: true)!\n\n// NOTE:\n// Even if we set a random region with a custom locale,\n// calendar and timezone, final parsed date still correct.\n// Only the locale parameter is set.\n// Other region's parameter are ignored and read from the string itself.\nlet regionAny = Region(calendar: Calendars.buddhist, zone: Zones.indianMayotte, locale: Locales.italian)\nlet date1 = \"Tue, 20 Jun 2017 14:49:19 +0200\".toRSSDate(alt: false, region: regionAny)\n```\t\t\t\n\n[^ Top](#index)\n\n<a name=\"sql\"/>\n\n## 2.4 - Parse SQL\nSQL datetime is the format used in all SQL-compatible schemas.\nYou can parse a string in this format using `toSQLDate()` function.\n\n`func toSQLDate(region: Region = Region.ISO) -> DateInRegion?`\n\ntakes one argument:\n\n- `region: Region`: region in which the date is expressed. Only the `locale` parameter is used, `timezone` is read from string and calendar is gregorian. If you omit this parameter the `SwiftDate.ISO` is used instead. You can use `convertTo(region:)` to perform any additional conversion.\n\nExample:\n\n```swift\n// Date in ISO is 2016-04-14T11:58:58+02:00\nlet _ = \"2016-04-14T11:58:58.000+02\".toSQLDate()\n```\n\t\t\n[^ Top](#index)\n\n-- \n[**Next Chapter**: Manipulate & Derivate Dates](#3.Manipulate_Date.md)\n\n"
  },
  {
    "path": "Documentation/3.Manipulate_Date.md",
    "content": "![](./SwiftDate.png)\n\n<a name=\"index\"/>\n\n- [**Index**: Table Of Contents](#Index.md)\n- [**Prev Chapter**: Date Parsing](#3.Date_Parsing.md)\n- [**Next Chapter**: Compare Dates](#4.CompareDates.md)\n\n## Manipulate & Derivate Dates\n\n- [3.0 - Add & Subtract Time Units from Date](3.Manipulate_Date.md#mathdate)\n- [3.1 - Get DateTime Components](3.Manipulate_Date.md#datecomponents)\n- [3.2 - Get Interval Between Dates](3.Manipulate_Date.md#interval)\n- [3.3 - Convert Date's Region (Locale/TimeZone/Calendar)](3.Manipulate_Date.md#convert)\n- [3.4 - Rounding Date](3.Manipulate_Date.md#roundingdate)\n- [3.5 - Truncating Date](3.Manipulate_Date.md#truncatingdate)\n- [3.6 - Set Time in Date](3.Manipulate_Date.md#altertimedate)\n- [3.7 - Set DateTime Components](3.Manipulate_Date.md#altercomponents)\n- [3.8 - Generate Related Dates (`nextYear, nextWeeekday, startOfMonth, startOfWeek, prevMonth`...)](3.Manipulate_Date.md#relateddates)\n- [3.9 - Date at start/end of time component](3.Manipulate_Date.md#startendcomponent)\n- [3.10 - Enumerate Dates](3.Manipulate_Date.md#enumeratedates)\n- [3.11 - Enumerate Dates for Weekday in Range](3.Manipulate_Date.md#enumerateweekdays)\n- [3.12 - Random Dates](3.Manipulate_Date.md#randomdates)\n- [3.13 - Sort Dates](3.Manipulate_Date.md#sort)\n- [3.14 - Get the next weekday](3.Manipulate_Date.md#nextWeekDay)\n- [3.15 - Get date at given week number/weekday](3.Manipulate_Date.md#dateAtWeeknumberWeekday)\n- [3.16 - Difference between dates with components](3.Manipulate_Date.md#differenceBetweenDates)\n- [3.17 - Create date at components preserving small components](3.Manipulate_Date.md#dateAtComponents)\n- [3.18 - Date at given weekday after # weeks](3.Manipulate_Date.md#dateAfterWeeks)\n- [3.19 - Next Date](3.Manipulate_Date.md#nextDate)\n\nDates can be manipulated as you need by using classic math operators and readable time units.\n\n<a name=\"mathdate\"/>\n\n## 3.0 - Add & Subtract Time Units from Date\n\nSwiftDate allows you to use numbers to work with time components in dates. By extending the `Int` type it defines a list of time units:\n\n- `nanoseconds`\n- `seconds`\n- `minutes`\n- `days`\n- `weeks`\n- `months`\n- `quarters`\n- `years`\n\nYou can use a value followed by one of these unit specifications to add or remove the component from a date.\n\nSo, for example, you can produce a date which can be a mix of intuitive math operations:\n\n```swift\nlet oneYearAhead = DateInRegion() + 1.years\nlet someMinutesAgo = date1 - 2.minutes\nlet fancyDate = date1 + 3.hours - 5.minutes + 1.weeks\n```\n\n> IMPORTANT NOTE: These values are converted automatically to `DateComponents` evaluated in the same context of the target `Date` or `DateInRegion`'s `calendar`.\n\nAnother way to add time components to a date is to use the `dateByAdding()` function:\n\n`func dateByAdding(_ count: Int, _ component: Calendar.Component) -> DateInRegion`\n\ntakes two arguments:\n\n- `count | Int` value to add (maybe negative)\n- `component | Calendar.Component` the time unit components to add.\n\n> IMPORTANT NOTE: New date is evaluated in the same context of the target `Date` or `DateInRegion`'s `calendar`.\n\n```swift\nlet nextDate = dateA.dateByAdding(5, .years) // 5 years from dateA\n```\n\n[^ Top](#index)\n\n<a name=\"datecomponents\"/>\n\n## 3.1 - Get DateTime Components Components\nWith SwiftDate you have several convenience properties to inspect each datetime unit of a date, both for `Date` and `DateInRegion`.\n\nThese properties are strictly correlated to the date's calendar (and some also with locale): if you are manipulating a `DateInRegion` remember these properties return values in the context of the associated `region` attributes (Locale, TimeZone and Calendar).\n\n> **IMPORTANT NOTE**: If you are working with plain `Date` properties uses as reference the currently set `SwiftDate.defaultRegion` which, unless you modify it, is set to Gregorian/UTC/Device's Language.\n\nThis a complete list of the properties you can inspect for a date object:\n\n| PROPERTY                                                                                                    | DESCRIPTION                                                                                                                                                                                                                   | \n|-------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| \n| `year`                                                                                                      | current year number                                                                                                                                                                                                           | \n| `month`                                                                                                     | current month number (1 is January)                                                                                                                                                                                           | \n| `monthName(_ style: SymbolFormatStyle)`                                                                     | name of the current month with given style (uses region's locale)                                                                                                                                                             | \n| `monthDays`                                                                                                 | number of the days into the current month                                                                                                                                                                                     | \n| `day`                                                                                                       | day number in the current month                                                                                                                                                                                               | \n| `dayOfYear`                                                                                                 | day of the year                                                                                                                                                                                                               | \n| `ordinalDay`                                                                                                 | The number of day in ordinal style format for the receiver in current locale.                                                                                                                                                                                                          | \n| `hour`                                                                                                      | current hour                                                                                                                                                                                                                  | \n| `nearestHour`                                                                                               | nearest rounded hour                                                                                                                                                                                                          | \n| `minute`                                                                                                    | current minute                                                                                                                                                                                                                | \n| `second`                                                                                                    | current second                                                                                                                                                                                                                | \n| `nanosecond`                                                                                                | current nanosecond                                                                                                                                                                                                            | \n| `msInDay`                                                                                                   | \"Milliseconds in day of the receiver. This field behaves exactly like a composite of all time-related fields, not including the zone fields.As such, it also reflects discontinuities of those fields on DST transition days. | \n| On a day of DST onset, it will jump forward. On a day of DST cessation, it will jump backward.              |                                                                                                                                                                                                                               | \n| This reflects the fact that is must be combined with the offset field to obtain a unique local time value.\" |                                                                                                                                                                                                                               | \n| `weekday`                                                                                                   | Weekday unit of the receiver. The weekday units are the numbers 1-N (where for the Gregorian calendar N=7 and 1 is Sunday).                                                                                                   | \n| `weekdayName(_ style: SymbolFormatStyle)`                                                                   | Name of the weekday expressed in given format style.                                                                                                                                                                          | \n| `weekOfYear`                                                                                                | Week of a year of the receiver.                                                                                                                                                                                               | \n| `weekOfMonth`                                                                                               | Week of a month of the receiver.                                                                                                                                                                                              | \n| `weekdayOrdinal`                                                                                            | Ordinal position within the month unit of the corresponding weekday unit.                                                                                                                                                     | \n| `firstDayOfWeek`                                                                                            | Return the first day number of the week where the receiver date is located                                                                                                                                                    | \n| `lastDayOfWeek`                                                                                             | Return the last day number of the week where the receiver date is located.                                                                                                                                                    | \n| `yearForWeekOfYear`                                                                                         | Relative year for a week within a year calendar unit.                                                                                                                                                                         | \n| `quarter`                                                                                                   | Quarter value of the receiver.                                                                                                                                                                                                | \n| `quarterName(_ style: SymbolFormatStyle)`                                                                   | Quarter name expressed in given format style                                                                                                                                                                                  | \n| `era`                                                                                                       | Era value of the receiver.                                                                                                                                                                                                    | \n| `eraName(_ style: SymbolFormatStyle)`                                                                       | Name of the era expressed in given format style                                                                                                                                                                               | \n| `DSTOffset`                                                                                                 | The current daylight saving time offset of the represented date                                                                                                                                                               | \n\nSeveral other properties defines additional attributes of the date:\n\n- `date | Date`: return the absolute date instance (for `Date` it just return itself)\n- `region | Region`: return the region associated with date (for `Date` it return `SwiftDate.defaultRegion`).\n- `calendar | Calendar`: return the associated calendar\n- `dateComponents | DateComponents`: return all the date components of the date in the context of its associated region.\n\n[^ Top](#index)\n\n<a name=\"interval\"/>\n\n## 3.2 - Get Interval Between Dates\nYou can get the interval between two dates and express it in form of time units easily with SwiftDate.\n\nThe `.getInterval(toDate:component:)` function allows you to express the difference between to dates in form of a passed time component.\n\n`func getInterval(toDate: DateInRegion?, component: Calendar.Component) -> Int64`\n\nTakes two arguments:\n\n- `toDate | DateInRegion`: reference date to compare against\n- `component | Calendar.Component`: the component in which the difference must be returned.\n\nExamples:\n\n```swift\nlet dateA = DateInRegion(\"2017-07-22 00:00:00\", format: format, region: rome)!\nlet dateB = DateInRegion(\"2017-07-23 12:00:00\", format: format, region: rome)!\n\nlet hours = dateA.getInterval(toDate: dateB, component: .hour) // 36 hours\nlet days = dateA.getInterval(toDate: dateB, component: .day) // 1 day\n```\n\n\n[^ Top](#index)\n\n<a name=\"convert\"/>\n\n## 3.3 - Convert Date's Region (Locale/TimeZone/Calendar)\n`DateInRegion` can be converted easily to another region just using `.convertTo(region:)` or `.convertTo(calendar: timezone:locale:)` functions.\n\n- `convertTo(region:)` convert the receiver date to another region. Region may include a different time zone for example, or a locale.\n- `convertTo(calendar:timezone:locale:)` allows to convert the receiver date instance to a specific calendar/timezone/locale. All parameters are optional and only non-nil parameters alter the final region. For a nil param the current receiver's region attribute is kept.\n\nExamples:\n\n```swift\n// Create a date in NY: \"2001-09-11 12:00:05\"\nlet regionNY = Region(calendar: Calendars.gregorian, zone: Zones.americaNewYork, locale: Locales.english)\nlet dateInNY = DateInRegion(components: {\n\t$0.year = 2001\n\t$0.month = 9\n\t$0.day = 11\n\t$0.hour = 12\n\t$0.minute = 0\n\t$0.second = 5\n}, region: regionNY)\n\n// Convert to GMT timezone (and locale)\nlet inGMT = dateInNY.convertTo(region: Region.UTC) // date is now: \"2001-09-11 16:00:05\"\n```\n\n[^ Top](#index)\n\n<a name=\"roundingdate\"/>\n\n## 3.4 - Rounding Date\n\n`.dateRoundedAt()` function allows to round a given date time to the passed style: off, up or down.\n\n`func dateRoundedAt(at style: RoundDateMode) -> DateInRegion`\n\ntakes a single argument:\n\n- `style | RoundDateMode`: define the style of rounding: it can be `off`, `ceil` (up) or `floor` (down). `RoundDateMode` defines a list of convenience rounding to 5,10,30 minutes but you can use `.toMins()`, `.toCeilMins()` or `.toFloorMins()` and pass your own rounding values expressed in minutes.\n\nExample:\n\n```swift\nlet rome = Region(...)\nlet format = \"yyyy-MM-dd HH:mm:ss\"\n\n// Round down 10mins\nlet date =  DateInRegion(\"2017-07-22 00:03:50\", format: format, region: rome)\nlet r10min = date.dateRoundedAt(.to10Mins) // 2017-07-22T00:00:00+02:00\n\n// Round up 30min\nlet r30min = \"2015-01-24 15:07:20\".toDate(format: format, region: rome).dateRoundedAt(.toCeil30Mins) // 2015-01-24T15:30:00+01:00\n```\n\n[^ Top](#index)\n\n<a name=\"truncatingdate\"/>\n\n## 3.5 - Truncating Date\nSometimes you may need to truncate a date by zeroing all values below certain time unit. `.dateTruncated(from:) and .dateTruncated(to:)` functions can be used for this scope.\n\n#### Truncating From\nIt creates a new instance by truncating the components starting from given components down the granurality.\n\n`func dateTruncated(from component: Calendar.Component) -> DateInRegion?`\n\n#### Truncated At\nIt creates a new instance by truncating all passed components.\n\n`func dateTruncated(at components: [Calendar.Component]) -> DateInRegion?`\n\nExamples:\n\n```swift\nlet rome = Region(calendar: Calendars.gregorian, zone: Zones.europeRome, locale: Locales.italian)\nlet date = \"2017-07-22 15:03:50\".toDate(\"yyyy-MM-dd HH:mm:ss\", region: rome)\n\nlet truncatedTime = date.dateTruncated(from: .hour) // 2017-07-22T00:00:00+02:00\nlet truncatedCmps = date.dateTruncated(at: [.month, .day, .minute]) // 2017-01-01T15:00:50+01:00\n```\n\n[^ Top](#index)\n\n<a name=\"altertimedate\"/>\n\n## 3.6 - Set Time in Date\nSometimes you may need to alter time in a specified date. SwiftDate allows you to perform this using `.dateBySet(hour:min:secs:options:)` function.\n\n`func dateBySet(hour: Int?, min: Int?, secs: Int?, ms: Int?, options: TimeAlterOptions = TimeAlterOptions()) -> DateInRegion?`\n\ntakes five arguments:\n\n- `hour | Int?`: set a non `nil` value to change the hour value\n- `min | Int?`: set a non `nil` value to change the minute value\n- `secs | Int?`: set a non `nil` value to change the seconds value\n- `ms | Int?`: set a non `nil` value to change the milliseconds value\n- `options: TimeCalculationOptions`: allows to specify calculation options attributes (usually you don't need to set it).\n\nExample:\n\n```swift\nlet rome = Region(calendar: Calendars.gregorian, zone: Zones.europeRome, locale: Locales.italian)\nlet date = DateInRegion(\"2010-01-01 00:00:00\", format: \"yyyy-MM-dd HH:mm:ss\", region: rome)!\n\nlet alteredDate = date.dateBySet(hour: 20, min: 13, secs: 15) // 2010-01-01 20:13:15\n```\n\n[^ Top](#index)\n\n<a name=\"altercomponents\"/>\n\n## 3.7 - Set DateTime Components\nSwiftDate allows you to return a new date representing the date calculated by setting specific components of a given date to given values, while trying to keep lower components the same (altering more components at the same time may result in different-than-expected results, this is because lower components maybe need to be recalculated).\n\n`dateBySet(_ components: [Calendar.Component: Int]) -> DateInRegion?`\n\nTakes one argument:\n\n- `components | [Calendar.Component: Int]` a dictionary of key/values for each component you want to alter.\n\n> **NOTE:** While the algorithm try to keep lower compoments the same, the resulting date may differ from what expected when you alter more than a component a time.\n\n\nExample:\n\n```swift\nlet _ = date.dateBySet([.month: 1, .day: 1, .hour: 9, .minute: 26, .second: 0])\n```\n\n[^ Top](#index)\n\n<a name=\"relateddates\"/>\n\n## 3.8 - Generate Related Dates (`nextYear, nextWeeekday, startOfMonth, startOfWeek, prevMonth`...)\nSometimes you may need to generate a related date from a specified instance; maybe the next sunday, the first day of the next week or the start datetime of a date.\nSwiftDate includes 20+ different \"interesting\" dates you can obtain by calling `.dateAt()` function from any `Date` or `DateInRegion` instance.\n\n`func dateAt(_ type: DateRelatedType) -> DateInRegion`\n\ntakes just an argument which defines the type of date you want to obtain starting from the receiver date.\n`DateRelatedType` is an enum which has the following options:\n\n- `startOfDay`\n- `endOfDay`\n- `startOfWeek`\n- `endOfWeek`\n- `startOfMonth`\n- `endOfMonth`\n- `tomorrow`\n- `tomorrowAtStart`\n- `yesterday`\n- `yesterdayAtStart`\n- `nearestMinute(minute:Int)`\n- `nearestHour(hour:Int)`\n- `nextWeekday(_: WeekDay)`\n- `nextDSTDate`\n- `prevMonth`\n- `nextMonth`\n- `prevWeek`\n- `nextWeek`\n- `nextYear`\n- `prevYear`\n\n> **CONTRIBUTE!** Have you a new related date you want to be part of this list? Create a [new PR](https://github.com/malcommac/SwiftDate/compare) with the code and unit tests and we'll be happy to add it to the list!\n\nExamples:\n\n```swift\n// Return today's datetime at 00:00:00\nlet _ = DateInRegion().dateAt(.startOfDay)\n// Return today's datetime at 23:59:59\nlet _ = DateInRegion().dateAt(.endOfDay)\n// Return the date at the start of this week\nlet _ = DateInRegion().dateAt(.startOfWeek)\n// Return current time tomorrow\nlet _ = DateInRegion().dateAt(.tomorrow)\n// Return the next sunday from specified date\nlet _ = date.dateAt(.nextWeekday(.sunday))\n// and so on...\n```\n\n[^ Top](#index)\n\n<a name=\"startendcomponent\"/>\n\n## 3.9 - Date at start/end of time component\nTwo functions called `.dateAtStartOf()` and `.dateAtEndOf()` allows you to get the related date from a `Date`/`DateInRegion` instance moved at the start or end of the specified component.\n\nYou can, for example, get the date at the start of the week, or the year, or a the end of the quarter.\n\n- `func dateAtStartOf(_ unit: Calendar.Component) -> DateInRegion`: return the date at the start of the specified time component.\n- `func dateAtEndOf(_ unit: Calendar.Component) -> DateInRegion`: return the date at the end of the specified time component.\n\nExamples:\n\n```swift\n// Return today's date at 23:59:59\nlet _ = DateInRegion().dateAtEndOf(.day)\n// Return the first day's date of the month described in date1\nlet _ = date1.dateAtStartOf(.month)\n// Return the first day of this year at 00:00:00\nlet _ = DateInRegion().dateAtStartOf(.year)\n```\n\n<a name=\"enumeratedates\"/>\n\n[^ Top](#index)\n\n## 3.10 - Enumerate Dates\nDates enumeration function allows you to generate a list of dates in a closed date intervals incrementing date components by a fixed or variable interval at each new date.\n\n- **VARIABLE INCREMENT** `static func enumerateDates(from startDate: DateInRegion, to endDate: DateInRegion, increment: ((DateInRegion) -> (DateComponents))) -> [DateInRegion]`\n- **FIXED INCREMENT** `static func enumerateDates(from startDate: DateInRegion, to endDate: DateInRegion, increment: DateComponents) -> [DateInRegion]`\n\nBoth of these functions are pretty similar; it takes:\n\n- `startDate | DateInRegion`: the initial date of the enumeration (it will be item #0 of the final array)\n- `endDate | DateInRegion`: the upper bound limit date. The last item of the array is evaluated automatically and maybe not equal to `endDate`.\n- `increment | DateComponents or Function`: for fixed increment it takes a `DateComponents` instance which define the increment of time components at each new date; for variable it provides the latest date generated and require as return object of the closure the increment as `DateComponents`.\n\n\nExamples:\n\n```swift\nlet increment = DateComponents.create {\n  $0.hour = 1\n  $0.minute = 30\n}\n// Generate an array of dates where the first item is fromDate\n// and each new date is incremented by 1h30m from the previous.\n// Latest date is < endDate (but maybe not the same).\nlet dates = DateInRegion.enumerateDates(from: fromDate, to: toDate, increment: increment)\n```\n\n[^ Top](#index)\n\n<a name=\"enumerateweekdays\"/>\n\n## 3.12 - Enumerate Dates for Weekday in Range\nThe following function allows you to enumerate all dates of a particular weekdays which are in a determinated date range.\nBoth `Date` and `DateInRegion` implements this static function:\n\n```swift\npublic static func datesForWeekday(_ weekday: WeekDay, from startDate: Date, to endDate: Date, region: Region = SwiftDate.defaultRegion) -> [Date]\n```\n\nAnother shortcut method allows you to get weekdays in a particular month of a year:\n\n```swift\npublic static func datesForWeekday(_ weekday: WeekDay, inMonth month: Int, ofYear year: Int, region: Region = SwiftDate.defaultRegion) -> [Date]\n```\n\nExamples:\n\n```swift\n// Get all mondays in Jan 2019\nlet mondaysInJan2019 = Date.datesForWeekday(.monday, inMonth: 1, ofYear: 2019)\n\n// You will get 4 results\n// - 2019-01-07T00:00:00Z\n// - 2019-01-14T00:00:00Z\n// - 2019-01-21T00:00:00Z\n// - 2019-01-28T00:00:00Z\n\n// Get all fridays between May 27, 2019 and June 8, 2019\nlet fromDate = Date(year: 2019, month: 5, day: 27, hour: 0, minute: 0)\nlet toDate = Date(year: 2019, month: 6, day: 8, hour: 0, minute: 0)\nlet fridaysInJunePartial = Date.datesForWeekday(.friday, from: fromDate, to: toDate, region: Region.UTC)\n\n// You will get 2 results:\n// - 2019-05-31T00:00:00Z\n// - 2019-06-07T00:00:00Z\n```\n\n<a name=\"randomdates\"/>\n\n## 3.12 - Random Dates\nSwiftDate exposes a set of functions to generate a random date or array of random dates in a bounds.\nThere are several functions to perform this operation:\n\n### Single Random Date\n\n- `randomDate(region:)` generate a random date into the specified region.\n- `randomDate(withinDaysBeforeToday:region:)` generate a random date between now and a specified amount days ealier into the specified region.\n- `randomDate(between:and:region:)` generate a random date into the specified region between two given date bounds.\n\n### Array of Random Dates\n- `randomDates(count:between:and:region:)` return `count` random generated dates into the specified region between two given date bounds.\n\n> **IMPORTANT**: For all of thes function if you don't specify the `region`, `SwiftDate.defaultRegion` is used instead.\n\nExamples:\n\n```swift\n// Generate random dates array in limit\nlet now = DateInRegion()\nlet someYearsAgo = (upperBound - 3.years)\n// generate 40 random dates between 3 years ago today and today\nlet randomDates = DateInRegion.randomDates(count: 40, between: someYearsAgo, and: now)\n\n// Generate a random date between now and 7 days ago\nlet rome: Region = ...\nlet aDate = DateInRegion.randomDate(withinDaysBeforeToday: 7, region: rome) \n```\n\n[^ Top](#index)\n\n<a name=\"sort\"/>\n\n## 3.13 - Sort Dates\nTwo conveniences function allows you to sort an array of dates by newest or oldest. Naming is pretty simple:\n\n- `sortedByOldest()`: sort dates by the oldest\n- `sortedByNewest()`: sort dates by the newest\n\nTwo other functions allows you to get the oldest/newest date in array:\n\n- `oldestIn()`: return the oldest date in array\n- `newestIn()`: return the newest date in array\n\nExamples:\n\n```swift\nlet arrayOfDates: [DateInRegion] = [...]\n// ordered array with the newest on top\nlet orderedByNewest = DateInRegion.sortedByNewest(list: datesArray)\n// get the oldest date of the list\nlet oldestDate = DateInRegion.oldestIn(list: arrayOfDates)\n```\n\n[^ Top](#index)\n\n<a name=\"nextWeekDay\"/>\n\n## 3.14 - Get the next weekday\n\nIn order to get the next  weekday preserving smaller components (hour, minute, seconds) you can use the `nextWeekday()` function:\n\n```swift\nlet date1 = DateInRegion(\"2019-05-11 00:00:00\", format: dateFormat, region: regionRome)!\nlet nextFriday = date1.nextWeekday(.friday) // 2019-05-17T00:00:00+02:00\n```\n\n[^ Top](#index)\n\n<a name=\"dateAtWeeknumberWeekday\"/>\n\n## 3.15 - Get date at given week number/weekday\n\nTo returns the date at the given week number and week day preserving smaller components (hour, minute, seconds) you can use the `dateAt(weekdayOrdinal:weekday:monthNumber:yearNumber:)` function:\n\n```swift\nlet date = DateInRegion(\"2019-05-11 00:00:00\", format: dateFormat, region: regionRome)!\nlet _ = date1.dateAt(weekdayOrdinal: 3, weekday: .friday, monthNumber: date1.month + 1) // 2019-06-21T00:00:00+02:00\n```\n\n<a name=\"differenceBetweenDates\"/>\n\n## 3.16 - Difference between dates with components\n\nTo get differences between two dates using given time components you can choose between two methods:\n\n- `difference(in:from:)`:  Returns the difference in the calendar component given (like day, month or year) with respect to the other date as a positive integer.\n- `differences(in:from:)`: Returns the differences in the calendar components given (like day, month and year) with respect to the other date as dictionary with the calendar component as the key and the diffrence as a positive integer as the value.\n\n\nExample:\n\n```swift\nlet format = \"yyyy-MM-dd HH:mm\"\nlet d1 = \"2019-01-01 00:00\".toDate(format, region: Region.current)\nlet d2 = \"2019-01-10 14:20\".toDate(format, region: Region.current)\nlet diff = d1!.differences(in: [.day, .hour], from: d2!) // 9 days, 14 hours\n```\n[^ Top](#index)\n\n<a name=\"dateAtComponents\"/>\n\n## 3.17 - Create date at components preserving small components\n\nYou can create a derivated date from a receiver by preserving small components (hour, minute and second) by using the: `dateAt(dayOfMonth:monthNumber:yearNumber:)` method:\n\n```swift\nlet date = \"2019-01-01 00:00\".toDate(\"yyyy-MM-dd HH:mm\", region: Region.current)! // Rome zone\nlet onMarch = date.dateAt(dayOfMonth: 31, monthNumber: 3) // 2019-03-31T00:00:00+01:00\n```\n\n[^ Top](#index)\n\n<a name=\"dateAfterWeeks\"/>\n\n## 3.18 - Date at given weekday after # weeks\n\nReturns the date after given number of weeks on the given day of week using `dateAfter(weeks:on:)` function.\n\n```swift\nlet d = \"2019-09-14 00:00\".toDate(\"yyyy-MM-dd HH:mm\", region: Region.current)! // Rome Region\nlet nextTwoMondays = d.dateAfter(weeks: 2, on: .monday) // 2019-09-23T00:00:00+02:00\n```\n\n[^ Top](#index)\n\n<a name=\"nextDate\"/>\n\n## 3.19 - Next Date\n\nThere are 3 functions to get the next date starting from a receiver date:\n\n- `nextWeekday()`: Returns the next weekday preserving smaller components \n- `nextWeekday(:withWeekOfMonth:andMonthNumber)`: Returns next date with the given weekday and the given week number\n- `next(dayOfMonth:monthOfYear:)`: Returns the next day of month preserving smaller components (hour, minute, seconds)\n\n[**Next Chapter**: Compare Dates](#4.CompareDates.md)\n"
  },
  {
    "path": "Documentation/4.Compare_Dates.md",
    "content": "![](./SwiftDate.png)\n\n<a name=\"index\"/>\n\n- [**Index**: Table Of Contents](#Index.md)\n- [**Prev Chapter**: Manipulate & Derivate Dates](#3,Manipulate_Dates.md)\n- [**Next Chapter**: Date Formatting](#5.Date_Formatting.md)\n\n## Compare Dates\nDate comparison is available both via simple math operators (`<,>,<=,>=`) or throught several other functions which allows a more fined grained control of the comparison.\n\n- [4.0 - Compare Dates](4.Compare_Dates.md#standard)\n- [4.1 - Extended Comparison with Presets (`isToday, isTomorrow, isSameWeek, isNextYear` etc.)](4.Compare_Dates.md#extended)\n- [4.2 - Comparison with Granularity](4.Compare_Dates.md#granularity)\n- [4.3 - Check if Date is Close to Another](4.Compare_Dates.md#close)\n- [4.4 - Check if Date is Inside another](4.Compare_Dates.md#isinside)\n- [4.5 - Check if Date is Inside a Range](4.Compare_Dates.md#range)\n\n<a name=\"standard\"/>\n\n## 4.0 - Compare Dates\nStandard comparison between dates can be done using the classic `.compare()` functions or mathematical operators.\nSwiftDate also introduces two additional convenience methods:\n\n- `isBeforeDate(_:orEqual:granularity:)` Compares whether the receiver is before/before equal `date` based on their components down to a given unit granularity.\n- `isAfterDate(_:orEqual:granularity:)` Compares whether the receiver is after `date` based on their components down to a given unit granularity.\n\n<a name=\"extended\"/>\n\n## 4.1 - Extended Comparison with Presets\nWhile standard comparison between two dates can be done by using mathematical operators, extended comparison is made via `.compare()` method which offer more than 25+ different types of relevant comparisons.\n\n`func compare(_ compareType: DateComparisonType) -> Bool`\n\ntakes only one argument:\n\n- `compareType | DateComparisonType`: the type of comparison to make\n\n`DateComparisonType` is an enum which defines the type of comparison to make. This is the actual list of compare functions you can use:\n\n**For Days**\n\n- `isToday`\n- `isTomorrow`\n- `isYesterday`\n- `isSameDay(_ : DateRepresentable)`\n\n**For Weeks**\n\n- `isThisWeek`\n- `isNextWeek`\n- `isLastWeek`\n- `isSameWeek(_: DateRepresentable)`\n\n**For Months**\n\n- `isThisMonth`\n- `isNextMonth`\n- `isLastMonth`\n- `isSameMonth(_: DateRepresentable)`\n\n**For Years**\n\n- `isThisYear`\n- `isNextYear`\n- `isLastYear`\n- `isSameYear(_: DateRepresentable)`\n\n**For Relative Time**\n\n- `isInTheFuture`\n- `isInThePast`\n- `isEarlier(than: DateRepresentable)`\n- `isLater(than: DateRepresentable)`\n- `isWeekday`\n- `isWeekend`\n\n**For Day Time**\n\n- `isMorning`\n- `isAfternoon`\n- `isEvening`\n- `isNight`\n\n**For TZ**\n\n- `isInDST`\n\n> **CONTRIBUTE!** Have you a new related date you want to be part of this list? Create a [new PR](https://github.com/malcommac/SwiftDate/compare) with the code and unit tests and we'll be happy to add it to the list!\n\nExamples:\n\n```swift\n// return false\nlet _ = DateInRegion().dateAt(.endOfDay).compare(.isTomorrow)\n// return true\nlet _ = DateInRegion() + 7.days).compare(.isNextWeek)\n// return true\nlet _ = DateInRegion().dateAt(.startOfWeek) - 1.days).compare(.isLastWeek)\n```\n\n<a name=\"granularity\"/>\n\n## 4.2 - Comparison with Granularity\nA more fined grained control for dates comparison can be obtained using the `.compare(toDate:granularity:)` function which offers to return a `ComparisonResult` value that indicates the ordering of two given dates based on their components down to a given unit granularity.\n\n`func compare(toDate refDate: DateInRegion, granularity: Calendar.Component) -> ComparisonResult`\n\ntakes two arguments:\n\n- `refDate | DateInRegion`: date to compare against to.\n- `granularity | Calendar.Component`: The smallest unit that must, along with all larger units, be less for the given dates\n\nExample:\n\n```swift\n\n```\n\n[^ Top](#index)\n\n<a name=\"close\"/>\n\n## 4.3 - Check if Date is Close to Another\nDecides whether a Date is \"close by\" another one passed in parameter, where \"Being close\" is measured using a precision argument which is initialized with a 300 second interval (5 minute) or a specified interval.\n\nThe function is called `.compareCloseTo(_:precision:)` and takes two arguments:\n\n- `refDate | DateInRegion` reference date compare against to\n- `precision | TimeInterval` The precision of the comparison.\n\nExamples:\n\n```swift\nlet date = DateInRegion(\"2015-01-01 04:00:00\", format: dateFormat, region: regionRome)!\nlet refDate = DateInRegion(\"2015-01-01 00:00:00\", format: dateFormat, region: regionRome)!\n// return true because prevision is set to 5 hours and date differs for only 4 hours\nlet _ = dateC.compareCloseTo(refDate, precision: 5.hours.timeInterval)\n\n```\n\n<a name=\"isinside\"/>\n\n## 4.4 - Check if Date is Inside another\nCompares equality of two given dates based on their components down to a given unit granularity.\n\nThe function is called `.isInside(date:granularity:)` and takes two arguments:\n\n- `date`: date to compare\n- `granularity`: The smallest unit that must, along with all larger units, be equal for the given dates to be considered the same.\n\n\n<a name=\"range\"/>\n\n## 4.5 - Check if Date is Inside a Range\nUsing `.isInRange()` function you can check if a given date is inside the range between two dates.\n\n`func isInRange(date startDate: Date, and endDate: Date, orEqual: Bool = false, granularity: Calendar.Component = .nanosecond) -> Bool`\n\ntakes 4 arguments:\n\n- `startDate`: the lower bound limit of the range\n- `endDate`: the upper bound limit of the range\n- `orEqualt`: true to also validate the equality\n- `granularity`: smallest unit that must, along with all larger units, be greater for the given dates\n\nExample:\n\n```swift\nlet lowerBound = DateInRegion(\"2018-05-31 23:00:00\", format: dateFormat, region: regionRome)!\nlet upperBound = DateInRegion(\"2018-06-01 01:00:00\", format: dateFormat, region: regionRome)!\n\nlet testDate = DateInRegion(\"2018-06-01 00:02:00\", format: dateFormat, region: regionRome)!\n// return true, date is inside the hour granularity\nlet _ = testDate.isInRange(date: lowerBound, and: upperBound, orEqual: true, granularity: .hour)\n```\n\n\n[^ Top](#index)\n\n\n[**Next Chapter**: Date Formatting](#5.Date_Formatting.md)\n"
  },
  {
    "path": "Documentation/5.Date_Formatting.md",
    "content": "![](./SwiftDate.png)\n\n<a name=\"index\"/>\n\n- [**Index**: Table Of Contents](#Index.md)\n- [**Prev Chapter**: Parsing Dates](#Parsing_Dates.md)\n- [**Next Chapter**: Time Interval Formatting](#6.TimeInterval_Formatting.md)\n\n## Date Formatting\nFormatting dates and transforms to string representation is really easy with SwiftDate. All the major formats are supported and are really easy to configure.\n\n- [5.0 - Format Custom Style](5.Date_Formatting.md#customformatted)\n- [5.1 - ISO8601 Formatted String](5.Date_Formatting.md#isoformatted)\n- [5.2 - .NET Formatted String](5.Date_Formatting.md#dotnet)\n- [5.3 - RSS/AltRSS Formatted String](5.Date_Formatting.md#rss)\n- [5.4 - SQL Formatted String](5.Date_Formatting.md#sql)\n- [5.5 - Relative/Colloquial Formatted String](5.Date_Formatting.md#colloquial)\n- [5.6 - Mixed Date/Time Style](5.Date_Formatting.md#mixeddatetime)\n\n<a name=\"customformatted\"/>\n\n## 5.0 - Format Custom Style\nIf you need to format a `Date` or `DateInRegion` in a String using a custom format you need to use `toFormat(_:locale:)` function.\n\n`func toFormat(_ format: String, locale: LocaleConvertible?) -> String`\n\nit takes two arguments:\n\n- `format | String`: the format of the string. It's defined by the Unicode DateTime format specs you [can found here](7.Format_UnicodeTable.md).\n- `locale | LocaleConvertible?`: Set a non nil value to force the formatter to use a different locale than the one assigned to the date itself (from date's `region.locale` property). Leave it `nil` to use the one assigned by the region itself (or, for plain `Date` instances the one set as `SwiftDate.defaultRegion`).\n\nExample:\n\n```swift\nlet rome = Region(calendar: Calendars.gregorian, zone: Zones.europeRome, locale: Locales.italian)\nlet date = DateInRegion(year: 2015, month: 1, day: 15, hour: 20, minute: 00, second: 5, nanosecond: 0, region: rome)\n\n// Even if date's locale is set to `italian` we can still\n// print in a different language by passing a non nil locale\n// to the function.\nlet formattedString = date.toFormat(\"MMM dd yyyy\", locale: Locales.english) // \"Jan 15 2015\"\n```\n[^ Top](#index)\n\n<a name=\"isoformatted\"/>\n\n## 5.1 - ISO8601 Formatted String\nSwiftDate allows you to print date instances using a configurable ISO8601 formatter which is also compatible with older versions of iOS where Apple's own class is not available.\n\nTo use the ISO formatter call `.toISO()` function\n\n`func toISO(_ options: ISOFormatter.Options?) -> String`\n\ntakes one optional argument:\n\n- `options | ISOFormatter.Options`: allows to customize the format of the output string by defining which kind of date must be into the final string (if you omit it `withInternetDateTime` is used).\n\n`ISOFormatter.Options` defines an `OptionSet` with the following values:\n\n- `withYear`: The date representation includes the year. The format for year is inferred based on the other specified options. If `withWeekOfYear` is specified, `YYYY` is used. Otherwise, `yyyy` is used.\n- `withMonth`: The date representation includes the month. The format for month is `MM`.\n- `withWeekOfYear`: The date representation includes the week of the year. The format for week of year is `ww`, including the `W` prefix.\n- `withDay`:  The date representation includes the day. The format for day is inferred based on provided options: If `withMonth` is specified, `dd` is used. If `withWeekOfYear` is specified, `ee` is used. Otherwise, `DDD` is used.\n- `withTime`: The date representation includes the time. The format for time is `HH:mm:ss`.\n- `withTimeZone`: The date representation includes the timezone. The format for timezone is `ZZZZZ`.\n- `withSpaceBetweenDateAndTime`: The date representation uses a space (` `) instead of `T` between the date and time.\n- `withDashSeparatorInDate`: The date representation uses the dash separator (`-`) in the date.\n- `withFullDate`: The date representation uses the colon separator (`:`) in the time.\n- `withFullTime`: The date representation includes the hour, minute, and second.\n- `withInternetDateTime`: The format used for internet date times, according to the RFC 3339 standard. Equivalent to specifying `withFullDate`, `withFullTime`, `withDashSeparatorInDate`,\n `withColonSeparatorInTime`, and `withColonSeparatorInTimeZone`.\n- `withInternetDateTimeExtended`: The format used for internet date times; it's similar to `.withInternetDateTime` but include milliseconds (`yyyy-MM-dd'T'HH:mm:ss.SSSZZZZZ`).\n- `withoutTZSeparators`: Print timezone of the date without time separator (`+0200` instead of `+02:00`). You can combine it with the following other options: `withInternetDateTimeExtended`, `withInternetDateTime` and when `withTimeZone == false && withTimeZone == true`\n\nExamples:\n\n```swift\nlet regionRome = Region(calendar: Calendars.gregorian, zone: Zones.europeRome, locale: Locales.italian)\nlet date = DateInRegion(\"2017-07-22 00:00:00\", format: \"yyyy-MM-dd HH:mm:ss\", region: regionRome)!\n\n// ISO Formatting\nlet _ = date.toISO() // \"2017-07-22T00:00:00+02:00\"\nlet _ = date.toISO([.withFullDate]) // \"2017-07-22\"\nlet _ = date.toISO([.withFullDate, .withFullTime, .withDashSeparatorInDate, .withSpaceBetweenDateAndTime]) // \"2017-07-22 00:00:00+02:00\"\n```\n[^ Top](#index)\n\n<a name=\"dotnet\"/>\n\n## 5.2 - .NET Formatted String\nCSOM DateTime (aka .NET DateTime) is a format defined by Microsoft as the number of 100-nanosecond intervals that have elapsed since 12:00 A.M., January 1, 0001 ([learn more on MSDN documentation page](https://msdn.microsoft.com/en-us/library/dd948679)).\n\nUse the `.toDotNET()` function to create a string from a date instance.\n\n`func toDotNET() -> String`\n\n```swift\nlet date = \"2017-06-20T14:49:19+02:00\".toISODate()!\nlet dotNetString = date.toDotNET() // \"/Date(1497962959000+0200)/\"\n```\n\n[^ Top](#index)\n\n<a name=\"rss\"/>\n\n## 5.3 - RSS/AltRSS Formatted String\nRSS and AltRSS formatted string can be generated from an instance of `Date` or `DateInRegion` using the `.toRSS()` function.\n\n`func toRSS(alt: Bool) -> String`\n\ntakes only one argument:\n\n- `alt | Bool`: true to print the AltRSS variant, false to print the default RSS formatted string.\n\nExamples:\n\n```swift\nlet date = ... // 2017-06-20T14:49:19+02:00\nlet rssString = date.toRSS(alt: false) // \"Tue, 20 Jun 2017 14:49:19 +0200\"\nlet altRSSString = date.toRSS(alt: true) // \"20 Jun 2017 14:49:19 +0200\"\n```\n\n[^ Top](#index)\n\n<a name=\"sql\"/>\n\n## 5.4 - SQL Formatted String\nTo print a SQL formatted string from a date instance you need to use the `.toSQL()` function.\n\n`func toSQL() -> String`\n\nExamples:\n\n```swift\nlet date = ... // 2015-11-19T22:20:40+01:00\nlet sqlString = date.toSQL() // \"2015-11-19T22:20:40.000+01\"\n```\n\n[^ Top](#index)\n\n<a name=\"colloquial\"/>\n\n## 5.5 - Relative/Colloquial Formatted String\nColloquial format allows you to produce a human friendly string as result of the difference between a date and a a reference date (typically now).\nExamples of colloquial formatted strings are `3 mins ago`, `2 days ago` or `just now`.\n\nSwiftDate supports over 140+ languages to produce colloquial formatted strings; the entire engine behind the library is fully customizable so, if you need, you can override default strings and produce your own variants.\n\nTo print a colloquial variant of a string just call `.toRelative()` function from a `Date` or `DateInRegion` instance.\n\n`func toRelative(since: DateInRegion?, style: RelativeFormatter.Style?, locale: LocaleConvertible?) -> String`\n\nIt takes three arguments:\n\n- `since | DateInRegion?`: reference date, if you omit it current date is set as reference date.\n- `style | RelativeFormatter.Style?`: the style used to print the formatted value. There are 3 styles: `RelativeFormatter.defaultStyle()`, `RelativeFormatter.timeStyle()` and `RelativeFormstter.twitterStyle()`.\n- `locale | LocaleConvertible?`: pass non nil value to override the receiver region's `locale` and print the representation using passed locale.\n\nExamples:\n\n```swift\nlet ago5Mins = DateInRegion() - 5.minutes\nlet _ = ago5Mins.toRelative(style: RelativeFormatter.defaultStyle(), locale: Locales.italian) // \"5 minuti fa\"\n\nlet justNow2 = DateInRegion() - 2.hours\nlet _ = justNow2.toRelative(style: RelativeFormatter.twitterStyle(), locale: Locales.italian) // \"2h fa\"\n\nlet justNow = DateInRegion() - 10.seconds\nlet _ = justNow.toRelative(style: RelativeFormatter.twitterStyle(), locale: Locales.italian) // \"ora\"\n```\n\nYou can fully customize the language and results.\nSee the guide [\"Customize Colloquial Formatter\"](Customize_ColloquialFormatter.md).\n\n[^ Top](#index)\n\n<a name=\"mixeddatetime\"/>\n\n## 5.6 - Mixed Date/Time Style\n\nIf you to format date with different date/time styles you can use the `. dateTimeMixed` formatter option where you can choose a format both for date and time (`DateFormatter.Style`).\n\n```swify\n// Just print full date with no time\nlet formatted = date.toString(.dateTimeMixed(dateStyle: .full, timeStyle: .none))\n```\n\n[^ Top](#index)\n\n[**Next Chapter**: Time Interval Formatting](#6.TimeInterval_Formatting.md)\n"
  },
  {
    "path": "Documentation/6.TimeInterval_Formatting.md",
    "content": "![](./SwiftDate.png)\n\n<a name=\"index\"/>\n\n- [**Index**: Table Of Contents](#Index.md)\n- [**Prev Chapter**: Date Formatting](#5.Date_Formatting.md)\n\n## Time Interval Formatting\n\n- [6.0 - Format Interval as String](6.TimeInterval_Formatting.md#format)\n- [6.1 - Format Interval as Clock](6.TimeInterval_Formatting.md#clock)\n- [6.2 - Convert TimeInterval to Time Units](6.TimeInterval_Formatting.md#express)\n\nThe following methods are part of the `TimeInterval` extension provided by SwiftDate.\n\n<a name=\"format\"/>\n\n## 6.0 - Format Interval as String\nFormatting a time interval as a string is pretty simple, you just need to call the `.toString()` function of the `TimeInterval`.\nIt allows you to pick the right formatting options to represent the interval as a valid string.\n\n`func toString(options callback: ((inout ComponentsFormatterOptions) -> Void)? = nil) -> String`\n\nUsing a callback function you can configure the formatter as you need.\n\n- `options: ComponentsFormatterOptions`: allows to define the formatting options of the string.\n\n`ComponentsFormatterOptions` is a struct with the following properties:\n\n- `allowsFractionalUnits | Bool`: Fractional units may be used when a value cannot be exactly represented using the available units. For example, if minutes are not allowed, the value “1h 30m” could be formatted as “1.5h”. The default value of this property is false.\n- `allowedUnits | NSCalendar.Unit`: Specify the units that can be used in the output. By default `[.year, .month, .weekOfMonth, .day, .hour, .minute, .second]` are used.\n- `collapsesLargestUnit | Bool`: A Boolean value indicating whether to collapse the largest unit into smaller units when a certain threshold is met. By default is `false`.\n- `maximumUnitCount | Int`: The maximum number of time units to include in the output string. The default value of this property is 0, which does not cause the elimination of any units.\n- `zeroFormattingBehavior | DateComponentsFormatter.ZeroFormattingBehavior`: The formatting style for units whose value is 0. By default is `.default`\n- `unitsStyle | DateComponentsFormatter.UnitsStyle`: The preferred style for units. By default is `.abbreviated`.\n\nExamples:\n\n```swift\n// \"2 hours, 5 minutes, 32 seconds\"\nlet _ = (2.hours + 5.minutes + 32.seconds).timeInterval.toString {\n  $0.unitsStyle = .full\n  $0.collapsesLargestUnit = false\n  $0.allowsFractionalUnits = true\n}\n// \"2d 5h\"\nlet _ = (5.hours + 2.days).timeInterval.toString {\n  $0.unitsStyle = .abbreviated\n}\n```\n\n[^ Top](#index)\n\n<a name=\"clock\"/>\n\n## 6.1 - Format Interval as Clock\nSwiftDate allows to format a `TimeInterval` in the form of a clock or a countdown timer. (ie. `57:00:00`).\nTo format an interval using this style use `.toClock()` function.\n\n`func toClock(zero: DateComponentsFormatter.ZeroFormattingBehavior)`\n\ntakes one argument:\n\n- `zero | DateComponentsFormatter.ZeroFormattingBehavior`: define the representation of the zero values into the destination string. By default is set to `.pad`.\n\nExample:\n\n```swift\nlet _ = (2.hours + 5.minutes).timeInterval.toClock() // \"2:05:00\"\nlet _ = (4.minutes + 50.minutes).timeInterval.toClock(zero: .dropAll) // \"54:00\"\n```\n\n[^ Top](#index)\n\n<a name=\"express\"/>\n\n## 6.2 - Convert TimeInterval to Time Units\nWhile SwiftDate allows to carefully evaluate the differences between two dates and express them with the requested time unit (see [\"Get Intervals Between Two Dates\"](Date_Manipulation.md#interval), sometimes you may need to calculate this value from an absolute - calendar/locale indipendent - value expressed as `TimeInterval`.\n\nThe methods used to convert a an absolute amount of seconds is `toUnits()` (for multiple extraction) and `toUnit()` for single component extraction.\n\n`func toUnits(_ units: Set<Calendar.Component>, to refDate: DateInRegion? = nil) -> [Calendar.Component: Int]`\n`func toUnit(_ unit: Calendar.Component, to refDate: DateInRegion? = nil) -> Int?`\n\ntakes two arguments:\n\n- `units | Set<Calendar.Component>`: units to extract\n- `refDate | DateInRegion`: ending reference date, `nil` means `now()` in the context of the default region set. If `refDate` is `nil` evaluation is made from `now()` and `now() - interval` in the context of the `SwiftDate.defaultRegion` set.\n- `calendar | CalendarConvertible`: reference calendar; uses \n\nExample:\n\n```swift\n// \"[.day: 10, .hour: 12]\"\nlet _ = (36.hours + 2.days + 1.weeks).timeInterval.toUnits([.day, .hour])\n```\n\n[^ Top](#index)\n"
  },
  {
    "path": "Documentation/7.Format_UnicodeTable.md",
    "content": "![](./SwiftDate.png)\n\n- [**Index**: Table Of Contents](#Index.md)\n\n## Unicode Table for Date Formats\n \nThe following table is a summary of the most common configuration for Unicode Date Formatting. \n\nIf you want to know more check out [Date Field Symbol Table](https://unicode.org/reports/tr35/tr35-dates.html#Date_Field_Symbol_Table) on unicode.org.\n\n| Format  | Description | Example |\n| ------------- | ------------- | ------------- |\n| \"y\" | 1 digit min year | 1, 42, 2017 |\n| \"yy\" | 2 digit year | 01, 42, 17 |\n| \"yyy\" | 3 digit min year | 001, 042, 2017 |\n| \"yyyy\" | 4 digit min year | 0001, 0042, 2017 |\n| \"M\" | 1 digit min month | 7, 12 |\n| \"MM\" | 2 digit month  | 07, 12 |\n| \"MMM\" | 3 letter month abbr. | Jul, Dec |\n| \"MMMM\" | Full month | July, December |\n| \"MMMMM\" | 1 letter month abbr. | J, D |\n| \"d\" | 1 digit min day | 4, 25 |\n| \"dd\" | 2 digit day | 04, 25 |\n| \"E\", \"EE\", \"EEE\" | 3 letter day name abbr. | Wed, Thu |\n| \"EEEE\" | full day name | Wednesday, Thursday |\n| \"EEEEE\" | 1 letter day name abbr. | W, T |\n| \"EEEEEE\" | 2 letter day name abbr. | We, Th |\n| \"a\" | Period of day | AM, PM |\n| \"h\" | AM/PM 1 digit min hour | 5, 7 |\n| \"hh\" | AM/PM 2 digit hour | 05, 07 |\n| \"H\" | 24 hr 1 digit min hour | 17, 7 |\n| \"HH\" | 24 hr 2 digit hour | 17, 07 |\n| \"m\" | 1 digit min minute | 1, 40 |\n| \"mm\" | 2 digit minute | 01, 40 |\n| \"s\" | 1 digit min second | 1, 40 |\n| \"ss\" | 2 digit second | 01, 40 |\n| \"S\" | 10th's place of fractional second | 123ms -> 1, 7ms -> 0 |\n| \"SS\" | 10th's & 100th's place of fractional second | 123ms -> 12, 7ms -> 00 |\n| \"SSS\" | 10th's & 100th's & 1,000's place of fractional second | 123ms -> 123, 7ms -> 007 |\n\n[**Index**: Table Of Contents](#Index.md)\n"
  },
  {
    "path": "Documentation/8.Customize_ColloquialFormatter.md",
    "content": "![](./SwiftDate.png)\n\n<a name=\"index\"/>\n\n- [**Index**: Table Of Contents](#Index.md)\n\n## Customize Colloquial Formatter\n\n*To Be Completed*\n"
  },
  {
    "path": "Documentation/9.ColloquialSupportedLanguages.md",
    "content": "![](./SwiftDate.png)\n\n<a name=\"index\"/>\n\n- [**Index**: Table Of Contents](#Index.md)\n\n## Colloquial Formatter Supported Languages\nCurrently supported languages for relative formatter are (in long form):\n\n - Northern Sami\n - Persian\n - Turkmen\n - Faroese\n - Friulian\n - Hebrew\n - Polish\n - Romanian\n - Chinese (Simplified, Singapore)\n - Bangla\n - Indonesian\n - Northern Sami (Finland)\n - Slovak\n - Uyghur\n - Urdu (India)\n - Danish\n - Walser\n - Lao\n - Norwegian Nynorsk\n - Sinhala\n - Portuguese\n - Mazanderani\n - Kalaallisut\n - Spanish (Argentina)\n - Bulgarian\n - Lower Sorbian\n - Scottish Gaelic\n - Telugu\n - Punjabi\n - Pashto\n - Nepali\n - Albanian\n - Estonian\n - Welsh\n - Konkani\n - Colognian\n - Lakota\n - Malay\n - Chinese (Simplified, Macau China)\n - Bosnian\n - Swahili\n - Sakha\n - Filipino\n - Icelandic\n - Finnish\n - Tigrinya\n - Ngomba\n - English\n - Slovenian\n - Ewe\n - Spanish\n - Serbian (Latin)\n - Khmer\n - Japanese\n - Turkish\n - Sindhi\n - Kannada\n - Kazakh\n - Arabic (United Arab Emirates)\n - Uzbek\n - Western Frisian\n - Cantonese (Simplified)\n - German\n - Korean\n - Lithuanian\n - Tongan\n - Kyrgyz\n - French (Canada)\n - Odia\n - Belarusian\n - Mongolian\n - Tamil\n - Bosnian (Cyrillic)\n - Basque\n - Chinese (Simplified, Hong Kong China)\n - Chinese (Traditional, Hong Kong China)\n - Gujarati\n - Galician\n - Ukrainian\n - Greek\n - Spanish (United States)\n - Spanish (Mexico)\n - Malayalam\n - Vietnamese\n - Maltese\n - Chinese (Traditional)\n - Italian\n - Croatian\n - Assamese\n - Latvian\n - Chinese\n - Urdu\n - Catalan\n - Czech\n - Spanish (Paraguay)\n - Norwegian Bokmål\n - Burmese\n - Uzbek (Cyrillic)\n - Amharic\n - Afrikaans\n - Hungarian\n - Breton\n - Kabuverdianu\n - Luxembourgish\n - Russian\n - Cantonese (Traditional)\n - Marathi\n - Irish\n - Swedish\n - Thai\n - Armenian\n - Zulu\n - Georgian\n - Macedonian\n - Dzongkha\n - Dutch\n - Yiddish\n - Hindi\n - Arabic\n - French\n - Upper Sorbian\n\n"
  },
  {
    "path": "Documentation/Index.md",
    "content": "![](./SwiftDate.png)\n\n## Documentation\n\n- Reference Version: **6.3.0**\n- Last Update: **Nov 2020**\n\nThe following documentation explores all the major features of the library. If you are interested in a detailed, method by method documentation you can refeer to the Jazzy documentation generated by CocoaPods (you can also install in Dash).\n\n### Table Of Contents\n\n### [0 - Info & Install](0.Informations.md)\n\n- [Future Plans](0.Informations.md#futureplans)\n- [Compatibility & Requirements](0.Informations.md#compatibility)\n- [Installation (CocoaPods,Carthage,SwiftPM](0.Informations.md#installation)\n\n### [1 - Introduction to SwiftDate](1.Introduction.md)\n\n- [1.0 - Dates & Cocoa](1.Introduction.md#datesandcocoa)\n- [1.1 - Region & DateInRegion](1.Introduction.md#region_dateinregion)\n- [1.2 - The Default Region](1.Introduction.md#default_region)\n- [1.3 - Create Region](1.Introduction.md#creating_region)\n- [1.4 - Create DateInRegion](1.Introduction.md#creating_dateinregion)\n\t- [1.4.1 - From String](1.Introduction.md#initfromstring)\n\t- [1.4.2 - From Date Components](1.Introduction.md#initfromcomponents)\n\t- [1.4.3 - From TimeInterval](1.Introduction.md#initfromtimeinterval)\n\t- [1.4.4 - From Date](1.Introduction.md#initfromplaindate)\n\n### [2 - Date Parsing](2.Date_Parsing.md)\n\n- [2.0 - Parse Custom Format](2.Date_Parsing.md#autoparsing)\n- [2.1 - Parse ISO8601](2.Date_Parsing.md#iso8601)\n- [2.2 - Parse .NET](2.Date_Parsing.md#dotnet)\n- [2.3 - Parse RSS & AltRSS](2.Date_Parsing.md#rssaltrss)\n- [2.4 - Parse SQL](2.Date_Parsing.md#sql)\n\n### [3 - Date Manipulation & Creation](3.Manipulate_Date.md)\n\n- [3.0 - Add & Subtract Time Units from Date](3.Manipulate_Date.md#mathdate)\n- [3.1 - Get DateTime Components](3.Manipulate_Date.md#datecomponents)\n- [3.2 - Get Interval Between Dates](3.Manipulate_Date.md#interval)\n- [3.3 - Convert Date's Region (Locale/TimeZone/Calendar)](3.Manipulate_Date.md#convert)\n- [3.4 - Rounding Date](3.Manipulate_Date.md#roundingdate)\n- [3.5 - Trouncating Date](3.Manipulate_Date.md#trouncatingdate)\n- [3.6 - Set Time in Date](3.Manipulate_Date.md#altertimedate)\n- [3.7 - Set DateTime Components](3.Manipulate_Date.md#altercomponents)\n- [3.8 - Generate Related Dates (`nextYear, nextWeeekday, startOfMonth, startOfWeek, prevMonth`...)](3.Manipulate_Date.md#relateddates)\n- [3.9 - Date at start/end of time component](3.Manipulate_Date.md#startendcomponent)\n- [3.10 - Enumerate Dates](3.Manipulate_Date.md#enumeratedates)\n- [3.11 - Enumerate Dates for Weekday in Range](3.Manipulate_Date.md#enumerateweekdays)\n- [3.12 - Random Dates](3.Manipulate_Date.md#randomdates)\n- [3.13 - Sort Dates](3.Manipulate_Date.md#sort)\n- [3.14 - Get the next weekday](3.Manipulate_Date.md#nextWeekDay)\n- [3.15 - Get date at given week number/weekday](3.Manipulate_Date.md#dateAtWeeknumberWeekday)\n- [3.16 - Difference between dates with components](3.Manipulate_Date.md#differenceBetweenDates)\n- [3.17 - Create date at components preserving small components](3.Manipulate_Date.md#dateAtComponents)\n- [3.18 - Date at given weekday after # weeks](3.Manipulate_Date.md#dateAfterWeeks)\n- [3.19 - Next Date](3.Manipulate_Date.md#nextDate)\n\n### [4 - Compare Dates](4.Compare_Dates.md)\n\n- [4.0 - Compare Dates](4.Compare_Dates.md#standard)\n- [4.1 - Extended Comparison with Presets (`isToday, isTomorrow, isSameWeek, isNextYear` etc.)](4.Compare_Dates.md#extended)\n- [4.2 - Comparison with Granularity](4.Compare_Dates.md#granularity)\n- [4.3 - Check if Date is Close to Another](4.Compare_Dates.md#close)\n- [4.4 - Check if Date is Inside a Range](4.Compare_Dates.md#range)\n\n### [5 - Date Formatting](5.Date_Formatting.md)\n\n- [5.0 - Format Custom Style](5.Date_Formatting.md#customformatted)\n- [5.1 - ISO8601 Formatted String](5.Date_Formatting.md#isoformatted)\n- [5.2 - .NET Formatted String](5.Date_Formatting.md#dotnet)\n- [5.3 - RSS/AltRSS Formatted String](5.Date_Formatting.md#rss)\n- [5.4 - SQL Formatted String](5.Date_Formatting.md#sql)\n- [5.5 - Relative/Colloquial Formatted String](5.Date_Formatting.md#colloquial)\n- [5.6 - Mixed Date/Time Style](5.Date_Formatting.md#mixeddatetime)\n\n### [6 - Time Intervals Formatting](6.TimeInterval_Formatting.md)\n\n- [6.0 - Format Interval as String](6.TimeInterval_Formatting.md#format)\n- [6.1 - Format Interval as Clock](6.TimeInterval_Formatting.md#clock)\n- [6.2 - Convert TimeInterval to Time Units](6.TimeInterval_Formatting.md#express)\n\n\n#### Other Links\n- [7 - Unicode Table for Date Formats](7.Format_UnicodeTable.md)\n- [8 - Customize Colloquial Formatter](8.Customize_ColloquialFormatter.md)\n- [9 - Colloquial Formatter Supported Languages](9.ColloquialSupportedLanguages.md)\n"
  },
  {
    "path": "LICENSE",
    "content": "The MIT License (MIT)\n\nCopyright (c) 2018 Daniele Margutti\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n\n"
  },
  {
    "path": "Package.swift",
    "content": "// swift-tools-version:5.5\nimport PackageDescription\n\nlet package = Package(\n    name: \"SwiftDate\",\n    defaultLocalization: \"it\",\n    platforms: [\n        .macOS(.v10_15), .iOS(.v13), .watchOS(.v6), .tvOS(.v13)\n    ],\n    products: [\n        // Products define the executables and libraries produced by a package, and make them visible to other packages.\n        .library(name: \"SwiftDate\", targets: [\"SwiftDate\"])\n    ],\n    dependencies: [],\n    targets: [\n        .target(\n            name: \"SwiftDate\",\n            dependencies: [],\n\t\t\tresources: [\n\t\t\t\t.copy(\"Formatters/RelativeFormatter/langs\"),\n                .process(\"Resources\")\n\t\t\t]),\n        .testTarget(\n            name: \"SwiftDateTests\",\n            dependencies: [\"SwiftDate\"])\n    ]\n)\n"
  },
  {
    "path": "Playgrounds/SwiftDate.playground/Pages/Compare Dates.xcplaygroundpage/Contents.swift",
    "content": "import Foundation\nimport SwiftDate\n"
  },
  {
    "path": "Playgrounds/SwiftDate.playground/Pages/Date Formatting.xcplaygroundpage/Contents.swift",
    "content": "import Foundation\nimport SwiftDate\n/*:\n## 5.0 - Format Custom Style\nIf you need to format a `Date` or `DateInRegion` in a String using a custom format you need to use `toFormat(_:locale:)` function.\n*/\nlet rome = Region(calendar: Calendars.gregorian, zone: Zones.europeRome, locale: Locales.italian)\nlet date1 = DateInRegion(year: 2015, month: 1, day: 15, hour: 20, minute: 00, second: 5, nanosecond: 0, region: rome)\n\n// Even if date's locale is set to `italin` we can still\n// print in a different language by passing a non nil locale\n// to the function.\nlet formattedString = date1.toFormat(\"MMM dd yyyy\", locale: Locales.english) // \"Jan 15 2015\"\n/*:\n\n## 5.1 - ISO8601 Formatted String\nSwiftDate allows to print date instances using a configurable ISO8601 formatter which is also compatible with older version of iOS where the Apple's own class is not available.\n\nTo use the ISO formatter call `.toISO()` function\n*/\nlet date2 = DateInRegion(\"2017-07-22 00:00:00\", format: \"yyyy-MM-dd HH:mm:ss\", region: rome)!\n\n// ISO Formatting\nlet date2_str1 = date2.toISO() // \"2017-07-22T00:00:00+02:00\"\nlet date2_str2 = date2.toISO([.withFullDate]) // \"2017-07-22\"\nlet date2_str3 = date2.toISO([.withFullDate, .withFullTime, .withDashSeparatorInDate, .withSpaceBetweenDateAndTime]) // \"2017-07-22 00:00:00+02:00\"\n/*:\n\n## 5.2 - .NET Formatted String\nCSOM DateTime (aka .NET DateTime) is a format defined by Microsoft as the number of 100-nanosecond intervals that have elapsed since 12:00 A.M., January 1, 0001 ([learn more on MSDN documentation page](https://msdn.microsoft.com/en-us/library/dd948679)).\n\nUse the `.toDotNET()` function to create a string from a date instance.\n*/\nlet date3 = \"2017-06-20T14:49:19+02:00\".toISODate()!\nlet date3_dotNetString = date3.toDotNET() // \"/Date(1497962959000+0200)/\"\n/*:\n\n## 5.3 - RSS/AltRSS Formatted String\nRSS and AltRSS formatted string can be generated from an instance of `Date` or `DateInRegion` using the `.toRSS()` function.\n*/\n\nlet rssString = date3.toRSS(alt: false) // \"Tue, 20 Jun 2017 14:49:19 +0200\"\nlet altRSSString = date3.toRSS(alt: true) // \"20 Jun 2017 14:49:19 +0200\"\n/*:\n\n## 5.4 - SQL Formatted String\nTo print SQL formatted string from a date instance you need to use the `.toSQL()` function.\n*/\nlet sqlString = date3.toSQL() // \"2015-11-19T22:20:40.000+01\"\n/*:\n\n## 5.5 - Relative/Colloquial Formatted String\nColloquial format allows you to produce human friendly string as result of the difference between a date and a a reference date (typically now).\nExamples of colloquial formatted strings are `3 mins ago`, `2 days ago` or `just now`.\n\nSwiftDate supports over 140+ languages to produce colloquial formatted strings; the entire engine behind the library is fully customizable so, if you need, you can override default strings and produce your own variants.\n\nTo print a colloquial variant of a string just call `.toRelative()` function from a `Date` or `DateInRegion` instance.\n*/\nlet ago5Mins = DateInRegion() - 5.minutes\n_ = ago5Mins.toRelative(style: RelativeFormatter.defaultStyle(), locale: Locales.italian) // \"5 minuti fa\"\n\nlet justNow2 = DateInRegion() - 2.hours\n_ = justNow2.toRelative(style: RelativeFormatter.twitterStyle(), locale: Locales.italian) // \"2h fa\"\n\nlet justNow = DateInRegion() - 10.seconds\n_ = justNow.toRelative(style: RelativeFormatter.twitterStyle(), locale: Locales.italian) // \"ora\"\n"
  },
  {
    "path": "Playgrounds/SwiftDate.playground/Pages/Date Manipulation.xcplaygroundpage/Contents.swift",
    "content": "import Foundation\nimport SwiftDate\n\n/*:\n## 3.0 - Add & Subtract Time Units from Date\n\nSwiftDate allows to use numbers to work with time components in dates. By extending the `Int` type it defines a list of time units:\n\n- `nanoseconds`\n- `seconds`\n- `minutes`\n- `days`\n- `weeks`\n- `months`\n- `quarters`\n- `years`\n\nYou can use a value followed by one of these unit specifications to add or remove the component from a date.\n\nSo, for example, you can produce a date which can be a mix of intuitive math operations:\n*/\nlet date1 = DateInRegion() + 1.years\nlet date2 = DateInRegion() - 2.minutes\nlet date3 = date2 + 3.hours - 5.minutes + 1.weeks\n/*:\n> IMPORTANT NOTE: These values are converted automatically to `DateComponents` evaluated in the same context of the target `Date` or `DateInRegion`'s `calendar`.\n\nAnother way to add time components to a date is to use the `dateByAdding()` function:\n*/\nlet date4 = DateInRegion().dateByAdding(5, .month)\n/*:\n\n## 3.1 - Get DateTime Components Components\nWith SwiftDate you have several convenience properties to inspect each datetime unit of a date, both for `Date` and `DateInRegion`.\n\nThese properties are strictly correlated to the date's calendar (and some also with locale): if you are manipulating a `DateInRegion` remember these properties return values in the context of the associated `region` attributes (Locale, TimeZone and Calendar).\n\n> **IMPORTANT NOTE**: If you are working with plain `Date` properties uses as reference the currently set `SwiftDate.defaultRegion` which, unless you modify it, is set to Gregorian/UTC/Device's Language.\n*/\nlet regionNY = Region(calendar: Calendars.gregorian, zone: Zones.americaNewYork, locale: Locales.english)\nlet date5 = DateInRegion(components: {\n\t$0.year = 2015\n\t$0.month = 6\n\t$0.day = 1\n\t$0.hour = 23\n}, region: regionNY)!\n\nprint(\"Origin date in NY: \\(date5.hour):\\(date5.minute) of \\(date5.day)/\\(date5.month)\")\nprint(\"Month is \\(date5.monthName(.default).uppercased())\")\nprint(\"Month in italian is \\(date5.convertTo(locale: Locales.italian).monthName(.default).uppercased())\")\n\n// We can convert it to UTC and get the same properties which are now updated!\nlet date5InUTC = date5.convertTo(region: Region.UTC)\nprint(\"Converted date in UTC: \\(date5InUTC.hour):\\(date5InUTC.minute) of \\(date5InUTC.day)/\\(date5InUTC.month)\")\n/*:\n\n## 3.2 - Get Interval Between Dates\nYou can get the interval between two dates and express it in form of time units easily with SwiftDate.\n*/\nlet format = \"yyyy-MM-dd HH:mm:ss\"\nlet date6 = DateInRegion(\"2017-07-22 00:00:00\", format: format, region: regionNY)!\nlet date7 = DateInRegion(\"2017-07-23 12:00:00\", format: format, region: regionNY)!\n\nlet hours = date6.getInterval(toDate: date7, component: .hour) // 36 hours\nlet days = date6.getInterval(toDate: date7, component: .day) // 1 day\n/*:\n## 3.3 - Convert Date's Region (Locale/TimeZone/Calendar)\n`DateInRegion` can be converted easily to anothe region just using `.convertTo(region:)` or `.convertTo(calendar: timezone:locale:)` functions.\n\n- `convertTo(region:)` convert the receiver date to another region. Region may include a different time zone for example, or a locale.\n- `convertTo(calendar:timezone:locale:)` allows to convert the receiver date instance to a specific calendar/timezone/locale. All parameters are optional and only non-nil parameters alter the final region. For a nil param the current receiver's region attribute is kept.\n\nExamples:\n*/\n// Create a date in NY: \"2001-09-11 12:00:05\"\nlet date8 = DateInRegion(components: {\n\t$0.year = 2001\n\t$0.month = 9\n\t$0.day = 11\n\t$0.hour = 12\n\t$0.minute = 0\n\t$0.second = 5\n}, region: regionNY)!\n// Convert to GMT timezone (and locale)\nlet date8inGMT = date8.convertTo(region: Region.UTC) // date is now: \"2001-09-11 16:00:05\"\nprint(date8inGMT.toISO())\n/*:\n\n## 3.4 - Rounding Date\n\n`.dateRoundedAt()` function allows to round a given date time to the passed style: off, up or down.\n*/\nlet regionRome = Region(calendar: Calendars.gregorian, zone: Zones.europeRome, locale: Locales.italian)\n\n// Round down 10mins\nlet date9 = DateInRegion(\"2017-07-22 00:03:50\", format: format, region: regionRome)!\nlet r10min = date9.dateRoundedAt(.to10Mins)\n/*:\n\n## 3.5 - Trouncating Date\nSometimes you may need to truncate a date by zeroing all values below certain time unit. `.dateTruncated(from:) and .dateTruncated(to:)` functions can be used for this scope.\n\n#### Truncating From\nIt creates a new instance by truncating the components starting from given components down the granurality.\n\n`func dateTruncated(from component: Calendar.Component) -> DateInRegion?`\n\n#### Truncated At\nIt creates a new instance by truncating all passed components.\n\n`func dateTruncated(at components: [Calendar.Component]) -> DateInRegion?`\n*/\nlet date10 = \"2017-07-22 15:03:50\".toDate(\"yyyy-MM-dd HH:mm:ss\", region: regionRome)!\n\nlet truncatedTime = date10.dateTruncated(from: .hour)\nlet truncatedCmps = date10.dateTruncated(at: [.month, .day, .minute])\n/*:\n\n## 3.6 - Set Time in Date\nSometimes you may need to alter time in a specified date. SwiftDate allows you to perform this using `.dateBySet(hour:min:secs:options:)` function.\n*/\nlet date11 = DateInRegion(\"2010-01-01 00:00:00\", format: \"yyyy-MM-dd HH:mm:ss\", region: regionRome)!\nlet alteredDate = date11.dateBySet(hour: 20, min: 13, secs: 15)\n/*:\n## 3.7 - Set DateTime Components\nSwiftDate allows you to return new date representing the date calculated by setting a specific components of a given date to  given values, while trying to keep lower components the same (altering more components at the same time may result in different-than-expected results, this because lower components maybe need to be recalculated).\n*/\nlet date12 = date11.dateBySet([.month: 1, .day: 1, .hour: 9, .minute: 26, .second: 0])\n/*:\n## 3.8 - Generate Related Dates (`nextYear, nextWeeekday, startOfMonth, startOfWeek, prevMonth`...)\nSometimes you may need to generate a related date from a specified instance; maybe the next sunday, the first day of the next week or the start datetime of a date.\nSwiftDate includes 20+ different \"interesting\" dates you can obtain by calling `.dateAt()` function from any `Date` or `DateInRegion` instance.\n*/\n// Return today's datetime at 00:00:00\nlet date13 = DateInRegion().dateAt(.startOfDay)\n// Return today's datetime at 23:59:59\nlet date14 = DateInRegion().dateAt(.endOfDay)\n// Return the date at the start of this week\nlet date15 = DateInRegion().dateAt(.startOfWeek)\n// Return current time tomorrow\nlet date16 = DateInRegion().dateAt(.tomorrow)\n// Return the next sunday from specified date\nlet date17 = date16.dateAt(.nextWeekday(.sunday))\n// and so on...\n\n/*:\n\n## 3.9 - Date at start/end of time component\nTwo functions called `.dateAtStartOf()` and `.dateAtEndOf()` allows you to get the related date from a `Date`/`DateInRegion` instance moved at the start or end of the specified component.\n*/\n// Return today's date at 23:59:59\nlet date18 = DateInRegion().dateAtEndOf(.day)\n// Return the first day's date of the month described in date1\nlet date19 = DateInRegion().dateAtStartOf(.month)\n// Return the first day of the current week at 00:00\nlet date20 = DateInRegion().dateAtStartOf([.week, .day])\n/*:\n\n## 3.10 - Enumerate Dates\nDates enumeration function allows you to generate a list of dates in a closed date intervals incrementing date components by a fixed or variable interval at each new date.\n\n- **VARIABLE INCREMENT** `static func enumerateDates(from startDate: DateInRegion, to endDate: DateInRegion, increment: ((DateInRegion) -> (DateComponents))) -> [DateInRegion]`\n- **FIXED INCREMENT** `static func enumerateDates(from startDate: DateInRegion, to endDate: DateInRegion, increment: DateComponents) -> [DateInRegion]`\n*/\nlet toDate = DateInRegion()\nlet fromDate = toDate - 30.days\nlet dates = DateInRegion.enumerateDates(from: fromDate, to: toDate, increment: DateComponents.create {\n\t$0.hour = 1\n\t$0.minute = 30\n})\n/*:\n\n## 3.11 - Random Dates\nSwiftDate exposes a set of functions to generate a random date or array of random dates in a bounds.\nThere are several functions to perform this operation:\n*/\nlet randomDates = DateInRegion.randomDates(count: 40,\n\t\t\t\t\t\t\t\t\t\t   between: fromDate,\n\t\t\t\t\t\t\t\t\t\t   and: toDate)\nlet randomDate = DateInRegion.randomDate(withinDaysBeforeToday: 7, region: regionRome)\n/*:\n\n## 3.12 - Sort Dates\nTwo conveniences function allows you to sort an array of dates by newest or oldest. Naming is pretty simple:\n*/\nlet orderedByNewest = DateInRegion.sortedByNewest(list: randomDates)\nlet oldestDate = DateInRegion.oldestIn(list: randomDates)\n"
  },
  {
    "path": "Playgrounds/SwiftDate.playground/Pages/Date Parsing.xcplaygroundpage/Contents.swift",
    "content": "import Foundation\nimport SwiftDate\n\n/*:\nParsing dates is pretty straighforward in SwiftDate; library can parse strings with dates automatically by recognizing one of the most common patterns. Moreover you can provide your own formats or use one of the built-in parsers.\nIn the following chapter you will learn how to transform a string to a date.\n\n## 2.0 - Parse Custom Format\n\nThe easiest way to transform an input string to a valid date is to use one of the `.toDate()` functions available as `String`'s instance extensions. The purpose of these method is to get the best format can represent the input string and use it to generate a valid `DateInRegion`.\n\nAs like other libs like moment.js, SwiftDate has a list of built-in formats it can use in order to obtain valid results.\nYou can get the list of these formats by calling `SwiftDate.autoFormats`.\nThe order of this array is important because SwiftDate iterates over this list until a valid date is returned (the order itself allows the lib to reduce the list of false positives).\n*/\nlet itRegion = Region(calendar: Calendars.gregorian, zone: Zones.europeRome, locale: Locales.italian)\nlet enRegion = Region(calendar: Calendars.gregorian, zone: Zones.europeRome, locale: Locales.english)\n\nlet date1 = \"2018-01-01 15:00\".toDate()\nlet date2 = \"15:40:50\".toDate(\"HH:mm:ss\")\nlet date3 = \"2015-01-01 at 14\".toDate(\"yyyy-MM-dd 'at' HH\", region: itRegion)\n\nlet srcString = \"July 15 - 15:30\"\n// it returns nil because itRegion has Locales.italian\nlet date4 = srcString.toDate([\"yyyy-MM-dd\", \"MMM dd '-' HH:mm\"], region: itRegion)\n// it's okay because enRegion has locale set to english\nlet date5 = srcString.toDate([\"yyyy-MM-dd\", \"MMM dd '-' HH:mm\"], region: enRegion)\n/*:\n> **PERFORMANCES** In order to preserve performances you should pass the `format` parameter if you know the input format.\n\n> **LOCALE PARAMETER** If you use readable unit names (like `MMM` for months) be sure to select the right locale inside the `region` parameter in order to get valid results.\n\n## 2.1 Parse ISO8601\nA special note must be made for ISO8601. This format (the extended version and all its variants) may include the timezone information.\nIf you need to parse an ISO8601 datetime you should therefore use the `.toISODate()` function of `String` in order to get a complete result.\n\n> **NOTE** ISO8601 parser (via `.toISODate()` func) is capable of recognizing all the variants of the 8601 formats; if your date is in this formt use this function instead of passing custom time format. It will lead in better results.\n*/\nlet date = \"2017-08-05T16:04:03+02:00\".toISODate(region: Region.ISO)!\n// returned date's region.zone is GMT+2 not the default's Region.ISO's GMT0.\n// This because value is read from the string itself.\nprint(\"Date is located in \\(date.region)\")\n/*:\n## 2.2 - Parse .NET\nCSOM DateTime (aka .NET DateTime) is a format defined by Microsoft as the number of 100-nanosecond intervals that have elapsed since 12:00 A.M., January 1, 0001 ([learn more on MSDN documentation page](https://msdn.microsoft.com/en-us/library/dd948679)).\n\nYou can parse a CSOM datetime string using the `toDotNETDate()` function.\n\n> **NOTE:** As for ISO8601 even .NET datetime may contain information about timezone. When you set the region as input parameter of the conversion function remember: it will be overriden by default parsed timezone (GMT if not specified). Region is used for `locale` only.\n*/\n// This is the 2017-07-22T18:27:02+02:00 date.\nlet date6 = \"/Date(1500740822000+0200)/\".toDotNETDate()!\nprint(\"Date is \\(date6.toISO())\")\n/*:\n\n## 2.3 - Parse RSS & AltRSS\nRSS & AltRSS datetime format are used in RSS feed files. Parsing in SwiftDate is pretty easy; just call the `.toRSSDate()` function.\n\n> **NOTE:** As for ISO8601 even RSS/AltRSS datetime contain information about timezone. When you set the region as input parameter of the conversion function remember: it will be overriden by default parsed timezone (GMT if not specified). Region is used for `locale` only.\n*/\n// This is the ISO8601: 2017-07-22T18:27:02+02:00\nlet date7 = \"Sat, 22 Jul 2017 18:27:02 +0200\".toRSSDate(alt: false)!\nprint(\"RSS Date is \\(date7.toISO())\")\n\n// NOTE:\n// Even if we set a random region with a custom locale,\n// calendar and timezone, final parsed date still correct.\n// Only the locale parameter is set.\n// Other region's parameter are ignored and read from the string itself.\nlet regionAny = Region(calendar: Calendars.buddhist, zone: Zones.indianMayotte, locale: Locales.italian)\nlet date8 = \"Tue, 20 Jun 2017 14:49:19 +0200\".toRSSDate(alt: false, region: regionAny)!\nprint(\"RSS Date is \\(date8.toISO())\")\n/*:\n\n## 2.4 - Parse SQL\nSQL datetime is the format used in all SQL-compatible schemas.\nYou can parse a string in this format using `toSQLDate()` function.\n*/\n// Date in ISO is 2016-04-14T11:58:58+02:00\nlet date9 = \"2016-04-14T11:58:58.000+02\".toSQLDate()!\nprint(\"SQL Date is \\(date9.toISO())\")\n"
  },
  {
    "path": "Playgrounds/SwiftDate.playground/Pages/Introduction.xcplaygroundpage/Contents.swift",
    "content": "import Foundation\nimport SwiftDate\n/*:\n## 1.0 - Dates & Cocoa\n\nGenerally when you talk about dates you are brought to think about a particular instance of time in a particular location of the world. However, in order to get a fully generic implementationn Apple made `Date` fully indipendent from any particular geographic location, calendar or locale.\n\nA plain `Date` object just represent an absolute value: in fact it count the number of seconds elapsed since January 1, 2001.\n\nThis is what we call **Universal Time because it represent the same moment everywhere around the world**.\n\nYou can see absolute time as the moment that someone in the USA has a telephone conversation with someone in Dubai; both have that conversation at the same moment (the absolute time) but the local time will be different due to time zones, different calendars, alphabets or notation methods.\n*/\nlet now = Date()\nprint(\"\\(now.timeIntervalSinceReferenceDate) seconds elapsed since Jan 1, 2001 @ 00:00 UTC\")\n/*:\nHowever, we often need to represent a date in a more specific context: **a particular place in the world, printing them using the rules of a specified locale and more**.\n\nIn order to accomplish it we need to introduce several other objects: a `Calendar`, a `TimeZone` and a `Locale`; combining these attributes we're finally ready to provide a **representation** of the date into the real world.\n\nSwiftDate allows you to parse, create, manipulate and inspect dates in an easy and more natural way than Cocoa itself.\n\n## 1.1 - Region & DateInRegion\n\nIn order to simplify the date management in a specific context SwiftDate introduces two simple structs:\n\n- `Region` is a struct which define a region in the world (`TimeZone`) a language (`Locale`) and reference calendar (`Calendar`).\n- `DateInRegion` represent an absolute date in a specific region. When you work with this object all components are evaluated in the context of the region in which the object was created. Inside a DateInRegion you will have an `absoluteDate` and `region` properties.\n\n## 1.2 - The Default Region\n\nIn SwiftDate you can work both with `DateInRegion` and `Date` instances.\nEven plain Date objects uses `Region` when you need to extract time units, compare dates or evaluate specific operations.\n\nHowever this is a special region called **Default Region** and - by default - it has the following attributes:\n\n- **Time Zone** = GMT - this allows to keep a coerent behaviour with the default Date managment unless you change it.\n- **Calendar** = current's device calendar (auto updating)\n- **Locale** = current's device lcoale (auto updating)\n\nWhile it's a good choice to always uses `DateInRegion` you can also work with `Date` by changing the default region as follow:\n*/\nlet rome = Region(calendar: Calendars.gregorian, zone: Zones.europeRome, locale: Locales.italian)\nSwiftDate.defaultRegion = rome\n/*:\nSince now all `Date` instances uses `rome` as default region both for parsing and evaluating date components:\n*/\nlet dateInRome = \"2018-01-01 00:00:00\".toDate()!\nprint(\"Current year is \\(dateInRome.year) and hour is \\(dateInRome.hour)\") // \"Current year is 2018 and hour is 0\\n\"\n/*:\nWe can still convert this date to the default absolute representation in UTC using the `convertTo(region:)` function:\n*/\nlet dateInUTC = dateInRome.convertTo(region: Region.UTC)\nprint(\"Current year is \\(dateInUTC.year) and hour is \\(dateInUTC.hour)\") // \"Current year is 2017 and hour is 23\\n\"\n/*:\nBe careful while setting the default region.\nWe still reccomends to use the `DateInRegion` instances instead, this allows you to read the region explicitly.\n\n## 1.3 - Create Region\n\nAs you seen from previous example creating a new `Region` is pretty straightforward; you need to specify the locale (used to print localized values like month or weekday name of the date), a timezone and a calendar (usually gregorian).\n\nRegion instances accept the following parameters in form of protocols:\n\n- Time zone as `ZoneConvertible` conform object. You can pass both a `TimeZone` instance or any of the predefined timezones region defined inside the `Zones` enumeration.\n- Calendar as `CalendarConvertible` conform object. You can pass both a `Calendar` instance or any of the predefined calendars available inside the `Calendars` enumeration.\n- Locale as `LocaleConvertible` conform object. You can pass a both a `Locale` instance or any of the predefined locales available inside the `Locales` enumeration.\n\nUsing `Zones`, `Calendars` and `Locales` enumeration values is the easiest way to create a region and compiler can also suggest you the best match for your search.\n\nThe following example create two regions with different attributes:\n*/\nlet regionNY = Region(calendar: Calendars.gregorian, zone: Zones.americaNewYork, locale: Locales.englishUnitedStates)\nlet regionTokyo = Region(calendar: Calendars.gregorian, zone: Zones.asiaTokyo, locale: Locales.japanese)\n/*:\n## 1.4 - Create DateInRegion\nNow you are ready to create a new `DateInRegion`. There are many different ways to create a new date: parsing a string, setting time components, derivating it from another date or from a given time intervals.\n\nEach initialization method require a region parameter which defines the region in which the date is expressed (default values may vary based upon the init and are listed below).\n### 1.4.1 - From String\nThe most common case is to parse a string and transform it to a date. As you know `DateFormatter` is an expensive object to create and if you need to parse multiple strings you should avoid creating a new instance in your loop.\nDon't worry: using SwiftDate the library helps you by reusing its own parser, shared along the caller thread.\n\n`DateInRegion`'s `init(_:format:region)` can be used to initialize a new date from a string (various shortcut are available under the `toXXX` prefix of `String` extensions.\n\nThis object takes three parameters:\n\n- the `string` to parse (`String`)\n- the format of the string (`String`): this represent the format in which the string is expressed. It's a unicode format ([See the table of fields](7.Format_UnicodeTable.md)). If you skip this parameter SwiftDate attempts to parse the date using one of the built-in formats defined in `SwiftDate.autoFormats` array. If you know the format of the date you should explicitly set it in order to get better performances.\n-  the `region` in which the date is expressed (`Region`). By default is set to `SwiftDate.defaultRegion`.\n*/\nlet date1 = DateInRegion(\"2016-01-05\", format: \"yyyy-MM-dd\", region: regionNY)\nlet date2 = DateInRegion(\"2015-09-24T13:20:55\", region: regionNY)\n/*:\n### 1.4.2 - From Components\nYou can create a `DateInRegion` also by setting the date components.\nThe following method create a date from `DateComponents` instance passed via builder pattern:\n*/\nlet date3 = DateInRegion(components: {\n\t$0.year = 2018\n\t$0.month = 2\n\t$0.day = 1\n\t$0.hour = 23\n}, region: regionNY)\n/*:\nYou can also instance it by passing single (optional) components:\n*/\nlet date4 = DateInRegion(year: 2015, month: 2, day: 4, hour: 20, minute: 00, second: 00, region: regionNY)\n/*:\n### 1.4.3 - From TimeInterval\nAs plain `Date` you can create a new `DateInRegion` just passing an absolute time interval which represent the seconds/milliseconds from Unix epoch.\nThe following method create a date 1 year after the Unix Epoch (1971-01-01T00:00:00Z):\n*/\nlet date5 = DateInRegion(seconds: 1.years.timeInterval, region: regionNY)\nlet date6 = DateInRegion(milliseconds: 5000, region: regionNY)\n/*:\n### 1.4.4 - From Date\nFinally you can init a new `DateInRegion` directly specifyng an absolute `Date` and a destination region:\n*/\nlet absoluteDate: Date = (Date() - 2.months).dateAt(.startOfDay)\nlet date7 = DateInRegion(absoluteDate, region: regionNY)\n"
  },
  {
    "path": "Playgrounds/SwiftDate.playground/contents.xcplayground",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n<playground version='6.0' target-platform='ios' display-mode='raw' executeOnSourceChanges='false'>\n    <pages>\n        <page name='Introduction'/>\n        <page name='Date Parsing'/>\n        <page name='Date Manipulation'/>\n        <page name='Compare Dates'/>\n        <page name='Date Formatting'/>\n    </pages>\n</playground>"
  },
  {
    "path": "README.md",
    "content": "<p align=\"center\" >\n  <img src=\"banner.png\" width=300px alt=\"SwiftDate\" title=\"SwiftDate\">\n</p>\n\n<p align=\"center\"><strong>Toolkit to parse, validate, manipulate, compare and display dates, time & timezones in Swift.</strong></p>\n\n## What's This?\n\nSwiftDate is the **definitive toolchain to manipulate and display dates and time zones** on all Apple platform and even on Linux and Swift Server Side frameworks like Vapor or Kitura.  \n**Over 3 million of downloads on [CocoaPods](https://cocoapods.org/pods/SwiftDate).**\n\nFrom simple date manipulation to complex business logic SwiftDate maybe the right choice for your next project.\n\n- [x] **Easy Date Parsing** (custom formats, iso8601, rss & many more)\n- [x] **Easy Date Formatting** even with colloquial formatter and 140+ supported languages\n- [x] **Easy math operations with time units** (`2.hours + 5.minutes`...)\n- [x] **Intuitive components extraction** (`day, hour, nearestHour, weekdayNameShort` etc.)\n- [x] **Derivated dates generation** (`nextWeek, nextMonth, nextWeekday, tomorrow`...)\n- [x] Over **20+ fine grained date comparison** functions (`isToday, isTomorrow, isSameWeek, isNextYear`...)\n- [x] Swift 4's **Codable Support**\n- [x] **Random dates** generation\n- [x] **Fine grained date enumeration** functions\n- [x] **Time period** support\n- [x] **Convert TimeIntervals** to other units (`2.hours.toUnits(.minutes)`)\n\nand of course...\n\n- **IT'S TESTED!**. As 5.x the project has 90% of code coverage (want help us? write some unit tests and make a PR)\n- **IT'S FULLY DOCUMENTED!**, [both with a complete guide](/Documentation/Index.md) and with Jazzy!\n- **WE LOVE PLAYGROUND!** [Check out](/Playgrounds/SwiftDate.playground) our interactive playground!\n\n\n## Start with SwiftDate\n\nThe entire library is fully documented both via XCode method inspector and a complete markdown documentation you can found below.\n\n- → **[Full Documentation](/Documentation/Index.md)**\n- → **[Requirements, Install, License & More](/Documentation/0.Informations.md)**\n- → **[Upgrading from SwiftDate 4](/Documentation/10.Upgrading_SwiftDate4.md)**\n\n### Explore SwiftDate\n\nFrom simple date manipulation to complex business logic SwiftDate maybe the right choice for your next project.\n\nLet me show to you the main features of the library:\n\n- [Date Parsing](#1)\n- [Date Manipulation](#2)\n- [Date Comparsion](#3)\n- [Date Creation with Region (Timezone, Calendar & Locale)](#4)\n- [Derivated Dates](#5)\n- [Components Extraction](#6)\n- [Switch between timezones/locale and calendars](#7)\n- [Date Formatting](#8)\n- [Relative Date Formatting (fully customizable!)](#9)\n- [Codable Support](#10)\n- [Time Periods](#11)\n\n<a name=\"1\"/>\n\n### 1. Date Parsing\nSwiftDate can recognize all the major datetime formats  automatically (ISO8601, RSS, Alt RSS, .NET, SQL, HTTP...) and you can also provide your own formats.\nCreating a new date has never been so easy!\n\n```swift\n// All default datetime formats (15+) are recognized automatically\nlet _ = \"2010-05-20 15:30:00\".toDate()\n// You can also provide your own format!\nlet _ = \"2010-05-20 15:30\".toDate(\"yyyy-MM-dd HH:mm\")\n// All ISO8601 variants are supported too with timezone parsing!\nlet _ = \"2017-09-17T11:59:29+02:00\".toISODate()\n// RSS, Extended, HTTP, SQL, .NET and all the major variants are supported!\nlet _ = \"19 Nov 2015 22:20:40 +0100\".toRSS(alt: true)\n\n```\n\n<a name=\"2\"/>\n\n### 2. Date Manipulation\nDate can be manipulated by adding or removing time components using a natural language; time unit extraction is also easy and includes the support for timezone, calendar and locales!\n\nManipulation can be done with standard math operators and between dates, time intervals, date components and relevant time units!\n\n```swift\n// Math operations support time units\nlet _ = (\"2010-05-20 15:30:00\".toDate() + 3.months - 2.days)\nlet _ = Date() + 3.hours\nlet _ = date1 + [.year:1, .month:2, .hour:5]\nlet _ = date1 + date2\n// extract single time unit components from date manipulation\nlet over1Year = (date3 - date2).year > 1\n```\n<a name=\"3\"/>\n\n### 3. Date Comparison\nSwiftDate include an extensive set of comparison functions; you can compare two dates by granularity, check if a date is an particular day, range and practically any other comparison you ever need.\n\nComparison is also available via standard math operators like (`>, >=, <, <=`).\n\n```swift\n// Standard math comparison is allowed\nlet _ = dateA >= dateB || dateC < dateB\n\n// Complex comparisons includes granularity support\nlet _ = dateA.compare(toDate: dateB, granularity: .hour) == .orderedSame\nlet _ = dateA.isAfterDate(dateB, orEqual: true, granularity: .month) // > until month granularity\nlet _ = dateC.isInRange(date: dateA, and: dateB, orEqual: true, granularity: .day) // > until day granularity\nlet _ = dateA.earlierDate(dateB) // earlier date\nlet _ = dateA.laterDate(dateB) // later date\n\n// Check if date is close to another with a given precision\nlet _ = dateA.compareCloseTo(dateB, precision: 1.hours.timeInterval\n\n// Compare for relevant events:\n// .isToday, .isYesterday, .isTomorrow, .isWeekend, isNextWeek\n// .isSameDay, .isMorning, .isWeekday ...\nlet _ = date.compare(.isToday)\nlet _ = date.compare(.isNight)\nlet _ = date.compare(.isNextWeek)\nlet _ = date.compare(.isThisMonth)\nlet _ = date.compare(.startOfWeek)\nlet _ = date.compare(.isNextYear)\n// ...and MORE THAN 30 OTHER COMPARISONS BUILT IN\n\n// Operation in arrays (oldestIn, newestIn, sortedByNewest, sortedByOldest...)\nlet _ = DateInRegion.oldestIn(list: datesArray)\nlet _ = DateInRegion.sortedByNewest(list: datesArray)\n```\n\n<a name=\"4\"/>\n\n### 4. Date Creation with Region (Timezone, Calendar & Locale)\nYou can create new dates from a string, time intervals or using date components. SwiftDate offers a wide set of functions to create and derivate your dates even with random generation!\n\n```swift\n// All dates includes timezone, calendar and locales!\n// Create from string\nlet rome = Region(calendar: Calendars.gregorian, zone: Zones.europeRome, locale: Locales.italian)\nlet date1 = DateInRegion(\"2010-01-01 00:00:00\", region: rome)!\n\n// Create date from intervals\nlet _ = DateInRegion(seconds: 39940, region: rome)\nlet _ = DateInRegion(milliseconds: 5000, region: rome)\n\n// Date from components\nlet _ = DateInRegion(components: {\n\t$0.year = 2001\n\t$0.month = 9\n\t$0.day = 11\n\t$0.hour = 12\n\t$0.minute = 0\n}, region: rome)\nlet _ = DateInRegion(year: 2001, month: 1, day: 5, hour: 23, minute: 30, second: 0, region: rome)\n\n// Random date generation with/without bounds\nlet _ = DateInRegion.randomDate(region: rome)\nlet _ = DateInRegion.randomDate(withinDaysBeforeToday: 5)\nlet _ = DateInRegion.randomDates(count: 50, between: lowerLimitDate, and: upperLimitDate, region: rome)\n```\n<a name=\"5\"/>\n\n### 5. Derivated Dates\nDate can be also generated starting from other dates; SwiftDate includes an extensive set of functions to generate.\nOver 20 different derivated dates can be created easily using `dateAt()` function.\n\n```swift\nlet _ = DateInRegion().dateAt(.endOfDay) // today at the end of the day\n// Over 20 different relevant dates including .startOfDay,\n// .endOfDay, .startOfWeek, .tomorrow, .nextWeekday, .nextMonth, .prevYear, .nearestMinute and many others!\nlet _ = dateA.nextWeekday(.friday) // the next friday after dateA\nlet _ = (date.dateAt(.startOfMonth) - 3.days)\nlet _ = dateA.compare(.endOfWeek)\n\n// Enumerate dates in range by providing your own custom\n// increment expressed in date components\nlet from = DateInRegion(\"2015-01-01 10:00:00\", region: rome)!\nlet to = DateInRegion(\"2015-01-02 03:00:00\", region: rome)!\nlet increment2 = DateComponents.create {\n\t$0.hour = 1\n\t$0.minute = 30\n\t$0.second = 10\n}\n// generate dates in range by incrementing +1h,30m,10s each new date\nlet dates = DateInRegion.enumerateDates(from: fromDate2, to: toDate2, increment: increment2)\n\n// Get all mondays in Jan 2019\nlet mondaysInJan2019 = Date.datesForWeekday(.monday, inMonth: 1, ofYear: 2019)\n\n// Altering time components\nlet _ = dateA.dateBySet(hour: 10, min: 0, secs: 0)\n\n// Truncating a date\nlet _ = dateA.dateTruncated(at: [.year,.month,.day]) // reset all time components keeping only date\n\n// Rounding a date\nlet _ = dateA.dateRoundedAt(.toMins(10))\nlet _ = dateA.dateRoundedAt(.toFloor30Mins)\n\n// Adding components\nlet _ = dateA.dateByAdding(5,.year)\n\n// Date at the start/end of any time component\nlet _ = dateA.dateAtEndOf(.year) // 31 of Dec at 23:59:59\nlet _ = dateA.dateAtStartOf(.day) // at 00:00:00 of the same day\nlet _ = dateA.dateAtStartOf(.month) // at 00:00:00 of the first day of the month\n```\n\n<a name=\"6\"/>\n\n### 6. Components Extraction\nYou can extract components directly from dates and it includes the right value expressed in date's region (the right timezone and set locale!).\n\n```swift\n// Create a date in a region, London but with the lcoale set to IT\nlet london = Region(calendar: .gregorian, zone: .europeLondon, locale: .italian)\nlet date = DateInRegion(\"2018-02-05 23:14:45\", format: dateFormat, region: london)!\n\n// You can extract any of the all available time units.\n// VALUES ARE EXPRESSED IN THE REGION OF THE DATE (THE RIGHT TIMEZONE).\n// (you can still get the UTC/absolute value by getting the inner's absoluteDate).\n\nlet _ = date.year // 2018\nlet _ = date.month // 2\nlet _ = date.monthNameDefault // 'Febbraio' as the locale is the to IT!\nlet _ = date.firstDayOfWeek // 5\nlet _ = date.weekdayNameShort // 'Lun' as locale is the to IT\n// ... all components are supported: .year, .month, .day, .hour, .minute, .second,\n// .monthName, .weekday, .nearestHour, .firstDayOfWeek. .quarter and so on...\n```\n\n<a name=\"7\"/>\n\n### 7. Switch between timezones/locale and calendars\nYou can easily convert any date to another region (aka another calendar, locale or timezone) easily!\nNew date contains all values expressed into the destination reason\n\n```swift\n// Conversion between timezones is easy using convertTo(region:) function\nlet rNY = Region(calendar: Calendars.gregorian, zone: Zones.americaNewYork, locale: Locales.english)\nlet rRome = Region(calendar: Calendars.gregorian, zone: Zones.europeRome, locale: Locales.italian)\nlet dateInNY = \"2017-01-01 00:00:00\".toDate(region: rNY)\nlet dateInRome = dateInNY?.convertTo(region: rRome)!\nprint(dateInRome.toString()) // \"dom gen 01 06:00:00 +0100 2017\\n\"\n\n// You can also convert single region's attributes\nlet dateInIndia = dateInNY?.convertTo(timezone: Zones.indianChristmas, locale: Locales.nepaliIndia)\nprint(\"\\(dateInIndia!.toString())\") // \"आइत जनवरी ०१ १२:००:०० +0700 २०१७\\n\"\n```\n\n<a name=\"8\"/>\n\n### 8. Date Formatting\nDate formatting is easy, you can specify your own format, locale or use any of the provided ones.\n\n```swift\n// Date Formatting\nlet london = Region(calendar: .gregorian, zone: .europeLondon, locale: .english)\nlet date = ... // 2017-07-22T18:27:02+02:00 in london region\nlet _ = date.toDotNET() // /Date(1500740822000+0200)/\nlet _ = date.toISODate() // 2017-07-22T18:27:02+02:00\nlet _ = date.toFormat(\"dd MMM yyyy 'at' HH:mm\") // \"22 July 2017 at 18:27\"\n\n// You can also easily change locale when formatting a region\nlet _ = date.toFormat(\"dd MMM\", locale: .italian) // \"22 Luglio\"\n\n// Time Interval Formatting as Countdown\nlet interval: TimeInterval = (2.hours.timeInterval) + (34.minutes.timeInterval) + (5.seconds.timeInterval)\nlet _ = interval.toClock() // \"2:34:05\"\n\n// Time Interval Formatting by Components\nlet _ = interval.toString {\n\t$0.maximumUnitCount = 4\n\t$0.allowedUnits = [.day, .hour, .minute]\n\t$0.collapsesLargestUnit = true\n\t$0.unitsStyle = .abbreviated\n} // \"2h 34m\"\n```\n\n<a name=\"9\"/>\n\n### 9. Relative Date Formatting (fully customizable!)\nRelative formatting is all new in SwiftDate; it supports 120+ languages with two different styles (`.default, .twitter`), 9 flavours (`.long, .longTime, .longConvenient, .short, .shortTime, .shortConvenient, .narrow, .tiny, .quantify`) and all of them are customizable as you need.\nThe extensible format allows you to provide your own translations and rules to override the default behaviour.\n\n```swift\n// Twitter Style\nlet _ = (Date() - 3.minutes).toRelative(style: RelativeFormatter.twitterStyle(), locale: Locales.english) // \"3m\"\nlet _ = (Date() - 6.minutes).toRelative(style: RelativeFormatter.twitterStyle(), locale: Locales.italian) // \"6 min fa\"\n\n// Default Style\nlet _ = (now2 - 5.hours).toRelative(style: RelativeFormatter.defaultStyle(), locale: Locales.english) // \"5 hours ago\"\nlet y = (now2 - 40.minutes).toRelative(style: RelativeFormatter.defaultStyle(), locale: Locales.italian) // \"45 minuti fa\"\n```\n<a name=\"10\"/>\n\n### 10. Codable Support\nBoth `DateInRegion` and `Region` fully support the new Swift's `Codable` protocol. This mean you can safely encode/decode them:\n\n```swift\n// Encoding/Decoding a Region\nlet region = Region(calendar: Calendars.gregorian, zone: Zones.europeOslo, locale: Locales.english)\nlet encodedJSON = try JSONEncoder().encode(region)\nlet decodedRegion = try JSONDecoder().decode(Region.self, from: encodedJSON)\n\n// Encoding/Decoding a DateInRegion\nlet date = DateInRegion(\"2015-09-24T13:20:55\", region: region)\nlet encodedDate = try JSONEncoder().encode(date)\nlet decodedDate = try JSONDecoder().decode(DateInRegion.self, from: encodedDate)\n```\n\n<a name=\"11\"/>\n\n### 11. Time Periods\nSwiftDate integrates the great Matthew York's [DateTools](https://github.com/MatthewYork/DateTools) module in order to support Time Periods.\n\nSee [Time Periods](/Documentation/12.Timer_Periods.md) section of the documentation.\n"
  },
  {
    "path": "Sources/SwiftDate/Date/Date+Compare.swift",
    "content": "//\n//  SwiftDate\n//  Parse, validate, manipulate, and display dates, time and timezones in Swift\n//\n//  Created by Daniele Margutti\n//   - Web: https://www.danielemargutti.com\n//   - Twitter: https://twitter.com/danielemargutti\n//   - Mail: hello@danielemargutti.com\n//\n//  Copyright © 2019 Daniele Margutti. Licensed under MIT License.\n//\n\nimport Foundation\n\npublic extension Date {\n\n\t// MARK: - Comparing Close\n\n\t/// Decides whether a Date is \"close by\" another one passed in parameter,\n\t/// where \"Being close\" is measured using a precision argument\n\t/// which is initialized a 300 seconds, or 5 minutes.\n\t///\n\t/// - Parameters:\n\t///   - refDate: reference date compare against to.\n\t///   - precision: The precision of the comparison (default is 5 minutes, or 300 seconds).\n\t/// - Returns: A boolean; true if close by, false otherwise.\n\tfunc compareCloseTo(_ refDate: Date, precision: TimeInterval = 300) -> Bool {\n        (abs(timeIntervalSince(refDate)) < precision)\n\t}\n\n\t// MARK: - Extendend Compare\n\n\t/// Compare the date with the rule specified in the `compareType` parameter.\n\t///\n\t/// - Parameter compareType: comparison type.\n\t/// - Returns: `true` if comparison succeded, `false` otherwise\n\tfunc compare(_ compareType: DateComparisonType) -> Bool {\n        inDefaultRegion().compare(compareType)\n\t}\n\n\t/// Returns a ComparisonResult value that indicates the ordering of two given dates based on\n\t/// their components down to a given unit granularity.\n\t///\n\t/// - parameter date:        date to compare.\n\t/// - parameter granularity: The smallest unit that must, along with all larger units be less for the given dates\n\t/// - returns: `ComparisonResult`\n\tfunc compare(toDate refDate: Date, granularity: Calendar.Component) -> ComparisonResult {\n        inDefaultRegion().compare(toDate: refDate.inDefaultRegion(), granularity: granularity)\n\t}\n\n\t/// Compares whether the receiver is before/before equal `date` based on their components down to a given unit granularity.\n\t///\n\t/// - Parameters:\n\t///   - refDate: reference date\n\t///   - orEqual: `true` to also check for equality\n\t///   - granularity: smallest unit that must, along with all larger units, be less for the given dates\n\t/// - Returns: Boolean\n\tfunc isBeforeDate(_ refDate: Date, orEqual: Bool = false, granularity: Calendar.Component) -> Bool {\n        inDefaultRegion().isBeforeDate(refDate.inDefaultRegion(), orEqual: orEqual, granularity: granularity)\n\t}\n\n\t/// Compares whether the receiver is after `date` based on their components down to a given unit granularity.\n\t///\n\t/// - Parameters:\n\t///   - refDate: reference date\n\t///   - orEqual: `true` to also check for equality\n\t///   - granularity: Smallest unit that must, along with all larger units, be greater for the given dates.\n\t/// - Returns: Boolean\n\tfunc isAfterDate(_ refDate: Date, orEqual: Bool = false, granularity: Calendar.Component) -> Bool {\n        inDefaultRegion().isAfterDate(refDate.inDefaultRegion(), orEqual: orEqual, granularity: granularity)\n\t}\n\n\t/// Returns a value between 0.0 and 1.0 or nil, that is the position of current date between 2 other dates.\n\t///\n\t/// - Parameters:\n\t///   - startDate: range upper bound date\n\t///   - endDate: range lower bound date\n\t/// - Returns: `nil` if current date is not between `startDate` and `endDate`. Otherwise returns position between `startDate` and `endDate`.\n\tfunc positionInRange(date startDate: Date, and endDate: Date) -> Double? {\n        inDefaultRegion().positionInRange(date: startDate.inDefaultRegion(), and: endDate.inDefaultRegion())\n\t}\n\n\t/// Return true if receiver date is contained in the range specified by two dates.\n\t///\n\t/// - Parameters:\n\t///   - startDate: range upper bound date\n\t///   - endDate: range lower bound date\n\t///   - orEqual: `true` to also check for equality on date and date2\n\t///   - granularity: smallest unit that must, along with all larger units, be greater for the given dates.\n\t/// - Returns: Boolean\n\tfunc isInRange(date startDate: Date, and endDate: Date, orEqual: Bool = false, granularity: Calendar.Component = .nanosecond) -> Bool {\n        inDefaultRegion().isInRange(date: startDate.inDefaultRegion(), and: endDate.inDefaultRegion(), orEqual: orEqual, granularity: granularity)\n\t}\n\n\t/// Compares equality of two given dates based on their components down to a given unit\n\t/// granularity.\n\t///\n\t/// - parameter date:        date to compare\n\t/// - parameter granularity: The smallest unit that must, along with all larger units, be equal for the given\n\t///         dates to be considered the same.\n\t///\n\t/// - returns: `true` if the dates are the same down to the given granularity, otherwise `false`\n\tfunc isInside(date: Date, granularity: Calendar.Component) -> Bool {\n        (compare(toDate: date, granularity: granularity) == .orderedSame)\n\t}\n\n\t// MARK: - Date Earlier/Later\n\n\t/// Return the earlier of two dates, between self and a given date.\n\t///\n\t/// - Parameter date: The date to compare to self\n\t/// - Returns: The date that is earlier\n\tfunc earlierDate(_ date: Date) -> Date {\n        timeIntervalSince(date) <= 0 ? self : date\n\t}\n\n\t/// Return the later of two dates, between self and a given date.\n\t///\n\t/// - Parameter date: The date to compare to self\n\t/// - Returns: The date that is later\n\tfunc laterDate(_ date: Date) -> Date {\n        timeIntervalSince(date) >= 0 ? self : date\n\t}\n\n}\n\nextension Date {\n\n    /// Returns the difference in the calendar component given (like day, month or year)\n    /// with respect to the other date as a positive integer\n    public func difference(in component: Calendar.Component, from other: Date) -> Int? {\n        let (max, min) = orderDate(with: other)\n        let result = calendar.dateComponents([component], from: min, to: max)\n        return getValue(of: component, from: result)\n    }\n\n    /// Returns the differences in the calendar components given (like day, month and year)\n    /// with respect to the other date as dictionary with the calendar component as the key\n    /// and the diffrence as a positive integer as the value\n    public func differences(in components: Set<Calendar.Component>, from other: Date) -> [Calendar.Component: Int] {\n        let (max, min) = orderDate(with: other)\n        let differenceInDates = calendar.dateComponents(components, from: min, to: max)\n        var result = [Calendar.Component: Int]()\n        for component in components {\n            if let value = getValue(of: component, from: differenceInDates) {\n                result[component] = value\n            }\n        }\n        return result\n    }\n\n    private func getValue(of component: Calendar.Component, from dateComponents: DateComponents) -> Int? {\n        switch component {\n        case .era:\n            return dateComponents.era\n        case .year:\n            return dateComponents.year\n        case .month:\n            return dateComponents.month\n        case .day:\n            return dateComponents.day\n        case .hour:\n            return dateComponents.hour\n        case .minute:\n            return dateComponents.minute\n        case .second:\n            return dateComponents.second\n        case .weekday:\n            return dateComponents.weekday\n        case .weekdayOrdinal:\n            return dateComponents.weekdayOrdinal\n        case .quarter:\n            return dateComponents.quarter\n        case .weekOfMonth:\n            return dateComponents.weekOfMonth\n        case .weekOfYear:\n            return dateComponents.weekOfYear\n        case .yearForWeekOfYear:\n            return dateComponents.yearForWeekOfYear\n        case .nanosecond:\n            return dateComponents.nanosecond\n        case .calendar, .timeZone:\n            return nil\n        @unknown default:\n            assert(false, \"unknown date component\")\n        }\n        return nil\n    }\n\n    private func orderDate(with other: Date) -> (Date, Date) {\n        let first = self.timeIntervalSince1970\n        let second = other.timeIntervalSince1970\n\n        if first >= second {\n            return (self, other)\n        }\n\n        return (other, self)\n    }\n}\n"
  },
  {
    "path": "Sources/SwiftDate/Date/Date+Components.swift",
    "content": "//\n//  SwiftDate\n//  Parse, validate, manipulate, and display dates, time and timezones in Swift\n//\n//  Created by Daniele Margutti\n//   - Web: https://www.danielemargutti.com\n//   - Twitter: https://twitter.com/danielemargutti\n//   - Mail: hello@danielemargutti.com\n//\n//  Copyright © 2019 Daniele Margutti. Licensed under MIT License.\n//\n\nimport Foundation\n\npublic extension Date {\n\n\t/// Indicates whether the month is a leap month.\n\tvar isLeapMonth: Bool {\n        inDefaultRegion().isLeapMonth\n\t}\n\n\t/// Indicates whether the year is a leap year.\n\tvar isLeapYear: Bool {\n        inDefaultRegion().isLeapYear\n\t}\n\n\t/// Julian day is the continuous count of days since the beginning of\n\t/// the Julian Period used primarily by astronomers.\n\tvar julianDay: Double {\n        inDefaultRegion().julianDay\n\t}\n\n\t/// The Modified Julian Date (MJD) was introduced by the Smithsonian Astrophysical Observatory\n\t/// in 1957 to record the orbit of Sputnik via an IBM 704 (36-bit machine)\n\t/// and using only 18 bits until August 7, 2576.\n\tvar modifiedJulianDay: Double {\n        inDefaultRegion().modifiedJulianDay\n\t}\n\n\t/// Return elapsed time expressed in given components since the current receiver and a reference date.\n\t///\n\t/// - Parameters:\n\t///   - refDate: reference date (`nil` to use current date in the same region of the receiver)\n\t///   - component: time unit to extract.\n\t/// - Returns: value\n\tfunc getInterval(toDate: Date?, component: Calendar.Component) -> Int64 {\n        inDefaultRegion().getInterval(toDate: toDate?.inDefaultRegion(), component: component)\n\t}\n}\n"
  },
  {
    "path": "Sources/SwiftDate/Date/Date+Create.swift",
    "content": "//\n//  SwiftDate\n//  Parse, validate, manipulate, and display dates, time and timezones in Swift\n//\n//  Created by Daniele Margutti\n//   - Web: https://www.danielemargutti.com\n//   - Twitter: https://twitter.com/danielemargutti\n//   - Mail: hello@danielemargutti.com\n//\n//  Copyright © 2019 Daniele Margutti. Licensed under MIT License.\n//\n\nimport Foundation\n\npublic extension Date {\n\n\t/// Return the oldest date in given list.\n\t///\n\t/// - Parameter list: list of dates\n\t/// - Returns: a tuple with the index of the oldest date and its instance.\n\tstatic func oldestIn(list: [Date]) -> Date? {\n\t\tguard list.count > 0 else { return nil }\n\t\tguard list.count > 1 else { return list.first! }\n\t\treturn list.min(by: {\n\t\t\treturn $0 < $1\n\t\t})\n\t}\n\n\t/// Return the newest date in given list.\n\t///\n\t/// - Parameter list: list of dates\n\t/// - Returns: a tuple with the index of the oldest date and its instance.\n\tstatic func newestIn(list: [Date]) -> Date? {\n\t\tguard list.count > 0 else { return nil }\n\t\tguard list.count > 1 else { return list.first! }\n\t\treturn list.max(by: {\n\t\t\treturn $0 < $1\n\t\t})\n\t}\n\n\t/// Enumerate dates between two intervals by adding specified time components defined by a function and return an array of dates.\n\t/// `startDate` interval will be the first item of the resulting array.\n\t/// The last item of the array is evaluated automatically and maybe not equal to `endDate`.\n\t///\n\t/// - Parameters:\n\t///   - start: starting date\n\t///   - endDate: ending date\n\t///   - increment: increment function. It get the last generated date and require a valida `DateComponents` instance which define the increment\n\t/// - Returns: array of dates\n\tstatic func enumerateDates(from startDate: Date, to endDate: Date, increment: ((Date) -> (DateComponents))) -> [Date] {\n\t\tvar dates: [Date] = []\n\t\tvar currentDate = startDate\n\n\t\twhile currentDate <= endDate {\n\t\t\tdates.append(currentDate)\n\t\t\tcurrentDate = (currentDate + increment(currentDate))\n\t\t}\n\t\treturn dates\n\t}\n\n\t/// Enumerate dates between two intervals by adding specified time components and return an array of dates.\n\t/// `startDate` interval will be the first item of the resulting array.\n\t/// The last item of the array is evaluated automatically and maybe not equal to `endDate`.\n\t///\n\t/// - Parameters:\n\t///   - start: starting date\n\t///   - endDate: ending date\n\t///   - increment: components to add\n\t/// - Returns: array of dates\n\tstatic func enumerateDates(from startDate: Date, to endDate: Date, increment: DateComponents) -> [Date] {\n        Date.enumerateDates(from: startDate, to: endDate, increment: { _ in\n\t\t\treturn increment\n\t\t})\n\t}\n\n\t/// Round a given date time to the passed style (off|up|down).\n\t///\n\t/// - Parameter style: rounding mode.\n\t/// - Returns: rounded date\n\tfunc dateRoundedAt(at style: RoundDateMode) -> Date {\n        inDefaultRegion().dateRoundedAt(style).date\n\t}\n\n\t/// Returns a new DateInRegion that is initialized at the start of a specified unit of time.\n\t///\n\t/// - Parameter unit: time unit value.\n\t/// - Returns: instance at the beginning of the time unit; `self` if fails.\n\tfunc dateAtStartOf(_ unit: Calendar.Component) -> Date {\n        inDefaultRegion().dateAtStartOf(unit).date\n\t}\n\n\t/// Return a new DateInRegion that is initialized at the start of the specified components\n\t/// executed in order.\n\t///\n\t/// - Parameter units: sequence of transformations as time unit components\n\t/// - Returns: new date at the beginning of the passed components, intermediate results if fails.\n\tfunc dateAtStartOf(_ units: [Calendar.Component]) -> Date {\n        units.reduce(self) { (currentDate, currentUnit) -> Date in\n\t\t\treturn currentDate.dateAtStartOf(currentUnit)\n\t\t}\n\t}\n\n\t/// Returns a new Moment that is initialized at the end of a specified unit of time.\n\t///\n\t/// - parameter unit: A TimeUnit value.\n\t///\n\t/// - returns: A new Moment instance.\n\tfunc dateAtEndOf(_ unit: Calendar.Component) -> Date {\n        inDefaultRegion().dateAtEndOf(unit).date\n\t}\n\n\t/// Return a new DateInRegion that is initialized at the end of the specified components\n\t/// executed in order.\n\t///\n\t/// - Parameter units: sequence of transformations as time unit components\n\t/// - Returns: new date at the end of the passed components, intermediate results if fails.\n\tfunc dateAtEndOf(_ units: [Calendar.Component]) -> Date {\n        units.reduce(self) { (currentDate, currentUnit) -> Date in\n\t\t\treturn currentDate.dateAtEndOf(currentUnit)\n\t\t}\n\t}\n\n\t/// Create a new date by altering specified components of the receiver.\n\t///\n\t/// - Parameter components: components to alter with their new values.\n\t/// - Returns: new altered `DateInRegion` instance\n\tfunc dateBySet(_ components: [Calendar.Component: Int]) -> Date? {\n        DateInRegion(self, region: SwiftDate.defaultRegion).dateBySet(components)?.date\n\t}\n\n\t/// Create a new date by altering specified time components.\n\t///\n\t/// - Parameters:\n\t///   - hour: hour to set (`nil` to leave it unaltered)\n\t///   - min: min to set (`nil` to leave it unaltered)\n\t///   - secs: sec to set (`nil` to leave it unaltered)\n\t///   - ms: milliseconds to set (`nil` to leave it unaltered)\n\t///   - options: options for calculation\n\t/// - Returns: new altered `DateInRegion` instance\n\tfunc dateBySet(hour: Int?, min: Int?, secs: Int?, ms: Int? = nil, options: TimeCalculationOptions = TimeCalculationOptions()) -> Date? {\n\t\tlet srcDate = DateInRegion(self, region: SwiftDate.defaultRegion)\n\t\treturn srcDate.dateBySet(hour: hour, min: min, secs: secs, ms: ms, options: options)?.date\n\t}\n\n\t/// Creates a new instance by truncating the components\n\t///\n\t/// - Parameter components: components to truncate.\n\t/// - Returns: new date with truncated components.\n\tfunc dateTruncated(_ components: [Calendar.Component]) -> Date? {\n        DateInRegion(self, region: SwiftDate.defaultRegion).dateTruncated(at: components)?.date\n\t}\n\n\t/// Creates a new instance by truncating the components starting from given components down the granurality.\n\t///\n\t/// - Parameter component: The component to be truncated from.\n\t/// - Returns: new date with truncated components.\n\tfunc dateTruncated(from component: Calendar.Component) -> Date? {\n        DateInRegion(self, region: SwiftDate.defaultRegion).dateTruncated(from: component)?.date\n\t}\n\n\t/// Offset a date by n calendar components.\n\t/// Note: This operation can be functionally chained.\n\t///\n\t/// - Parameters:\n\t///   - count: value of the offset.\n\t///   - component: component to offset.\n\t/// - Returns: new altered date.\n\tfunc dateByAdding(_ count: Int, _ component: Calendar.Component) -> DateInRegion {\n        DateInRegion(self, region: SwiftDate.defaultRegion).dateByAdding(count, component)\n\t}\n\n\t/// Return related date starting from the receiver attributes.\n\t///\n\t/// - Parameter type: related date to obtain.\n\t/// - Returns: instance of the related date.\n\tfunc dateAt(_ type: DateRelatedType) -> Date {\n        inDefaultRegion().dateAt(type).date\n\t}\n\n\t/// Create a new date at now and extract the related date using passed rule type.\n\t///\n\t/// - Parameter type: related date to obtain.\n\t/// - Returns: instance of the related date.\n\tstatic func nowAt(_ type: DateRelatedType) -> Date {\n        Date().dateAt(type)\n\t}\n\n\t/// Return the dates for a specific weekday inside given month of specified year.\n\t/// Ie. get me all the saturdays of Feb 2018.\n\t/// NOTE: Values are returned in order.\n\t///\n\t/// - Parameters:\n\t///   - weekday: weekday target.\n\t///   - month: month target.\n\t///   - year: year target.\n\t///   - region: region target, omit to use `SwiftDate.defaultRegion`\n\t/// - Returns: Ordered list of the dates for given weekday into given month.\n\tstatic func datesForWeekday(_ weekday: WeekDay, inMonth month: Int, ofYear year: Int,\n\t\t\t\t\t\t\t\t\t   region: Region = SwiftDate.defaultRegion) -> [Date] {\n\t\tlet fromDate = DateInRegion(Date(year: year, month: month, day: 1, hour: 0, minute: 0), region: region)\n\t\tlet toDate = fromDate.dateAt(.endOfMonth)\n\t\treturn DateInRegion.datesForWeekday(weekday, from: fromDate, to: toDate, region: region).map { $0.date }\n\t}\n\n\t/// Return the dates for a specific weekday inside a specified date range.\n\t/// NOTE: Values are returned in order.\n\t///\n\t/// - Parameters:\n\t///   - weekday: weekday target.\n\t///   - startDate: from date of the range.\n\t///   - endDate: to date of the range.\n\t///   - region: region target, omit to use `SwiftDate.defaultRegion`\n\t/// - Returns: Ordered list of the dates for given weekday in passed range.\n\tstatic func datesForWeekday(_ weekday: WeekDay, from startDate: Date, to endDate: Date,\n\t\t\t\t\t\t\t\t\t   region: Region = SwiftDate.defaultRegion) -> [Date] {\n\t\tlet fromDate = DateInRegion(startDate, region: region)\n\t\tlet toDate = DateInRegion(endDate, region: region)\n\t\treturn DateInRegion.datesForWeekday(weekday, from: fromDate, to: toDate, region: region).map { $0.date }\n\t}\n\n    /// Returns the date at the given week number and week day preserving smaller components (hour, minute, seconds)\n    ///\n    /// For example: to get the third friday of next month\n    ///         let today = DateInRegion()\n    ///         let result = today.dateAt(weekdayOrdinal: 3, weekday: .friday, monthNumber: today.month + 1)\n    ///\n    /// - Parameters:\n    ///     - weekdayOrdinal: the week number (by set position in a recurrence rule)\n    ///     - weekday: WeekDay\n    ///     - monthNumber: a number from 1 to 12 representing the month, optional parameter\n    ///     - yearNumber: a number representing the year, optional parameter\n    /// - Returns: new date created with the given parameters\n    func dateAt(weekdayOrdinal: Int, weekday: WeekDay, monthNumber: Int? = nil,\n                yearNumber: Int? = nil) -> Date {\n        let date = DateInRegion(self, region: region)\n        return date.dateAt(weekdayOrdinal: weekdayOrdinal, weekday: weekday, monthNumber: monthNumber, yearNumber: yearNumber).date\n    }\n\n    /// Returns the next weekday preserving smaller components (hour, minute, seconds)\n    ///\n    /// - Parameters:\n    ///   - weekday: weekday to get.\n    ///   - region: region target, omit to use `SwiftDate.defaultRegion`\n    /// - Returns: `Date`\n    func nextWeekday(_ weekday: WeekDay, region: Region = SwiftDate.defaultRegion) -> Date {\n        let date = DateInRegion(self, region: region)\n        return date.nextWeekday(weekday).date\n    }\n\n}\n"
  },
  {
    "path": "Sources/SwiftDate/Date/Date+Math.swift",
    "content": "//\n//  SwiftDate\n//  Parse, validate, manipulate, and display dates, time and timezones in Swift\n//\n//  Created by Daniele Margutti\n//   - Web: https://www.danielemargutti.com\n//   - Twitter: https://twitter.com/danielemargutti\n//   - Mail: hello@danielemargutti.com\n//\n//  Copyright © 2019 Daniele Margutti. Licensed under MIT License.\n//\n\nimport Foundation\n\n/// Subtracts two dates and returns the relative components from `lhs` to `rhs`.\n/// Follows this mathematical pattern:\n///     let difference = lhs - rhs\n///     rhs + difference = lhs\npublic func - (lhs: Date, rhs: Date) -> DateComponents {\n    SwiftDate.defaultRegion.calendar.dateComponents(DateComponents.allComponentsSet, from: rhs, to: lhs)\n}\n\n/// Adds date components to a date and returns a new date.\npublic func + (lhs: Date, rhs: DateComponents) -> Date {\n    rhs.from(lhs)!\n}\n\n/// Adds date components to a date and returns a new date.\npublic func + (lhs: DateComponents, rhs: Date) -> Date {\n    (rhs + lhs)\n}\n\n/// Subtracts date components from a date and returns a new date.\npublic func - (lhs: Date, rhs: DateComponents) -> Date {\n    (lhs + (-rhs))\n}\n\npublic func + (lhs: Date, rhs: TimeInterval) -> Date {\n    lhs.addingTimeInterval(rhs)\n}\n"
  },
  {
    "path": "Sources/SwiftDate/Date/Date.swift",
    "content": "//\n//  SwiftDate\n//  Parse, validate, manipulate, and display dates, time and timezones in Swift\n//\n//  Created by Daniele Margutti\n//   - Web: https://www.danielemargutti.com\n//   - Twitter: https://twitter.com/danielemargutti\n//   - Mail: hello@danielemargutti.com\n//\n//  Copyright © 2019 Daniele Margutti. Licensed under MIT License.\n//\n\nimport Foundation\n\ninternal enum AssociatedKeys: String {\n\tcase customDateFormatter = \"SwiftDate.CustomDateFormatter\"\n}\n\nextension Date: DateRepresentable {\n\n\t/// Just return itself to be compliant with `DateRepresentable` protocol.\n\tpublic var date: Date { return self }\n\n\t/// For absolute Date object the default region is obtained from the global `defaultRegion` variable.\n\tpublic var region: Region {\n        SwiftDate.defaultRegion\n\t}\n\n\t/// Assign a custom formatter if you need a special behaviour during formatting of the object.\n\t/// Usually you will not need to do it, SwiftDate uses the local thread date formatter in order to\n\t/// optimize the formatting process. By default is `nil`.\n\tpublic var customFormatter: DateFormatter? {\n\t\tget {\n\t\t\tlet formatter: DateFormatter? = getAssociatedValue(key: AssociatedKeys.customDateFormatter.rawValue, object: self as AnyObject)\n\t\t\treturn formatter\n\t\t}\n\t\tset {\n\t\t\tset(associatedValue: newValue, key: AssociatedKeys.customDateFormatter.rawValue, object: self as AnyObject)\n\t\t}\n\t}\n\n\t/// Extract the date components.\n\tpublic var dateComponents: DateComponents {\n        region.calendar.dateComponents(DateComponents.allComponentsSet, from: self)\n\t}\n\n\t/// Initialize a new date object from string expressed in given region.\n\t///\n\t/// - Parameters:\n\t///   - string: date expressed as string.\n\t///   - format: format of the date (`nil` uses provided list of auto formats patterns.\n\t///\t\t\t\tPass it if you can in order to optimize the parse task).\n\t///   - region: region in which the date is expressed. `nil` uses the `SwiftDate.defaultRegion`.\n\tpublic init?(_ string: String, format: String? = nil, region: Region = SwiftDate.defaultRegion) {\n\t\tguard let dateInRegion = DateInRegion(string, format: format, region: region) else { return nil }\n\t\tself = dateInRegion.date\n\t}\n\n\t/// Initialize a new date from the number of seconds passed since Unix Epoch.\n\t///\n\t/// - Parameter interval: seconds\n\n\t/// Initialize a new date from the number of seconds passed since Unix Epoch.\n\t///\n\t/// - Parameters:\n\t///   - interval: seconds from Unix epoch time.\n\t///   - region: region in which the date, `nil` uses the default region at UTC timezone\n\tpublic init(seconds interval: TimeInterval, region: Region = Region.UTC) {\n\t\tself = DateInRegion(seconds: interval, region: region).date\n\t}\n\n\t/// Initialize a new date corresponding to the number of milliseconds since the Unix Epoch.\n\t///\n\t/// - Parameters:\n\t///   - interval: seconds since the Unix Epoch timestamp.\n\t///   - region: region in which the date must be expressed, `nil` uses the default region at UTC timezone\n\tpublic init(milliseconds interval: Int, region: Region = Region.UTC) {\n\t\tself = DateInRegion(milliseconds: interval, region: region).date\n\t}\n\n\t/// Initialize a new date with the opportunity to configure single date components via builder pattern.\n\t/// Date is therfore expressed in passed region (`DateComponents`'s `timezone`,`calendar` and `locale` are ignored\n\t/// and overwritten by the region if not `nil`).\n\t///\n\t/// - Parameters:\n\t///   - configuration: configuration callback\n\t///   - region: region in which the date is expressed. Ignore to use `SwiftDate.defaultRegion`, `nil` to use `DateComponents` data.\n\tpublic init?(components configuration: ((inout DateComponents) -> Void), region: Region? = SwiftDate.defaultRegion) {\n\t\tguard let date = DateInRegion(components: configuration, region: region)?.date else { return nil }\n\t\tself = date\n\t}\n\n\t/// Initialize a new date with given components.\n\t///\n\t/// - Parameters:\n\t///   - components: components of the date.\n\t///   - region: region in which the date is expressed.\n\t///\t\t\t\tIgnore to use `SwiftDate.defaultRegion`, `nil` to use `DateComponents` data.\n\tpublic init?(components: DateComponents, region: Region?) {\n\t\tguard let date = DateInRegion(components: components, region: region)?.date else { return nil }\n\t\tself = date\n\t}\n\n\t/// Initialize a new date with given components.\n\tpublic init(year: Int, month: Int, day: Int, hour: Int, minute: Int, second: Int = 0, nanosecond: Int = 0, region: Region = SwiftDate.defaultRegion) {\n\t\tvar components = DateComponents()\n\t\tcomponents.year = year\n\t\tcomponents.month = month\n\t\tcomponents.day = day\n\t\tcomponents.hour = hour\n\t\tcomponents.minute = minute\n\t\tcomponents.second = second\n\t\tcomponents.nanosecond = nanosecond\n\t\tcomponents.timeZone = region.timeZone\n\t\tcomponents.calendar = region.calendar\n\t\tself = region.calendar.date(from: components)!\n\t}\n\n\t/// Express given absolute date in the context of the default region.\n\t///\n\t/// - Returns: `DateInRegion`\n\tpublic func inDefaultRegion() -> DateInRegion {\n        DateInRegion(self, region: SwiftDate.defaultRegion)\n\t}\n\n\t/// Express given absolute date in the context of passed region.\n\t///\n\t/// - Parameter region: destination region.\n\t/// - Returns: `DateInRegion`\n\tpublic func `in`(region: Region) -> DateInRegion {\n        DateInRegion(self, region: region)\n\t}\n\n\t/// Return a date in the distant past.\n\t///\n\t/// - Returns: Date instance.\n\tpublic static func past() -> Date {\n        Date.distantPast\n\t}\n\n\t/// Return a date in the distant future.\n\t///\n\t/// - Returns: Date instance.\n\tpublic static func future() -> Date {\n        Date.distantFuture\n\t}\n\n}\n"
  },
  {
    "path": "Sources/SwiftDate/DateInRegion/DateInRegion+Compare.swift",
    "content": "//\n//  SwiftDate\n//  Parse, validate, manipulate, and display dates, time and timezones in Swift\n//\n//  Created by Daniele Margutti\n//   - Web: https://www.danielemargutti.com\n//   - Twitter: https://twitter.com/danielemargutti\n//   - Mail: hello@danielemargutti.com\n//\n//  Copyright © 2019 Daniele Margutti. Licensed under MIT License.\n//\n\nimport Foundation\n\n// MARK: - Comparing DateInRegion\n\npublic func == (lhs: DateInRegion, rhs: DateInRegion) -> Bool {\n    (lhs.date.timeIntervalSince1970 == rhs.date.timeIntervalSince1970)\n}\n\npublic func <= (lhs: DateInRegion, rhs: DateInRegion) -> Bool {\n\tlet result = lhs.date.compare(rhs.date)\n\treturn (result == .orderedAscending || result == .orderedSame)\n}\n\npublic func >= (lhs: DateInRegion, rhs: DateInRegion) -> Bool {\n\tlet result = lhs.date.compare(rhs.date)\n\treturn (result == .orderedDescending || result == .orderedSame)\n}\n\npublic func < (lhs: DateInRegion, rhs: DateInRegion) -> Bool {\n    lhs.date.compare(rhs.date) == .orderedAscending\n}\n\npublic func > (lhs: DateInRegion, rhs: DateInRegion) -> Bool {\n    lhs.date.compare(rhs.date) == .orderedDescending\n}\n\n// The type of comparison to do against today's date or with the suplied date.\n///\n/// - isToday: hecks if date today.\n/// - isTomorrow: Checks if date is tomorrow.\n/// - isYesterday: Checks if date is yesterday.\n/// - isSameDay: Compares date days\n/// - isThisWeek: Checks if date is in this week.\n/// - isNextWeek: Checks if date is in next week.\n/// - isLastWeek: Checks if date is in last week.\n/// - isSameWeek: Compares date weeks\n/// - isThisMonth: Checks if date is in this month.\n/// - isNextMonth: Checks if date is in next month.\n/// - isLastMonth: Checks if date is in last month.\n/// - isSameMonth: Compares date months\n/// - isThisYear: Checks if date is in this year.\n/// - isNextYear: Checks if date is in next year.\n/// - isLastYear: Checks if date is in last year.\n/// - isSameYear: Compare date years\n/// - isInTheFuture: Checks if it's a future date\n/// - isInThePast: Checks if the date has passed\n/// - isEarlier: Checks if earlier than date\n/// - isLater: Checks if later than date\n/// - isWeekday: Checks if it's a weekday\n/// - isWeekend: Checks if it's a weekend\n/// - isInDST: Indicates whether the represented date uses daylight saving time.\n/// - isMorning: Return true if date is in the morning (>=5 - <12)\n/// - isAfternoon: Return true if date is in the afternoon (>=12 - <17)\n/// - isEvening: Return true if date is in the morning (>=17 - <21)\n/// - isNight: Return true if date is in the morning (>=21 - <5)\npublic enum DateComparisonType {\n\n\t// Days\n\tcase isToday\n\tcase isTomorrow\n\tcase isYesterday\n\tcase isSameDay(_ : DateRepresentable)\n\n\t// Weeks\n\tcase isThisWeek\n\tcase isNextWeek\n\tcase isLastWeek\n\tcase isSameWeek(_: DateRepresentable)\n\n\t// Months\n\tcase isThisMonth\n\tcase isNextMonth\n\tcase isLastMonth\n\tcase isSameMonth(_: DateRepresentable)\n\n\t// Years\n\tcase isThisYear\n\tcase isNextYear\n\tcase isLastYear\n\tcase isSameYear(_: DateRepresentable)\n\n\t// Relative Time\n\tcase isInTheFuture\n\tcase isInThePast\n\tcase isEarlier(than: DateRepresentable)\n\tcase isLater(than: DateRepresentable)\n\tcase isWeekday\n\tcase isWeekend\n\n\t// Day time\n\tcase isMorning\n\tcase isAfternoon\n\tcase isEvening\n\tcase isNight\n\n\t// TZ\n\tcase isInDST\n}\n\npublic extension DateInRegion {\n\n\t/// Decides whether a DATE is \"close by\" another one passed in parameter,\n\t/// where \"Being close\" is measured using a precision argument\n\t/// which is initialized a 300 seconds, or 5 minutes.\n\t///\n\t/// - Parameters:\n\t///   - refDate: reference date compare against to.\n\t///   - precision: The precision of the comparison (default is 5 minutes, or 300 seconds).\n\t/// - Returns: A boolean; true if close by, false otherwise.\n\tfunc compareCloseTo(_ refDate: DateInRegion, precision: TimeInterval = 300) -> Bool {\n        (abs(date.timeIntervalSince(refDate.date)) <= precision)\n\t}\n\n\t/// Compare the date with the rule specified in the `compareType` parameter.\n\t///\n\t/// - Parameter compareType: comparison type.\n\t/// - Returns: `true` if comparison succeded, `false` otherwise\n\tfunc compare(_ compareType: DateComparisonType) -> Bool {\n\t\tswitch compareType {\n\t\tcase .isToday:\n\t\t\treturn compare(.isSameDay(region.nowInThisRegion()))\n\n\t\tcase .isTomorrow:\n\t\t\tlet tomorrow = DateInRegion(region: region).dateByAdding(1, .day)\n\t\t\treturn compare(.isSameDay(tomorrow))\n\n\t\tcase .isYesterday:\n\t\t\tlet yesterday = DateInRegion(region: region).dateByAdding(-1, .day)\n\t\t\treturn compare(.isSameDay(yesterday))\n\n\t\tcase .isSameDay(let refDate):\n\t\t\treturn calendar.isDate(date, inSameDayAs: refDate.date)\n\n\t\tcase .isThisWeek:\n\t\t\treturn compare(.isSameWeek(region.nowInThisRegion()))\n\n\t\tcase .isNextWeek:\n\t\t\tlet nextWeek = region.nowInThisRegion().dateByAdding(1, .weekOfYear)\n\t\t\treturn compare(.isSameWeek(nextWeek))\n\n\t\tcase .isLastWeek:\n\t\t\tlet lastWeek = region.nowInThisRegion().dateByAdding(-1, .weekOfYear)\n\t\t\treturn compare(.isSameWeek(lastWeek))\n\n\t\tcase .isSameWeek(let refDate):\n\t\t\tguard weekOfYear == refDate.weekOfYear else {\n\t\t\t\treturn false\n\t\t\t}\n\t\t\t// Ensure time interval is under 1 week\n\t\t\treturn (abs(date.timeIntervalSince(refDate.date)) < 1.weeks.timeInterval)\n\n\t\tcase .isThisMonth:\n\t\t\treturn compare(.isSameMonth(region.nowInThisRegion()))\n\n\t\tcase .isNextMonth:\n\t\t\tlet nextMonth = region.nowInThisRegion().dateByAdding(1, .month)\n\t\t\treturn compare(.isSameMonth(nextMonth))\n\n\t\tcase .isLastMonth:\n\t\t\tlet lastMonth = region.nowInThisRegion().dateByAdding(-1, .month)\n\t\t\treturn compare(.isSameMonth(lastMonth))\n\n\t\tcase .isSameMonth(let refDate):\n\t\t\treturn (year == refDate.year) && (month == refDate.month)\n\n\t\tcase .isThisYear:\n\t\t\treturn compare(.isSameYear(region.nowInThisRegion()))\n\n\t\tcase .isNextYear:\n\t\t\tlet nextYear = region.nowInThisRegion().dateByAdding(1, .year)\n\t\t\treturn compare(.isSameYear(nextYear))\n\n\t\tcase .isLastYear:\n\t\t\tlet lastYear = region.nowInThisRegion().dateByAdding(-1, .year)\n\t\t\treturn compare(.isSameYear(lastYear))\n\n\t\tcase .isSameYear(let refDate):\n\t\t\treturn (year == refDate.year)\n\n\t\tcase .isInTheFuture:\n\t\t\treturn compare(.isLater(than: region.nowInThisRegion()))\n\n\t\tcase .isInThePast:\n\t\t\treturn compare(.isEarlier(than: region.nowInThisRegion()))\n\n\t\tcase .isEarlier(let refDate):\n\t\t\treturn ((date as NSDate).earlierDate(refDate.date) == date)\n\n\t\tcase .isLater(let refDate):\n\t\t\treturn ((date as NSDate).laterDate(refDate.date) == date)\n\n\t\tcase .isWeekday:\n\t\t\treturn !compare(.isWeekend)\n\n\t\tcase .isWeekend:\n\t\t\tlet range = calendar.maximumRange(of: Calendar.Component.weekday)!\n\t\t\treturn (weekday == range.lowerBound || weekday == range.upperBound - range.lowerBound)\n\n\t\tcase .isInDST:\n\t\t\treturn region.timeZone.isDaylightSavingTime(for: date)\n\n\t\tcase .isMorning:\n\t\t\treturn (hour >= 5 && hour < 12)\n\n\t\tcase .isAfternoon:\n\t\t\treturn (hour >= 12 && hour < 17)\n\n\t\tcase .isEvening:\n\t\t\treturn (hour >= 17 && hour < 21)\n\n\t\tcase .isNight:\n\t\t\treturn (hour >= 21 || hour < 5)\n\n\t\t}\n\t}\n\n\t/// Returns a ComparisonResult value that indicates the ordering of two given dates based on\n\t/// their components down to a given unit granularity.\n\t///\n\t/// - parameter date:        date to compare.\n\t/// - parameter granularity: The smallest unit that must, along with all larger units\n\t/// - returns: `ComparisonResult`\n\tfunc compare(toDate refDate: DateInRegion, granularity: Calendar.Component) -> ComparisonResult {\n\t\tswitch granularity {\n\t\tcase .nanosecond:\n\t\t\t// There is a possible rounding error using Calendar to compare two dates below the minute granularity\n\t\t\t// So we've added this trick and use standard Date compare which return correct results in this case\n\t\t\t// https://github.com/malcommac/SwiftDate/issues/346\n\t\t\treturn date.compare(refDate.date)\n\t\tdefault:\n\t\t\treturn region.calendar.compare(date, to: refDate.date, toGranularity: granularity)\n\t\t}\n\t}\n\n\t/// Compares whether the receiver is before/before equal `date` based on their components down to a given unit granularity.\n\t///\n\t/// - Parameters:\n\t///   - refDate: reference date\n\t///   - orEqual: `true` to also check for equality\n\t///   - granularity: smallest unit that must, along with all larger units, be less for the given dates\n\t/// - Returns: Boolean\n\tfunc isBeforeDate(_ date: DateInRegion, orEqual: Bool = false, granularity: Calendar.Component) -> Bool {\n\t\tlet result = compare(toDate: date, granularity: granularity)\n\t\treturn (orEqual ? (result == .orderedSame || result == .orderedAscending) : result == .orderedAscending)\n\t}\n\n\t/// Compares whether the receiver is after `date` based on their components down to a given unit granularity.\n\t///\n\t/// - Parameters:\n\t///   - refDate: reference date\n\t///   - orEqual: `true` to also check for equality\n\t///   - granularity: Smallest unit that must, along with all larger units, be greater for the given dates.\n\t/// - Returns: Boolean\n\tfunc isAfterDate(_ refDate: DateInRegion, orEqual: Bool = false, granularity: Calendar.Component) -> Bool {\n\t\tlet result = compare(toDate: refDate, granularity: granularity)\n\t\treturn (orEqual ? (result == .orderedSame || result == .orderedDescending) : result == .orderedDescending)\n\t}\n\n\t/// Compares equality of two given dates based on their components down to a given unit\n\t/// granularity.\n\t///\n\t/// - parameter date:        date to compare\n\t/// - parameter granularity: The smallest unit that must, along with all larger units, be equal for the given\n\t///         dates to be considered the same.\n\t///\n\t/// - returns: `true` if the dates are the same down to the given granularity, otherwise `false`\n\tfunc isInside(date: DateInRegion, granularity: Calendar.Component) -> Bool {\n        (compare(toDate: date, granularity: granularity) == .orderedSame)\n\t}\n\n\t/// Returns a value between 0.0 and 1.0 or nil, that is the position of current date between 2 other dates.\n\t///\n\t/// - Parameters:\n\t///   - startDate: range upper bound date\n\t///   - endDate: range lower bound date\n\t/// - Returns: `nil` if current date is not between `startDate` and `endDate`. Otherwise returns position between `startDate` and `endDate`.\n\tfunc positionInRange(date startDate: DateInRegion, and endDate: DateInRegion) -> Double? {\n\t\tlet diffCurrentDateAndStartDate = self - startDate\n\t\tguard diffCurrentDateAndStartDate >= 0 else {\n\t\t\treturn nil\n\t\t}\n\t\tlet diffEndDateAndStartDate = endDate - startDate\n\t\tguard diffEndDateAndStartDate > 0, diffCurrentDateAndStartDate <= diffEndDateAndStartDate else {\n\t\t\treturn nil\n\t\t}\n\t\treturn diffCurrentDateAndStartDate / diffEndDateAndStartDate\n\t}\n\n\t/// Return `true` if receiver data is contained in the range specified by two dates.\n\t///\n\t/// - Parameters:\n\t///   - startDate: range upper bound date\n\t///   - endDate: range lower bound date\n\t///   - orEqual: `true` to also check for equality on date and date2, default is `true`\n\t///   - granularity: smallest unit that must, along with all larger units, be greater\n\t/// - Returns: Boolean\n\tfunc isInRange(date startDate: DateInRegion, and endDate: DateInRegion, orEqual: Bool = true, granularity: Calendar.Component = .nanosecond) -> Bool {\n        isAfterDate(startDate, orEqual: orEqual, granularity: granularity) && isBeforeDate(endDate, orEqual: orEqual, granularity: granularity)\n\t}\n\n\t// MARK: - Date Earlier/Later\n\n\t/// Return the earlier of two dates, between self and a given date.\n\t///\n\t/// - Parameter date: The date to compare to self\n\t/// - Returns: The date that is earlier\n\tfunc earlierDate(_ date: DateInRegion) -> DateInRegion {\n        self.date.timeIntervalSince(date.date) <= 0 ? self : date\n\t}\n\n\t/// Return the later of two dates, between self and a given date.\n\t///\n\t/// - Parameter date: The date to compare to self\n\t/// - Returns: The date that is later\n\tfunc laterDate(_ date: DateInRegion) -> DateInRegion {\n        self.date.timeIntervalSince(date.date) >= 0 ? self : date\n\t}\n\n    /// Returns the difference in the calendar component given (like day, month or year)\n    /// with respect to the other date as a positive integer\n    func difference(in component: Calendar.Component, from other: DateInRegion) -> Int? {\n        self.date.difference(in: component, from: other.date)\n    }\n\n    /// Returns the differences in the calendar components given (like day, month and year)\n    /// with respect to the other date as dictionary with the calendar component as the key\n    /// and the diffrence as a positive integer as the value\n    func differences(in components: Set<Calendar.Component>, from other: DateInRegion) -> [Calendar.Component: Int] {\n        self.date.differences(in: components, from: other.date)\n    }\n\n}\n"
  },
  {
    "path": "Sources/SwiftDate/DateInRegion/DateInRegion+Components.swift",
    "content": "//\n//  SwiftDate\n//  Parse, validate, manipulate, and display dates, time and timezones in Swift\n//\n//  Created by Daniele Margutti\n//   - Web: https://www.danielemargutti.com\n//   - Twitter: https://twitter.com/danielemargutti\n//   - Mail: hello@danielemargutti.com\n//\n//  Copyright © 2019 Daniele Margutti. Licensed under MIT License.\n//\n\nimport Foundation\n\npublic extension DateInRegion {\n\n\t/// Indicates whether the month is a leap month.\n\tvar isLeapMonth: Bool {\n\t\tlet calendar = region.calendar\n\t\t// Library function for leap contains a bug for Gregorian calendars, implemented workaround\n\t\tif calendar.identifier == Calendar.Identifier.gregorian && year > 1582 {\n\t\t\tguard let range: Range<Int> = calendar.range(of: .day, in: .month, for: date) else {\n\t\t\t\treturn false\n\t\t\t}\n\t\t\treturn ((range.upperBound - range.lowerBound) == 29)\n\t\t}\n\t\t// For other calendars:\n\t\treturn calendar.dateComponents([.day, .month, .year], from: date).isLeapMonth!\n\t}\n\n\t/// Indicates whether the year is a leap year.\n\tvar isLeapYear: Bool {\n\t\tlet calendar = region.calendar\n\t\t// Library function for leap contains a bug for Gregorian calendars, implemented workaround\n\t\tif calendar.identifier == Calendar.Identifier.gregorian {\n\t\t\tvar newComponents = dateComponents\n\t\t\tnewComponents.month = 2\n\t\t\tnewComponents.day = 10\n\t\t\tlet testDate = DateInRegion(components: newComponents, region: region)\n\t\t\treturn testDate!.isLeapMonth\n\t\t} else if calendar.identifier == Calendar.Identifier.chinese {\n\t\t\t/// There are 12 or 13 months in each year and 29 or 30 days in each month.\n\t\t\t/// A 13-month year is a leap year, which meaning more than 376 days is a leap year.\n\t\t\treturn ( dateAtStartOf(.year).toUnit(.day, to: dateAtEndOf(.year)) > 375 )\n\t\t}\n\t\t// For other calendars:\n\t\treturn calendar.dateComponents([.day, .month, .year], from: date).isLeapMonth!\n\t}\n\n\t/// Julian day is the continuous count of days since the beginning of\n\t/// the Julian Period used primarily by astronomers.\n\tvar julianDay: Double {\n\t\tlet destRegion = Region(calendar: Calendars.gregorian, zone: Zones.gmt, locale: Locales.english)\n\t\tlet utc = convertTo(region: destRegion)\n\n\t\tlet year = Double(utc.year)\n\t\tlet month = Double(utc.month)\n\t\tlet day = Double(utc.day)\n\t\tlet hour = Double(utc.hour) + Double(utc.minute) / 60.0 + (Double(utc.second) + Double(utc.nanosecond) / 1e9) / 3600.0\n\n\t\tvar jd = 367.0 * year - floor( 7.0 * ( year + floor((month + 9.0) / 12.0)) / 4.0 )\n\t\tjd -= floor( 3.0 * (floor( (year + (month - 9.0) / 7.0) / 100.0 ) + 1.0) / 4.0 )\n\t\tjd += floor(275.0 * month / 9.0) + day + 1_721_028.5 + hour / 24.0\n\n\t\treturn jd\n\t}\n\n\t/// The Modified Julian Date (MJD) was introduced by the Smithsonian Astrophysical Observatory\n\t/// in 1957 to record the orbit of Sputnik via an IBM 704 (36-bit machine)\n\t/// and using only 18 bits until August 7, 2576.\n\tvar modifiedJulianDay: Double {\n        julianDay - 2_400_000.5\n\t}\n\n\t/// Return elapsed time expressed in given components since the current receiver and a reference date.\n\t/// Time is evaluated with the fixed measumerent of each unity.\n\t///\n\t/// - Parameters:\n\t///   - refDate: reference date (`nil` to use current date in the same region of the receiver)\n\t///   - component: time unit to extract.\n\t/// - Returns: value\n\tfunc getInterval(toDate: DateInRegion?, component: Calendar.Component) -> Int64 {\n\t\tlet refDate = (toDate ?? region.nowInThisRegion())\n\t\tswitch component {\n\t\tcase .year:\n\t\t\tlet end = calendar.ordinality(of: .year, in: .era, for: refDate.date)\n\t\t\tlet start = calendar.ordinality(of: .year, in: .era, for: date)\n\t\t\treturn Int64(end! - start!)\n\n\t\tcase .month:\n\t\t\tlet end = calendar.ordinality(of: .month, in: .era, for: refDate.date)\n\t\t\tlet start = calendar.ordinality(of: .month, in: .era, for: date)\n\t\t\treturn Int64(end! - start!)\n\n\t\tcase .day:\n\t\t\tlet end = calendar.ordinality(of: .day, in: .era, for: refDate.date)\n\t\t\tlet start = calendar.ordinality(of: .day, in: .era, for: date)\n\t\t\treturn Int64(end! - start!)\n\n\t\tcase .hour:\n\t\t\tlet interval = refDate.date.timeIntervalSince(date)\n\t\t\treturn Int64(interval / 1.hours.timeInterval)\n\n\t\tcase .minute:\n\t\t\tlet interval = refDate.date.timeIntervalSince(date)\n\t\t\treturn Int64(interval / 1.minutes.timeInterval)\n\n\t\tcase .second:\n\t\t\treturn Int64(refDate.date.timeIntervalSince(date))\n\n\t\tcase .weekday:\n\t\t\tlet end = calendar.ordinality(of: .weekday, in: .era, for: refDate.date)\n\t\t\tlet start = calendar.ordinality(of: .weekday, in: .era, for: date)\n\t\t\treturn Int64(end! - start!)\n\n\t\tcase .weekdayOrdinal:\n\t\t\tlet end = calendar.ordinality(of: .weekdayOrdinal, in: .era, for: refDate.date)\n\t\t\tlet start = calendar.ordinality(of: .weekdayOrdinal, in: .era, for: date)\n\t\t\treturn Int64(end! - start!)\n\n\t\tcase .weekOfYear:\n\t\t\tlet end = calendar.ordinality(of: .weekOfYear, in: .era, for: refDate.date)\n\t\t\tlet start = calendar.ordinality(of: .weekOfYear, in: .era, for: date)\n\t\t\treturn Int64(end! - start!)\n\n\t\tdefault:\n\t\t\tdebugPrint(\"Passed component cannot be used to extract values using interval() function between two dates. Returning 0.\")\n\t\t\treturn 0\n\t\t}\n\t}\n\n\t/// The interval between the receiver and the another parameter.\n\t/// If the receiver is earlier than anotherDate, the return value is negative.\n\t/// If anotherDate is nil, the results are undefined.\n\t///\n\t/// - Parameter date: The date with which to compare the receiver.\n\t/// - Returns: time interval between two dates\n\tfunc timeIntervalSince(_ date: DateInRegion) -> TimeInterval {\n        self.date.timeIntervalSince(date.date)\n\t}\n\n\t/// Extract DateComponents from the difference between two dates.\n\t///\n\t/// - Parameter rhs: date to compare\n\t/// - Returns: components\n\tfunc componentsTo(_ rhs: DateInRegion) -> DateComponents {\n        calendar.dateComponents(DateComponents.allComponentsSet, from: rhs.date, to: date)\n\t}\n\n\t/// Returns the difference between two dates (`date - self`) expressed as date components.\n\t///\n\t/// - Parameters:\n\t///   - date: reference date as initial date (left operand)\n\t///   - components: components to extract, `nil` to use default `DateComponents.allComponentsSet`\n\t/// - Returns: extracted date components\n\tfunc componentsSince(_ date: DateInRegion, components: [Calendar.Component]? = nil) -> DateComponents {\n\t\tif date.calendar != calendar {\n\t\t\tdebugPrint(\"Date has different calendar, results maybe wrong\")\n\t\t}\n\t\tlet cmps = (components != nil ? Calendar.Component.toSet(components!) : DateComponents.allComponentsSet)\n\t\treturn date.calendar.dateComponents(cmps, from: date.date, to: self.date)\n\t}\n\n}\n"
  },
  {
    "path": "Sources/SwiftDate/DateInRegion/DateInRegion+Create.swift",
    "content": "//\n//  SwiftDate\n//  Parse, validate, manipulate, and display dates, time and timezones in Swift\n//\n//  Created by Daniele Margutti\n//   - Web: https://www.danielemargutti.com\n//   - Twitter: https://twitter.com/danielemargutti\n//   - Mail: hello@danielemargutti.com\n//\n//  Copyright © 2019 Daniele Margutti. Licensed under MIT License.\n//\n\nimport Foundation\n\npublic extension DateInRegion {\n\n\t// MARK: - Random Date Generator\n\n\t/// Generate a sequence of dates between a range.\n\t///\n\t/// - Parameters:\n\t///   - count: number of dates to generate.\n\t///   - initial: lower date bound.\n\t///   - final: upper date bound.\n\t///   - region: region of the dates.\n\t/// - Returns: array of dates\n\tstatic func randomDates(count: Int, between initial: DateInRegion, and final: DateInRegion,\n\t\t\t\t\t\t\t\t   region: Region = SwiftDate.defaultRegion) -> [DateInRegion] {\n\t\tvar list: [DateInRegion] = []\n\t\tfor _ in 0..<count {\n\t\t\tlist.append(DateInRegion.randomDate(between: initial, and: final, region: region))\n\t\t}\n\t\treturn list\n\t}\n\n\t/// Return a date between now and a specified amount days ealier.\n\t///\n\t/// - Parameters:\n\t///   - days: days range\n\t///   - region: destination region, `nil` to use the default region\n\t/// - Returns: random date\n\tstatic func randomDate(withinDaysBeforeToday days: Int,\n\t\t\t\t\t\t\t\t  region: Region = SwiftDate.defaultRegion) -> DateInRegion {\n\t\tlet today = DateInRegion(region: region)\n\t\tlet earliest = DateInRegion(today.date.addingTimeInterval(TimeInterval(-days * 24 * 60 * 60)), region: region)\n\t\treturn DateInRegion.randomDate(between: earliest, and: today)\n\t}\n\n\t/// Generate a random date in given region.\n\t///\n\t/// - Parameter region: destination region, `nil` to use the default region\n\t/// - Returns: random date\n\tstatic func randomDate(region: Region = SwiftDate.defaultRegion) -> DateInRegion {\n\t\tlet randomTime = TimeInterval(UInt32.random(in: UInt32.min..<UInt32.max))\n\t\tlet absoluteDate = Date(timeIntervalSince1970: randomTime)\n\t\treturn DateInRegion(absoluteDate, region: region)\n\t}\n\n\t/// Generate a random date between two intervals.\n\t///\n\t/// - Parameters:\n\t///   - initial: lower bound date\n\t///   - final: upper bound date\n\t///   - region: destination region, `nil` to use the default region\n\t/// - Returns: random Date\n\tstatic func randomDate(between initial: DateInRegion, and final: DateInRegion,\n\t\t\t\t\t\t\t\t  region: Region = SwiftDate.defaultRegion) -> DateInRegion {\n\t\tlet interval = final.timeIntervalSince(initial)\n\t\tlet randomInterval = TimeInterval(UInt32.random(in: UInt32.min..<UInt32(interval)))\n\t\treturn initial.addingTimeInterval(randomInterval)\n\t}\n\n\t/// Return the oldest date in given list (timezone is ignored, comparison uses absolute date).\n\t///\n\t/// - Parameter list: list of dates\n\t/// - Returns: a tuple with the index of the oldest date and its instance.\n\tstatic func oldestIn(list: [DateInRegion]) -> DateInRegion? {\n\t\tguard list.count > 0 else { return nil }\n\t\tguard list.count > 1 else { return list.first! }\n\t\treturn list.min(by: {\n\t\t\treturn $0 < $1\n\t\t})\n\t}\n\n\t/// Sort date by oldest, with the oldest date on top.\n\t///\n\t/// - Parameter list: list to sort\n\t/// - Returns: sorted array\n\tstatic func sortedByOldest(list: [DateInRegion]) -> [DateInRegion] {\n        list.sorted(by: { $0.date.compare($1.date) == .orderedAscending })\n\t}\n\n\t/// Sort date by newest, with the newest date on top.\n\t///\n\t/// - Parameter list: list to sort\n\t/// - Returns: sorted array\n\tstatic func sortedByNewest(list: [DateInRegion]) -> [DateInRegion] {\n        list.sorted(by: { $0.date.compare($1.date) == .orderedDescending })\n\t}\n\n\t/// Return the newest date in given list (timezone is ignored, comparison uses absolute date).\n\t///\n\t/// - Parameter list: list of dates\n\t/// - Returns: a tuple with the index of the newest date and its instance.\n\tstatic func newestIn(list: [DateInRegion]) -> DateInRegion? {\n\t\tguard list.count > 0 else { return nil }\n\t\tguard list.count > 1 else { return list.first! }\n\t\treturn list.max(by: {\n\t\t\treturn $0 < $1\n\t\t})\n\t}\n\n\t/// Enumerate dates between two intervals by adding specified time components and return an array of dates.\n\t/// `startDate` interval will be the first item of the resulting array.\n\t/// The last item of the array is evaluated automatically and maybe not equal to `endDate`.\n\t///\n\t/// - Parameters:\n\t///   - start: starting date\n\t///   - endDate: ending date\n\t///   - increment: components to add\n\t/// - Returns: array of dates\n\tstatic func enumerateDates(from startDate: DateInRegion, to endDate: DateInRegion, increment: DateComponents) -> [DateInRegion] {\n        DateInRegion.enumerateDates(from: startDate, to: endDate, increment: { _ in\n\t\t\treturn increment\n\t\t})\n\t}\n\n\t/// Enumerate dates between two intervals by adding specified time components defined in a closure and return an array of dates.\n\t/// `startDate` interval will be the first item of the resulting array.\n\t/// The last item of the array is evaluated automatically and maybe not equal to `endDate`.\n\t///\n\t/// - Parameters:\n\t///   - start: starting date\n\t///   - endDate: ending date\n\t///   - increment: increment function. It get the last generated date and require a valida `DateComponents` instance which define the increment\n\t/// - Returns: array of dates\n\tstatic func enumerateDates(from startDate: DateInRegion, to endDate: DateInRegion, increment: ((DateInRegion) -> (DateComponents))) -> [DateInRegion] {\n\t\tguard startDate.calendar == endDate.calendar else {\n\t\t\tdebugPrint(\"Cannot enumerate dates between two different region's calendars. Return empty array.\")\n\t\t\treturn []\n\t\t}\n\n\t\tvar dates: [DateInRegion] = []\n\t\tvar currentDate = startDate\n\t\twhile currentDate <= endDate {\n\t\t\tdates.append(currentDate)\n\t\t\tcurrentDate = (currentDate + increment(currentDate))\n\t\t}\n\t\treturn dates\n\t}\n\n\t/// Returns a new DateInRegion that is initialized at the start of a specified unit of time.\n\t///\n\t/// - Parameter unit: time unit value.\n\t/// - Returns: instance at the beginning of the time unit; `self` if fails.\n\tfunc dateAtStartOf(_ unit: Calendar.Component) -> DateInRegion {\n\t\tvar start: NSDate?\n\t\tvar interval: TimeInterval = 0\n\t\tguard (region.calendar as NSCalendar).range(of: unit.nsCalendarUnit, start: &start, interval: &interval, for: date),\n\t\t\tlet startDate = start else {\n\t\t\t\treturn self\n\t\t}\n\t\treturn DateInRegion(startDate as Date, region: region)\n\t}\n\n\t/// Return a new DateInRegion that is initialized at the start of the specified components\n\t/// executed in order.\n\t///\n\t/// - Parameter units: sequence of transformations as time unit components\n\t/// - Returns: new date at the beginning of the passed components, intermediate results if fails.\n\tfunc dateAtStartOf(_ units: [Calendar.Component]) -> DateInRegion {\n        units.reduce(self) { (currentDate, currentUnit) -> DateInRegion in\n\t\t\treturn currentDate.dateAtStartOf(currentUnit)\n\t\t}\n\t}\n\n\t/// Returns a new Moment that is initialized at the end of a specified unit of time.\n\t///\n\t/// - parameter unit: time unit value.\n\t///\n\t/// - returns: A new Moment instance.\n\tfunc dateAtEndOf(_ unit: Calendar.Component) -> DateInRegion {\n\t\t// RangeOfUnit returns the start of the next unit; we will subtract one thousandth of a second\n\t\tvar start: NSDate?\n\t\tvar interval: TimeInterval = 0\n\t\tguard (self.region.calendar as NSCalendar).range(of: unit.nsCalendarUnit, start: &start, interval: &interval, for: date),\n\t\tlet startDate = start else {\n\t\t\treturn self\n\t\t}\n\t\tlet startOfNextUnit = startDate.addingTimeInterval(interval)\n\t\tlet endOfThisUnit = Date(timeInterval: -0.001, since: startOfNextUnit as Date)\n\t\treturn DateInRegion(endOfThisUnit, region: region)\n\t}\n\n\t/// Return a new DateInRegion that is initialized at the end of the specified components\n\t/// executed in order.\n\t///\n\t/// - Parameter units: sequence of transformations as time unit components\n\t/// - Returns: new date at the end of the passed components, intermediate results if fails.\n\tfunc dateAtEndOf(_ units: [Calendar.Component]) -> DateInRegion {\n        units.reduce(self) { (currentDate, currentUnit) -> DateInRegion in\n\t\t\treturn currentDate.dateAtEndOf(currentUnit)\n\t\t}\n\t}\n\n\t/// Create a new date by altering specified components of the receiver.\n\t/// Note: `calendar` and `timezone` are ignored.\n\t/// Note: some components may alter the date cyclically (like setting both `.year` and `.yearForWeekOfYear`) and\n\t/// may results in a wrong evaluated date.\n\t///\n\t/// - Parameter components: components to alter with their new values.\n\t/// - Returns: new altered `DateInRegion` instance\n\tfunc dateBySet(_ components: [Calendar.Component: Int?]) -> DateInRegion? {\n\t\tvar dateComponents = DateComponents()\n\t\tdateComponents.year = (components[.year] ?? year)\n\t\tdateComponents.month = (components[.month] ?? month)\n\t\tdateComponents.day = (components[.day] ?? day)\n\t\tdateComponents.hour = (components[.hour] ?? hour)\n\t\tdateComponents.minute = (components[.minute] ?? minute)\n\t\tdateComponents.second = (components[.second] ?? second)\n\t\tdateComponents.nanosecond = (components[.nanosecond] ?? nanosecond)\n\n\t\t// Some components may interfer with others, so we'll set it them only if explicitly set.\n\t\tif let weekday = components[.weekday] {\n\t\t\tdateComponents.weekday = weekday\n\t\t}\n\t\tif let weekOfYear = components[.weekOfYear] {\n\t\t\tdateComponents.weekOfYear = weekOfYear\n\t\t}\n\t\tif let weekdayOrdinal = components[.weekdayOrdinal] {\n\t\t\tdateComponents.weekdayOrdinal = weekdayOrdinal\n\t\t}\n\t\tif let yearForWeekOfYear = components[.yearForWeekOfYear] {\n\t\t\tdateComponents.yearForWeekOfYear = yearForWeekOfYear\n\t\t}\n\n\t\tguard let newDate = calendar.date(from: dateComponents) else { return nil }\n\t\treturn DateInRegion(newDate, region: region)\n\t}\n\n\t/// Create a new date by altering specified time components.\n\t///\n\t/// - Parameters:\n\t///   - hour: hour to set (`nil` to leave it unaltered)\n\t///   - min: min to set (`nil` to leave it unaltered)\n\t///   - secs: sec to set (`nil` to leave it unaltered)\n\t///   - ms: milliseconds to set (`nil` to leave it unaltered)\n\t///   - options: options for calculation\n\t/// - Returns: new altered `DateInRegion` instance\n\tfunc dateBySet(hour: Int?, min: Int?, secs: Int?, ms: Int? = nil, options: TimeCalculationOptions = TimeCalculationOptions()) -> DateInRegion? {\n\t\tguard let date = calendar.date(bySettingHour: (hour ?? self.hour),\n\t\t\t\t\t\t\t\t\t\t\tminute: (min ?? self.minute),\n\t\t\t\t\t\t\t\t\t\t\tsecond: (secs ?? self.second),\n\t\t\t\t\t\t\t\t\t\t\tof: self.date,\n\t\t\t\t\t\t\t\t\t\t\tmatchingPolicy: options.matchingPolicy,\n\t\t\t\t\t\t\t\t\t\t\trepeatedTimePolicy: options.repeatedTimePolicy,\n\t\t\t\t\t\t\t\t\t\t\tdirection: options.direction) else { return nil }\n\t\tguard let ms = ms else {\n\t\t\treturn DateInRegion(date, region: region)\n\t\t}\n\t\tvar timestamp = date.timeIntervalSince1970.rounded(.down)\n\t\ttimestamp += Double(ms) / 1000.0\n\t\treturn DateInRegion(Date(timeIntervalSince1970: timestamp), region: region)\n\t}\n\n\t/// Creates a new instance by truncating the components\n\t///\n\t/// - Parameter components: components to truncate.\n\t/// - Returns: new date with truncated components.\n\tfunc dateTruncated(at components: [Calendar.Component]) -> DateInRegion? {\n\t\tvar dateComponents = self.dateComponents\n\n\t\tfor component in components {\n\t\t\tswitch component {\n\t\t\tcase .month:\t\tdateComponents.month = 1\n\t\t\tcase .day:\t\t\tdateComponents.day = 1\n\t\t\tcase .hour:\t\t\tdateComponents.hour = 0\n\t\t\tcase .minute:\t\tdateComponents.minute = 0\n\t\t\tcase .second:\t\tdateComponents.second = 0\n\t\t\tcase .nanosecond:\tdateComponents.nanosecond = 0\n\t\t\tdefault:\t\t\tcontinue\n\t\t\t}\n\t\t}\n\n\t\tguard let newDate = calendar.date(from: dateComponents) else { return nil }\n\t\treturn DateInRegion(newDate, region: region)\n\t}\n\n\t/// Creates a new instance by truncating the components starting from given components down the granurality.\n\t///\n\t/// - Parameter component: The component to be truncated from.\n\t/// - Returns: new date with truncated components.\n\tfunc dateTruncated(from component: Calendar.Component) -> DateInRegion? {\n\t\tswitch component {\n\t\tcase .month:\t\treturn dateTruncated(at: [.month, .day, .hour, .minute, .second, .nanosecond])\n\t\tcase .day:\t\t\treturn dateTruncated(at: [.day, .hour, .minute, .second, .nanosecond])\n\t\tcase .hour:\t\t\treturn dateTruncated(at: [.hour, .minute, .second, .nanosecond])\n\t\tcase .minute:\t\treturn dateTruncated(at: [.minute, .second, .nanosecond])\n\t\tcase .second:\t\treturn dateTruncated(at: [.second, .nanosecond])\n\t\tcase .nanosecond:\treturn dateTruncated(at: [.nanosecond])\n\t\tdefault:\t\t\treturn self\n\t\t}\n\t}\n\n\t/// Round a given date time to the passed style (off|up|down).\n\t///\n\t/// - Parameter style: rounding mode.\n\t/// - Returns: rounded date\n\tfunc dateRoundedAt(_ style: RoundDateMode) -> DateInRegion {\n\t\tswitch style {\n\t\tcase .to5Mins:\t\t\treturn dateRoundedAt(.toMins(5))\n\t\tcase .to10Mins:\t\t\treturn dateRoundedAt(.toMins(10))\n\t\tcase .to30Mins:\t\t\treturn dateRoundedAt(.toMins(30))\n\t\tcase .toCeil5Mins:\t\treturn dateRoundedAt(.toCeilMins(5))\n\t\tcase .toCeil10Mins:\t\treturn dateRoundedAt(.toCeilMins(10))\n\t\tcase .toCeil30Mins:\t\treturn dateRoundedAt(.toCeilMins(30))\n\t\tcase .toFloor5Mins:\t\treturn dateRoundedAt(.toFloorMins(5))\n\t\tcase .toFloor10Mins:\treturn dateRoundedAt(.toFloorMins(10))\n\t\tcase .toFloor30Mins:\treturn dateRoundedAt(.toFloorMins(30))\n\n\t\tcase .toMins(let minuteInterval):\n\t\t\tlet onesDigit: Int = (minute % 10)\n\t\t\tif onesDigit < 5 {\n\t\t\t\treturn dateRoundedAt(.toFloorMins(minuteInterval))\n\t\t\t} else {\n\t\t\t\treturn dateRoundedAt(.toCeilMins(minuteInterval))\n\t\t\t}\n\n\t\tcase .toCeilMins(let minuteInterval):\n\t\t\tlet remain: Int = (minute % minuteInterval)\n\t\t\tlet value = (( Int(1.minutes.timeInterval) * (minuteInterval - remain)) - second)\n\t\t\treturn dateByAdding(value, .second)\n\n\t\tcase .toFloorMins(let minuteInterval):\n\t\t\tlet remain: Int = (minute % minuteInterval)\n\t\t\tlet value = -((Int(1.minutes.timeInterval) * remain) + second)\n\t\t\treturn dateByAdding(value, .second)\n\n\t\t}\n\t}\n\n\t/// Offset a date by n calendar components.\n\t/// Note: This operation can be functionally chained.\n\t///\n\t/// - Parameters:\n\t///   - count: value of the offset (maybe negative).\n\t///   - component: component to offset.\n\t/// - Returns: new altered date.\n\tfunc dateByAdding(_ count: Int, _ component: Calendar.Component) -> DateInRegion {\n\t\tvar newComponent = DateComponents(second: 0)\n\t\tswitch component {\n\t\tcase .era: \t\t\t\t\tnewComponent = DateComponents(era: count)\n\t\tcase .year: \t\t\t\tnewComponent = DateComponents(year: count)\n\t\tcase .month: \t\t\t\tnewComponent = DateComponents(month: count)\n\t\tcase .day: \t\t\t\t\tnewComponent = DateComponents(day: count)\n\t\tcase .hour: \t\t\t\tnewComponent = DateComponents(hour: count)\n\t\tcase .minute: \t\t\t\tnewComponent = DateComponents(minute: count)\n\t\tcase .second:\t\t\t\tnewComponent = DateComponents(second: count)\n\t\tcase .weekday:\t\t\t\tnewComponent = DateComponents(weekday: count)\n\t\tcase .weekdayOrdinal: \t\tnewComponent = DateComponents(weekdayOrdinal: count)\n\t\tcase .quarter: \t\t\t\tnewComponent = DateComponents(quarter: count)\n\t\tcase .weekOfMonth: \t\t\tnewComponent = DateComponents(weekOfMonth: count)\n\t\tcase .weekOfYear: \t\t\tnewComponent = DateComponents(weekOfYear: count)\n\t\tcase .yearForWeekOfYear: \tnewComponent = DateComponents(yearForWeekOfYear: count)\n\t\tcase .nanosecond: \t\t\tnewComponent = DateComponents(nanosecond: count)\n\t\tdefault: break // .calendar and .timezone does nothing in this context\n\t\t}\n\n\t\tguard let newDate = region.calendar.date(byAdding: newComponent, to: date) else {\n\t\t\treturn self // failed to add component, return unmodified date\n\t\t}\n\t\treturn DateInRegion(newDate, region: region)\n\t}\n\n\t/// Return related date starting from the receiver attributes.\n\t///\n\t/// - Parameter type: related date to obtain.\n\t/// - Returns: instance of the related date; if fails the same unmodified date is returned\n\tfunc dateAt(_ type: DateRelatedType) -> DateInRegion {\n\t\tswitch type {\n\t\tcase .startOfDay:\n\t\t\treturn calendar.startOfDay(for: date).in(region: region)\n\t\tcase .endOfDay:\n\t\t\treturn dateByAdding(1, .day).dateAt(.startOfDay).dateByAdding(-1, .second)\n\t\tcase .startOfWeek:\n\t\t\tlet components = calendar.dateComponents([.yearForWeekOfYear, .weekOfYear], from: date)\n\t\t\treturn calendar.date(from: components)!.in(region: region)\n\t\tcase .endOfWeek:\n\t\t\treturn dateAt(.startOfWeek).dateByAdding(7, .day).dateByAdding(-1, .second)\n\t\tcase .startOfMonth:\n\t\t\treturn dateBySet([.day: 1, .hour: 0, .minute: 0, .second: 0, .nanosecond: 0])!\n\t\tcase .endOfMonth:\n\t\t\treturn dateByAdding((monthDays - day), .day).dateAtEndOf(.day)\n\t\tcase .tomorrow:\n\t\t\treturn dateByAdding(1, .day)\n\t\tcase .tomorrowAtStart:\n\t\t\treturn dateByAdding(1, .day).dateAtStartOf(.day)\n\t\tcase .yesterday:\n\t\t\treturn dateByAdding(-1, .day)\n\t\tcase .yesterdayAtStart:\n\t\t\treturn dateByAdding(-1, .day).dateAtStartOf(.day)\n\t\tcase .nearestMinute(let nearest):\n\t\t\tlet minutes = (minute + nearest / 2) / nearest * nearest\n\t\t\treturn dateBySet([.minute: minutes])!\n\t\tcase .nearestHour(let nearest):\n\t\t\tlet hours = (hour + nearest / 2) / nearest * nearest\n\t\t\treturn dateBySet([.hour: hours, .minute: 0])!\n\t\tcase .nextWeekday(let weekday):\n\t\t\tvar cal = Calendar(identifier: calendar.identifier)\n\t\t\tcal.firstWeekday = 2 // Sunday = 1, Saturday = 7\n\t\t\tvar components = DateComponents()\n\t\t\tcomponents.weekday = weekday.rawValue\n\t\t\tguard let next = cal.nextDate(after: date, matching: components, matchingPolicy: .nextTimePreservingSmallerComponents) else {\n\t\t\t\treturn self\n\t\t\t}\n\t\t\treturn DateInRegion(next, region: region)\n\t\tcase .nextDSTDate:\n\t\t\tguard let nextDate = region.timeZone.nextDaylightSavingTimeTransition(after: date) else {\n\t\t\t\treturn self\n\t\t\t}\n\t\t\treturn DateInRegion(nextDate, region: region)\n\t\tcase .prevMonth:\n\t\t\treturn dateByAdding(-1, .month).dateAtStartOf(.month).dateAtStartOf(.day)\n\t\tcase .nextMonth:\n\t\t\treturn dateByAdding(1, .month).dateAtStartOf(.month).dateAtStartOf(.day)\n\t\tcase .prevWeek:\n\t\t\treturn dateByAdding(-1, .weekOfYear).dateAtStartOf(.weekOfYear).dateAtStartOf(.day)\n\t\tcase .nextWeek:\n\t\t\treturn dateByAdding(1, .weekOfYear).dateAtStartOf(.weekOfYear).dateAtStartOf(.day)\n\t\tcase .nextYear:\n\t\t\treturn dateByAdding(1, .year).dateAtStartOf(.year)\n\t\tcase .prevYear:\n\t\t\treturn dateByAdding(-1, .year).dateAtStartOf(.year)\n\t\tcase .nextDSTTransition:\n\t\t\tguard let transitionDate = region.timeZone.nextDaylightSavingTimeTransition(after: date) else {\n\t\t\t\treturn self\n\t\t\t}\n\t\t\treturn DateInRegion(transitionDate, region: region)\n\t\t}\n\t}\n\n\t/// Create a new instance of the date in the same region with time shifted by given time interval.\n\t///\n\t/// - Parameter interval: time interval to shift; maybe negative.\n\t/// - Returns: new instance of the `DateInRegion`\n\tfunc addingTimeInterval(_ interval: TimeInterval) -> DateInRegion {\n        DateInRegion(date.addingTimeInterval(interval), region: region)\n\t}\n\n\t// MARK: - Conversion\n\n\t/// Convert a date to a new calendar/timezone/locale.\n\t/// Only non `nil` values are used, other values are inherithed by the receiver's region.\n\t///\n\t/// - Parameters:\n\t///   - calendar: non `nil` value to change the calendar\n\t///   - timezone: non `nil` value to change the timezone\n\t///   - locale: non `nil` value to change the locale\n\t/// - Returns: converted date\n\tfunc convertTo(calendar: CalendarConvertible? = nil, timezone: ZoneConvertible? = nil, locale: LocaleConvertible? = nil) -> DateInRegion {\n\t\tlet newRegion = Region(calendar: (calendar ?? region.calendar),\n\t\t\t\t\t\t\t   zone: (timezone ?? region.timeZone),\n\t\t\t\t\t\t\t   locale: (locale ?? region.locale))\n\t\treturn convertTo(region: newRegion)\n\t}\n\n\t/// Return the dates for a specific weekday inside given month of specified year.\n\t/// Ie. get me all the saturdays of Feb 2018.\n\t/// NOTE: Values are returned in order.\n\t///\n\t/// - Parameters:\n\t///   - weekday: weekday target.\n\t///   - month: month target.\n\t///   - year: year target.\n\t///   - region: region target, omit to use `SwiftDate.defaultRegion`\n\t/// - Returns: Ordered list of the dates for given weekday into given month.\n\tstatic func datesForWeekday(_ weekday: WeekDay, inMonth month: Int, ofYear year: Int,\n\t\t\t\t\t\t\t\t\t   region: Region = SwiftDate.defaultRegion) -> [DateInRegion] {\n\t\tlet fromDate = DateInRegion(year: year, month: month, day: 1, hour: 0, minute: 0, second: 0, nanosecond: 0, region: region)\n\t\tlet toDate = fromDate.dateAt(.endOfMonth)\n\t\treturn DateInRegion.datesForWeekday(weekday, from: fromDate, to: toDate, region: region)\n\t}\n\n\t/// Return the dates for a specific weekday inside a specified date range.\n\t/// NOTE: Values are returned in order.\n\t///\n\t/// - Parameters:\n\t///   - weekday: weekday target.\n\t///   - startDate: from date of the range.\n\t///   - endDate: to date of the range.\n\t///   - region: region target, omit to use `SwiftDate.defaultRegion`\n\t/// - Returns: Ordered list of the dates for given weekday in passed range.\n\tstatic func datesForWeekday(_ weekday: WeekDay, from startDate: DateInRegion, to endDate: DateInRegion,\n\t\t\t\t\t\t\t\t\t   region: Region = SwiftDate.defaultRegion) -> [DateInRegion] {\n\n\t\tlet calendarObj = region.calendar\n\t\tlet startDateWeekDay = Int(calendarObj.component(.weekday, from: startDate.date))\n\t\tlet desiredDay = weekday.rawValue\n\n\t\tlet offset = (desiredDay - startDateWeekDay + 7) % 7\n\t\tlet firstOccurrence = calendarObj.startOfDay(for: calendarObj.date(byAdding: DateComponents(day: offset), to: startDate.date)!)\n\t\tguard firstOccurrence.timeIntervalSince1970 < endDate.timeIntervalSince1970 else {\n\t\t\treturn []\n\t\t}\n\t\tvar dateOccurrences = [DateInRegion(firstOccurrence, region: region)]\n\t\twhile true {\n\t\t\tlet nextDate = DateInRegion(calendarObj.date(byAdding: DateComponents(day: 7), to: dateOccurrences.last!.date)!,\n\t\t\t\t\t\t\t\t\t\tregion: region)\n\t\t\tguard nextDate < endDate else {\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tdateOccurrences.append(nextDate)\n\t\t}\n\t\treturn dateOccurrences\n\t}\n\n}\n\npublic extension DateInRegion {\n\n    /// Returns the date at the given week number and week day preserving smaller components (hour, minute, seconds)\n    ///\n    /// For example: to get the third friday of next month\n    ///         let today = DateInRegion()\n    ///         let result = today.dateAt(weekdayOrdinal: 3, weekday: .friday, monthNumber: today.month + 1)\n    ///\n    /// - Parameters:\n    ///     - weekdayOrdinal: the week number (by set position in a recurrence rule)\n    ///     - weekday: WeekDay\n    ///     - monthNumber: a number from 1 to 12 representing the month, optional parameter\n    ///     - yearNumber: a number representing the year, optional parameter\n    /// - Returns: new date created with the given parameters\n    func dateAt(weekdayOrdinal: Int, weekday: WeekDay, monthNumber: Int? = nil,\n                yearNumber: Int? = nil) -> DateInRegion {\n        let monthNum = monthNumber ?? month\n        let yearNum = yearNumber ?? year\n\n        var requiredWeekNum = weekdayOrdinal\n        var result = DateInRegion(year: yearNum, month: monthNum, day: 1, hour: hour,\n                                  minute: minute, second: second, nanosecond: nanosecond, region: region)\n\n        if result.weekday == weekday.rawValue {\n            requiredWeekNum -= 1\n        }\n\n        while requiredWeekNum > 0 {\n            result = result.nextWeekday(weekday)\n            requiredWeekNum -= 1\n        }\n\n        return result\n    }\n\n    /// Returns the date on the given day of month preserving smaller components\n    func dateAt(dayOfMonth: Int, monthNumber: Int? = nil,\n                yearNumber: Int? = nil) -> DateInRegion {\n        let monthNum = monthNumber ?? month\n        let yearNum = yearNumber ?? year\n\n        let result = DateInRegion(year: yearNum, month: monthNum, day: dayOfMonth,\n                                  hour: hour, minute: minute, second: second,\n                                  nanosecond: nanosecond, region: region)\n\n        return result\n    }\n\n    /// Returns the date after given number of weeks on the given day of week\n    func dateAfter(weeks count: Int, on weekday: WeekDay) -> DateInRegion {\n        var result = self.dateByAdding(count, .weekOfMonth)\n        if result.weekday == weekday.rawValue {\n            return result\n        } else if result.weekday > weekday.rawValue {\n            result = result.dateByAdding(-1, .weekOfMonth)\n        }\n        return result.nextWeekday(weekday)\n    }\n\n    /// Returns the next weekday preserving smaller components\n    ///\n    /// - Parameters:\n    ///   - weekday: weekday to get.\n    ///   - region: region target, omit to use `SwiftDate.defaultRegion`\n    /// - Returns: `DateInRegion`\n    func nextWeekday(_ weekday: WeekDay) -> DateInRegion {\n        var components = DateComponents()\n        components.weekday = weekday.rawValue\n        components.hour = hour\n        components.second = second\n        components.minute = minute\n\n        guard let next = region.calendar.nextDate(after: date, matching: components,\n                                                  matchingPolicy: .nextTimePreservingSmallerComponents) else {\n                                                    return self\n        }\n\n        return DateInRegion(next, region: region)\n    }\n\n    /// Returns next date with the given weekday and the given week number\n    func next(_ weekday: WeekDay, withWeekOfMonth weekNumber: Int,\n              andMonthNumber monthNumber: Int? = nil) -> DateInRegion {\n        var result = self.dateAt(weekdayOrdinal: weekNumber, weekday: weekday, monthNumber: monthNumber)\n\n        if result <= self {\n\n            if let monthNum = monthNumber {\n                result = self.dateAt(weekdayOrdinal: weekNumber, weekday: weekday,\n                                     monthNumber: monthNum, yearNumber: self.year + 1)\n            } else {\n                result = self.dateAt(weekdayOrdinal: weekNumber, weekday: weekday, monthNumber: self.month + 1)\n            }\n\n        }\n\n        return result\n    }\n\n    /// Returns the next day of month preserving smaller components (hour, minute, seconds)\n    func next(dayOfMonth: Int, monthOfYear: Int? = nil) -> DateInRegion {\n        var components = DateComponents()\n        components.day = dayOfMonth\n        components.month = monthOfYear\n        components.hour = hour\n        components.second = second\n        components.minute = minute\n\n        guard let next = region.calendar.nextDate(after: date, matching: components,\n                                                  matchingPolicy: .nextTimePreservingSmallerComponents) else {\n                                                    return self\n        }\n\n        return DateInRegion(next, region: region)\n    }\n}\n"
  },
  {
    "path": "Sources/SwiftDate/DateInRegion/DateInRegion+Math.swift",
    "content": "//\n//  SwiftDate\n//  Parse, validate, manipulate, and display dates, time and timezones in Swift\n//\n//  Created by Daniele Margutti\n//   - Web: https://www.danielemargutti.com\n//   - Twitter: https://twitter.com/danielemargutti\n//   - Mail: hello@danielemargutti.com\n//\n//  Copyright © 2019 Daniele Margutti. Licensed under MIT License.\n//\n\nimport Foundation\n\n// MARK: - Math Operation DateInRegion - DateInRegion\n\npublic func - (lhs: DateInRegion, rhs: DateInRegion) -> TimeInterval {\n    lhs.timeIntervalSince(rhs)\n}\n\n// MARK: - Math Operation DateInRegion - Date Components\n\npublic func + (lhs: DateInRegion, rhs: DateComponents) -> DateInRegion {\n\tlet nextDate = lhs.calendar.date(byAdding: rhs, to: lhs.date)\n\treturn DateInRegion(nextDate!, region: lhs.region)\n}\n\npublic func - (lhs: DateInRegion, rhs: DateComponents) -> DateInRegion {\n    lhs + (-rhs)\n}\n\n// MARK: - Math Operation DateInRegion - Calendar.Component\n\npublic func + (lhs: DateInRegion, rhs: [Calendar.Component: Int]) -> DateInRegion {\n\tlet cmps = DateInRegion.componentsFrom(values: rhs)\n\treturn lhs + cmps\n}\n\npublic func - (lhs: DateInRegion, rhs: [Calendar.Component: Int]) -> DateInRegion {\n\tvar invertedCmps: [Calendar.Component: Int] = [:]\n\trhs.forEach { invertedCmps[$0.key] = -$0.value }\n\treturn lhs + invertedCmps\n}\n\n// MARK: - Internal DateInRegion Extension\n\nextension DateInRegion {\n\n\t/// Return a `DateComponent` object from a given set of `Calendar.Component` object with associated values and a specific region\n\t///\n\t/// - parameter values:    calendar components to set (with their values)\n\t/// - parameter multipler: optional multipler (by default is nil; to make an inverse component value it should be multipled by -1)\n\t/// - parameter region:    optional region to set\n\t///\n\t/// - returns: a `DateComponents` object\n\tinternal static func componentsFrom(values: [Calendar.Component: Int], multipler: Int? = nil, setRegion region: Region? = nil) -> DateComponents {\n\t\tvar cmps = DateComponents()\n\t\tif region != nil {\n\t\t\tcmps.calendar = region!.calendar\n\t\t\tcmps.calendar!.locale = region!.locale\n\t\t\tcmps.timeZone = region!.timeZone\n\t\t}\n\t\tvalues.forEach { pair in\n\t\t\tif pair.key != .timeZone && pair.key != .calendar {\n\t\t\t\tcmps.setValue( (multipler == nil ? pair.value : pair.value * multipler!), for: pair.key)\n\t\t\t}\n\t\t}\n\t\treturn cmps\n\t}\n\n\t/// Adds a time interval to this date.\n\t/// WARNING:\n\t/// This only adjusts an absolute value. If you wish to add calendrical concepts like hours,\n\t/// days, months then you must use a Calendar.\n\t/// That will take into account complexities like daylight saving time,\n\t/// months with different numbers of days, and more.\n\t///\n\t/// - Parameter timeInterval: The value to add, in seconds.\n\tpublic mutating func addTimeInterval(_ timeInterval: TimeInterval) {\n\t\tdate.addTimeInterval(timeInterval)\n\t}\n}\n"
  },
  {
    "path": "Sources/SwiftDate/DateInRegion/DateInRegion.swift",
    "content": "//\n//  SwiftDate\n//  Parse, validate, manipulate, and display dates, time and timezones in Swift\n//\n//  Created by Daniele Margutti\n//   - Web: https://www.danielemargutti.com\n//   - Twitter: https://twitter.com/danielemargutti\n//   - Mail: hello@danielemargutti.com\n//\n//  Copyright © 2019 Daniele Margutti. Licensed under MIT License.\n//\n\nimport Foundation\n\npublic struct DateInRegion: DateRepresentable, Decodable, Encodable, CustomStringConvertible, Comparable, Hashable {\n\n\t/// Absolute date represented. This date is not associated with any timezone or calendar\n\t/// but represent the absolute number of seconds since Jan 1, 2001 at 00:00:00 UTC.\n\tpublic internal(set) var date: Date\n\n\t/// Associated region which define where the date is represented into the world.\n\tpublic let region: Region\n\n\t/// Formatter used to transform this object in a string. By default is `nil` because SwiftDate\n\t/// uses the thread shared formatter in order to avoid expensive init of the `DateFormatter` object.\n\t/// However, if you need of a custom behaviour you can set a valid value.\n\tpublic var customFormatter: DateFormatter?\n\n\t/// Extract date components by taking care of the region in which the date is expressed.\n\tpublic var dateComponents: DateComponents {\n\t\treturn region.calendar.dateComponents(DateComponents.allComponentsSet, from: date)\n\t}\n\n\t/// Description of the date\n\tpublic var description: String {\n\t\tlet absISODate = DateFormatter.sharedFormatter(forRegion: Region.UTC).string(from: date)\n\t\tlet representedDate = formatter(format: DateFormats.iso8601).string(from: date)\n\t\treturn \"{abs_date='\\(absISODate)', rep_date='\\(representedDate)', region=\\(region.description)\"\n\t}\n\n\t/// The interval between the date value and 00:00:00 UTC on 1 January 1970.\n\tpublic var timeIntervalSince1970: TimeInterval {\n\t\treturn date.timeIntervalSince1970\n\t}\n\n\t/// Initialize with an absolute date and represent it into given geographic region.\n\t///\n\t/// - Parameters:\n\t///   - date: absolute date to represent.\n\t///   - region: region in which the date is represented. If ignored `defaultRegion` is used instead.\n\tpublic init(_ date: Date = Date(), region: Region = SwiftDate.defaultRegion) {\n\t\tself.date = date\n\t\tself.region = region\n\t}\n\n\t/// Initialize a new `DateInRegion` by parsing given string.\n\t/// If you know the format of the string you should pass it in order to speed up the parsing process.\n\t/// If you don't know the format leave it `nil` and parse is done between all formats in `DateFormats.builtInAutoFormats`\n\t/// and the ordered list you can provide in `SwiftDate.autoParseFormats` (with attempt priority set on your list).\n\t///\n\t/// - Parameters:\n\t///   - string: string with the date.\n\t///   - format: format of the date.\n\t///   - region: region in which the date is expressed.\n\tpublic init?(_ string: String, format: String? = nil, region: Region = SwiftDate.defaultRegion) {\n\t\tguard let date = DateFormats.parse(string: string,\n\t\t\t\t\t\t\t\t\t\t   format: format,\n\t\t\t\t\t\t\t\t\t\t   region: region) else {\n\t\t\treturn nil // failed to parse date\n\t\t}\n\t\tself.date = date\n\t\tself.region = region\n\t}\n\n\t/// Initialize a new `DateInRegion` by parsing given string with the ordered list of passed formats.\n\t/// If you know the format of the string you should pass it in order to speed up the parsing process.\n\t/// If you don't know the format leave it `nil` and parse is done between all formats in `DateFormats.builtInAutoFormats`\n\t/// and the ordered list you can provide in `SwiftDate.autoParseFormats` (with attempt priority set on your list).\n\t///\n\t/// - Parameters:\n\t///   - string: string with the date.\n\t///   - formats: ordered list of formats to use.\n\t///   - region: region in which the date is expressed.\n\tpublic init?(_ string: String, formats: [String]?, region: Region = SwiftDate.defaultRegion) {\n\t\tguard let date = DateFormats.parse(string: string,\n\t\t\t\t\t\t\t\t\t\t   formats: (formats ?? SwiftDate.autoFormats),\n\t\t\t\t\t\t\t\t\t\t   region: region) else {\n\t\t\treturn nil // failed to parse date\n\t\t}\n\t\tself.date = date\n\t\tself.region = region\n\t}\n\n\t/// Initialize a new date from the number of seconds passed since Unix Epoch.\n\t///\n\t/// - Parameters:\n\t///   - interval: seconds since Unix Epoch.\n\t///   - region: the region in which the date must be expressed, `nil` uses the default region at UTC timezone\n\tpublic init(seconds interval: TimeInterval, region: Region = Region.UTC) {\n\t\tself.date = Date(timeIntervalSince1970: interval)\n\t\tself.region = region\n\t}\n\n\t/// Initialize a new date corresponding to the number of milliseconds since the Unix Epoch.\n\t///\n\t/// - Parameters:\n\t///   - interval: seconds since the Unix Epoch timestamp.\n\t///   - region: region in which the date must be expressed, `nil` uses the default region at UTC timezone\n\tpublic init(milliseconds interval: Int, region: Region = Region.UTC) {\n\t\tself.date = Date(timeIntervalSince1970: TimeInterval(interval) / 1000)\n\t\tself.region = region\n\t}\n\n\t/// Initialize a new date with the opportunity to configure single date components via builder pattern.\n\t/// Date is therfore expressed in passed region (`DateComponents`'s `timezone`,`calendar` and `locale` are ignored\n\t/// and overwritten by the region if not `nil`).\n\t///\n\t/// - Parameters:\n\t///   - configuration: configuration callback\n\t///   - region: region in which the date is expressed.\n\t///\t\t\t\tIgnore to use `SwiftDate.defaultRegion`, `nil` to use `DateComponents` data.\n\tpublic init?(components configuration: ((inout DateComponents) -> Void), region: Region? = SwiftDate.defaultRegion) {\n\t\tvar components = DateComponents()\n\t\tconfiguration(&components)\n\t\tlet r = (region ?? Region(fromDateComponents: components))\n\t\tguard let date = r.calendar.date(from: components) else {\n\t\t\treturn nil\n\t\t}\n\t\tself.date = date\n\t\tself.region = r\n\t}\n\n\t/// Initialize a new date with given components.\n\t///\n\t/// - Parameters:\n\t///   - components: components of the date.\n\t///   - region: region in which the date is expressed.\n\t///\t\t\t\tIgnore to use `SwiftDate.defaultRegion`, `nil` to use `DateComponents` data.\n\tpublic init?(components: DateComponents, region: Region?) {\n\t\tlet r = (region ?? Region(fromDateComponents: components))\n\t\tguard let date = r.calendar.date(from: components) else {\n\t\t\treturn nil\n\t\t}\n\t\tself.date = date\n\t\tself.region = r\n\t}\n\n\t/// Initialize a new date with given components.\n\tpublic init(year: Int, month: Int, day: Int, hour: Int = 0, minute: Int = 0, second: Int = 0, nanosecond: Int = 0, region: Region = SwiftDate.defaultRegion) {\n\t\tvar components = DateComponents()\n\t\tcomponents.year = year\n\t\tcomponents.month = month\n\t\tcomponents.day = day\n\t\tcomponents.hour = hour\n\t\tcomponents.minute = minute\n\t\tcomponents.second = second\n\t\tcomponents.nanosecond = nanosecond\n\t\tcomponents.timeZone = region.timeZone\n\t\tcomponents.calendar = region.calendar\n\t\tself.date = region.calendar.date(from: components)!\n\t\tself.region = region\n\t}\n\n\t/// Return a date in the distant past.\n\t///\n\t/// - Returns: Date instance.\n\tpublic static func past() -> DateInRegion {\n        DateInRegion(Date.distantPast, region: SwiftDate.defaultRegion)\n\t}\n\n\t/// Return a date in the distant future.\n\t///\n\t/// - Returns: Date instance.\n\tpublic static func future() -> DateInRegion {\n        DateInRegion(Date.distantFuture, region: SwiftDate.defaultRegion)\n\t}\n\n\t// MARK: - Codable Support\n\n\tenum CodingKeys: String, CodingKey {\n\t\tcase date\n\t\tcase region\n\t}\n\n}\n"
  },
  {
    "path": "Sources/SwiftDate/DateInRegion/Region.swift",
    "content": "//\n//  SwiftDate\n//  Parse, validate, manipulate, and display dates, time and timezones in Swift\n//\n//  Created by Daniele Margutti\n//   - Web: https://www.danielemargutti.com\n//   - Twitter: https://twitter.com/danielemargutti\n//   - Mail: hello@danielemargutti.com\n//\n//  Copyright © 2019 Daniele Margutti. Licensed under MIT License.\n//\n\nimport Foundation\n\n/// Region define a context both for `Date` and `DateInRegion`.\n/// Each `Date` is assigned to the currently set `SwiftDate.default\npublic struct Region: Decodable, Encodable, Equatable, Hashable, CustomStringConvertible {\n\n\t// MARK: - Properties\n\n\t/// Calendar associated with region\n\tpublic let calendar: Calendar\n\n\t/// Locale associated with region\n\tpublic var locale: Locale { return calendar.locale! }\n\n\t/// Timezone associated with region\n\tpublic var timeZone: TimeZone { return calendar.timeZone }\n\n\t/// Description of the object\n\tpublic var description: String {\n        \"{calendar='\\(calendar.identifier)', timezone='\\(timeZone.identifier)', locale='\\(locale.identifier)'}\"\n\t}\n\n\tpublic func hash(into hasher: inout Hasher) {\n\t\thasher.combine(calendar)\n\t}\n\n\t// MARK: Initialization\n\n\t/// Initialize a new region with given parameters.\n\t///\n\t/// - Parameters:\n\t///   - calendar: calendar for region, if not specified `defaultRegions`'s calendar is used instead.\n\t///   - timezone: timezone for region, if not specified `defaultRegions`'s timezone is used instead.\n\t///   - locale: locale for region, if not specified `defaultRegions`'s locale is used instead.\n\tpublic init(calendar: CalendarConvertible = SwiftDate.defaultRegion.calendar,\n\t\t\t\tzone: ZoneConvertible = SwiftDate.defaultRegion.timeZone,\n\t\t\t\tlocale: LocaleConvertible = SwiftDate.defaultRegion.locale) {\n\t\tself.calendar = Calendar.newCalendar(calendar, configure: {\n\t\t\t$0.timeZone = zone.toTimezone()\n\t\t\t$0.locale = locale.toLocale()\n\t\t})\n\t}\n\n\t/// Initialize a new Region by reading the `timeZone`,`calendar` and `locale`\n\t/// parameters from the passed `DateComponents` instance.\n\t/// For any `nil` parameter the correspondent `SwiftDate.defaultRegion` is used instead.\n\t///\n\t/// - Parameter fromDateComponents: date components\n\tpublic init(fromDateComponents components: DateComponents) {\n\t\tlet tz = (components.timeZone ?? Zones.current.toTimezone())\n\t\tlet cal = (components.calendar ?? Calendars.gregorian.toCalendar())\n\t\tlet loc = (cal.locale ?? Locales.current.toLocale())\n        self.init(calendar: cal, zone: tz, locale: loc)\n\t}\n\n\tpublic static var UTC: Region {\n\t\treturn Region(calendar: Calendar.autoupdatingCurrent,\n\t\t\t\t\t  zone: Zones.gmt.toTimezone(),\n\t\t\t\t\t  locale: Locale.autoupdatingCurrent)\n\t}\n\n\t/// Return the current local device's region where all attributes are set to the device's values.\n\t///\n\t/// - Returns: Region\n\tpublic static var local: Region {\n\t\treturn Region(calendar: Calendar.autoupdatingCurrent,\n\t\t\t\t\t  zone: TimeZone.autoupdatingCurrent,\n\t\t\t\t\t  locale: Locale.autoupdatingCurrent)\n\t}\n\n\t/// ISO Region is defined by the gregorian calendar, gmt timezone and english posix locale\n\tpublic static var ISO: Region {\n\t\treturn Region(calendar: Calendars.gregorian.toCalendar(),\n\t\t\t\t\t  zone: Zones.gmt.toTimezone(),\n\t\t\t\t\t  locale: Locales.englishUnitedStatesComputer)\n\t}\n\n\t/// Return an auto updating region where all settings are obtained from the current's device settings.\n\t///\n\t/// - Returns: Region\n\tpublic static var current: Region {\n\t\treturn Region(calendar: Calendar.autoupdatingCurrent,\n\t\t\t\t\t  zone: TimeZone.autoupdatingCurrent,\n\t\t\t\t\t  locale: Locale.autoupdatingCurrent)\n\t}\n\n\t/// Return a new region in current's device timezone with optional adjust of the calendar and locale.\n\t///\n\t/// - Parameters:\n\t///   - locale: locale to set\n\t///   - calendar: calendar to set\n\t/// - Returns: region\n\tpublic static func currentIn(locale: LocaleConvertible? = nil, calendar: CalendarConvertible? = nil) -> Region {\n\t\treturn Region(calendar: (calendar ?? SwiftDate.defaultRegion.calendar),\n\t\t\t\t\t  zone: SwiftDate.defaultRegion.timeZone,\n\t\t\t\t\t  locale: (locale ?? SwiftDate.defaultRegion.locale))\n\t}\n\n\t/// Return the current date expressed into the receiver region.\n\t///\n\t/// - Returns: `DateInRegion` instance\n\tpublic func nowInThisRegion() -> DateInRegion {\n\t\treturn DateInRegion(Date(), region: self)\n\t}\n\n\t// MARK: - Codable Support\n\n\tenum CodingKeys: String, CodingKey {\n\t\tcase calendar\n\t\tcase locale\n\t\tcase timezone\n\t}\n\n\tpublic func encode(to encoder: Encoder) throws {\n\t\tvar container = encoder.container(keyedBy: CodingKeys.self)\n\t\ttry container.encode(calendar.timeZone.identifier, forKey: .timezone)\n\t\ttry container.encode(calendar.locale!.identifier, forKey: .locale)\n\t\ttry container.encode(calendar.identifier.description, forKey: .calendar)\n\t}\n\n\tpublic init(from decoder: Decoder) throws {\n\t\tlet values = try decoder.container(keyedBy: CodingKeys.self)\n\t\tlet calId = Calendar.Identifier( try values.decode(String.self, forKey: .calendar))\n\t\tlet tz = (TimeZone(identifier: try values.decode(String.self, forKey: .timezone)) ?? SwiftDate.defaultRegion.timeZone)\n\t\tlet lc = Locale(identifier: try values.decode(String.self, forKey: .locale))\n\t\tcalendar = Calendar.newCalendar(calId, configure: {\n\t\t\t$0.timeZone = tz\n\t\t\t$0.locale = lc\n\t\t})\n\t}\n\n\t// MARK: - Comparable\n\n\tpublic static func == (lhs: Region, rhs: Region) -> Bool {\n\t\t// Note: equality does not consider other parameters than the identifier of the major\n\t\t// attributes (calendar, timezone and locale). Deeper comparisor must be made directly\n\t\t// between Calendar (it may fail when you encode/decode autoUpdating calendars).\n\t\treturn\n\t\t\t(lhs.calendar.identifier == rhs.calendar.identifier) &&\n\t\t\t(lhs.timeZone.identifier == rhs.timeZone.identifier) &&\n\t\t\t(lhs.locale.identifier == rhs.locale.identifier)\n\t}\n}\n"
  },
  {
    "path": "Sources/SwiftDate/DateRepresentable.swift",
    "content": "//\n//  SwiftDate\n//  Parse, validate, manipulate, and display dates, time and timezones in Swift\n//\n//  Created by Daniele Margutti\n//   - Web: https://www.danielemargutti.com\n//   - Twitter: https://twitter.com/danielemargutti\n//   - Mail: hello@danielemargutti.com\n//\n//  Copyright © 2019 Daniele Margutti. Licensed under MIT License.\n//\n\nimport Foundation\n\npublic protocol DateRepresentable {\n\n\t// MARK: - Date Components\n\tvar year: Int { get }\n\n\t/// Represented month\n\tvar month: Int { get }\n\n\t/// Represented month name with given style.\n\t///\n\t/// - Parameter style: style in which the name must be formatted.\n\t/// - Returns: name of the month\n\tfunc monthName(_ style: SymbolFormatStyle) -> String\n\n\t/// Number of the days in the receiver.\n\tvar monthDays: Int { get }\n\n\t/// Day unit of the receiver.\n\tvar day: Int { get }\n\n\t/// Day of year unit of the receiver\n\tvar dayOfYear: Int { get }\n\n\t/// The number of day in ordinal style format for the receiver in current locale.\n\t/// For example, in the en_US locale, the number 3 is represented as 3rd;\n\t/// in the fr_FR locale, the number 3 is represented as 3e.\n\t@available(iOS 9.0, macOS 10.11, *)\n\tvar ordinalDay: String { get }\n\n\t/// Hour unit of the receiver.\n\tvar hour: Int { get }\n\n\t/// Nearest rounded hour from the date\n\tvar nearestHour: Int { get }\n\n\t/// Minute unit of the receiver.\n\tvar minute: Int { get }\n\n\t/// Second unit of the receiver.\n\tvar second: Int { get }\n\n\t/// Nanosecond unit of the receiver.\n\tvar nanosecond: Int { get }\n\n\t/// Milliseconds in day of the receiver\n\t/// This field behaves exactly like a composite of all time-related fields, not including the zone fields.\n\t/// As such, it also reflects discontinuities of those fields on DST transition days.\n\t/// On a day of DST onset, it will jump forward. On a day of DST cessation, it will jump backward.\n\t/// This reflects the fact that is must be combined with the offset field to obtain a unique local time value.\n\tvar msInDay: Int { get }\n\n\t/// Weekday unit of the receiver.\n\t/// The weekday units are the numbers 1-N (where for the Gregorian calendar N=7 and 1 is Sunday).\n\tvar weekday: Int { get }\n\n\t/// Name of the weekday expressed in given format style.\n\t///\n\t/// - Parameter style: style to express the value.\n\t/// - Parameter locale: locale to use; ignore it to use default's region locale.\n\t/// - Returns: weekday name\n\tfunc weekdayName(_ style: SymbolFormatStyle, locale: LocaleConvertible?) -> String\n\n\t/// Week of a year of the receiver.\n\tvar weekOfYear: Int { get }\n\n\t/// Week of a month of the receiver.\n\tvar weekOfMonth: Int { get }\n\n\t/// Ordinal position within the month unit of the corresponding weekday unit.\n\t/// For example, in the Gregorian calendar a weekday ordinal unit of 2 for a\n\t/// weekday unit 3 indicates \"the second Tuesday in the month\".\n\tvar weekdayOrdinal: Int { get }\n\n\t/// Return the first day number of the week where the receiver date is located.\n\tvar firstDayOfWeek: Int { get }\n\n\t/// Return the last day number of the week where the receiver date is located.\n\tvar lastDayOfWeek: Int { get }\n\n\t/// Relative year for a week within a year calendar unit.\n\tvar yearForWeekOfYear: Int { get }\n\n\t/// Quarter value of the receiver.\n\tvar quarter: Int { get }\n\n\t/// Quarter name expressed in given format style.\n\t///\n\t/// - Parameter style: style to express the value.\n\t/// - Parameter locale: locale to use; ignore it to use default's region locale.\n\t/// - Returns: quarter name\n\tfunc quarterName(_ style: SymbolFormatStyle, locale: LocaleConvertible?) -> String\n\n\t/// Era value of the receiver.\n\tvar era: Int { get }\n\n\t/// Name of the era expressed in given format style.\n\t///\n\t/// - Parameter style: style to express the value.\n\t/// - Parameter locale: locale to use; ignore it to use default's region locale.\n\t/// - Returns: era\n\tfunc eraName(_ style: SymbolFormatStyle, locale: LocaleConvertible?) -> String\n\n\t/// The current daylight saving time offset of the represented date.\n\tvar DSTOffset: TimeInterval { get }\n\n\t// MARK: - Common Properties\n\n\t/// Absolute representation of the date\n\tvar date: Date { get }\n\n\t/// Associated region\n\tvar region: Region { get }\n\n\t/// Associated calendar\n\tvar calendar: Calendar { get }\n\n\t/// Extract the date components from the date\n\tvar dateComponents: DateComponents { get }\n\n\t/// Returns whether the given date is in today as boolean.\n\tvar isToday: Bool { get }\n\n\t/// Returns whether the given date is in yesterday.\n\tvar isYesterday: Bool { get }\n\n\t/// Returns whether the given date is in tomorrow.\n\tvar isTomorrow: Bool { get }\n\n\t/// Returns whether the given date is in the weekend.\n\tvar isInWeekend: Bool { get }\n\n\t/// Return true if given date represent a passed date\n\tvar isInPast: Bool { get }\n\n\t/// Return true if given date represent a future date\n\tvar isInFuture: Bool { get }\n\n\t/// Use this object to format the date object.\n\t/// By default this object return the `customFormatter` instance (if set) or the\n\t/// local thread shared formatter (via `sharedFormatter()` func; this is the most typical scenario).\n\t///\n\t/// - Parameters:\n\t///   - format: format string to set.\n\t///   - configuration: optional callback used to configure the object inline.\n\t/// - Returns: formatter instance\n\tfunc formatter(format: String?, configuration: ((DateFormatter) -> Void)?) -> DateFormatter\n\n\t/// User this object to get an DateFormatter already configured to format the data object with the associated region.\n\t/// By default this object return the `customFormatter` instance (if set) configured for region or the\n\t/// local thread shared formatter even configured for region (via `sharedFormatter()` func; this is the most typical scenario).\n\t///\n\t///   - format: format string to set.\n\t///   - configuration: optional callback used to configure the object inline.\n\t/// - Returns: formatter instance\n\tfunc formatterForRegion(format: String?, configuration: ((inout DateFormatter) -> Void)?) -> DateFormatter\n\n\t/// Set a custom formatter for this object.\n\t/// Typically you should not need to set a value for this property.\n\t/// With a `nil` value SwiftDate will uses the threa shared formatter returned by `sharedFormatter()` function.\n\t/// In case you need to a custom formatter instance you can override the default behaviour by setting a value here.\n\tvar customFormatter: DateFormatter? { get set }\n\n\t/// Return a formatter instance created as singleton into the current caller's thread.\n\t/// This object is used for formatting when no `dateFormatter` is set for the object\n\t/// (this is the common scenario where you want to avoid multiple formatter instances to\n\t/// parse dates; instances of DateFormatter are very expensive to create and you should\n\t/// use a single instance in each thread to perform this kind of tasks).\n\t///\n\t/// - Returns: formatter instance\n\tvar sharedFormatter: DateFormatter { get }\n\n\t// MARK: - Init\n\n\t/// Initialize a new date by parsing a string.\n\t///\n\t/// - Parameters:\n\t///   - string: string with the date.\n\t///   - format: format used to parse date. Pass `nil` to use built-in formats\n\t///\t\t\t\t(if you know you should pass it to optimize the parsing process)\n\t///   - region: region in which the date in `string` is expressed.\n\tinit?(_ string: String, format: String?, region: Region)\n\n\t/// Initialize a new date from a number of seconds since the Unix Epoch.\n\t///\n\t/// - Parameters:\n\t///   - interval: seconds since the Unix Epoch timestamp.\n\t///   - region: region in which the date must be expressed.\n\tinit(seconds interval: TimeInterval, region: Region)\n\n\t/// Initialize a new date corresponding to the number of milliseconds since the Unix Epoch.\n\t///\n\t/// - Parameters:\n\t///   - interval: seconds since the Unix Epoch timestamp.\n\t///   - region: region in which the date must be expressed.\n\tinit(milliseconds interval: Int, region: Region)\n\n\t/// Initialize a new date with the opportunity to configure single date components via builder pattern.\n\t/// Date is therfore expressed in passed region (`DateComponents`'s `timezone`,`calendar` and `locale` are ignored\n\t/// and overwritten by the region if not `nil`).\n\t///\n\t/// - Parameters:\n\t///   - configuration: configuration callback\n\t///   - region: region in which the date is expressed. Ignore to use `SwiftDate.defaultRegion`,\n\t///\t\t\t\t`nil` to use `DateComponents` data.\n\tinit?(components configuration: ((inout DateComponents) -> Void), region: Region?)\n\n\t/// Initialize a new date with time components passed.\n\t///\n\t/// - Parameters:\n\t///   - components: date components\n\t///   - region: region in which the date is expressed. Ignore to use `SwiftDate.defaultRegion`,\n\t///\t\t\t\t`nil` to use `DateComponents` data.\n\tinit?(components: DateComponents, region: Region?)\n\n\t/// Initialize a new date with given components.\n\tinit(year: Int, month: Int, day: Int, hour: Int, minute: Int, second: Int, nanosecond: Int, region: Region)\n\n\t// MARK: - Conversion\n\n\t/// Convert a date to another region.\n\t///\n\t/// - Parameter region: destination region in which the date must be represented.\n\t/// - Returns: converted date\n\tfunc convertTo(region: Region) -> DateInRegion\n\n\t// MARK: - To String Formatting\n\n\t/// Convert date to a string using passed pre-defined style.\n\t///\n\t/// - Parameter style: formatter style, `nil` to use `standard` style\n\t/// - Returns: string representation of the date\n\tfunc toString(_ style: DateToStringStyles?) -> String\n\n\t/// Convert date to a string using custom date format.\n\t///\n\t/// - Parameters:\n\t/// \t- format: format of the string representation\n\t///\t\t- locale: locale to fix a custom locale, `nil` to use associated region's locale\n\t/// - Returns: string representation of the date\n\tfunc toFormat(_ format: String, locale: LocaleConvertible?) -> String\n\n\t/// Convert a date to a string representation relative to another reference date (or current\n\t/// if not passed).\n\tfunc toRelative(since: DateInRegion?,\n                    dateTimeStyle: RelativeDateTimeFormatter.DateTimeStyle,\n                    unitsStyle: RelativeDateTimeFormatter.UnitsStyle) -> String\n\n\t/// Return ISO8601 representation of the date\n\t///\n\t/// - Parameter options: optional options, if nil extended iso format is used\n\tfunc toISO(_ options: ISOFormatter.Options?) -> String\n\n\t/// Return DOTNET compatible representation of the date.\n\t///\n\t/// - Returns: string representation of the date\n\tfunc toDotNET() -> String\n\n\t/// Return SQL compatible representation of the date.\n\t///\n\t/// - Returns: string represenation of the date\n\tfunc toSQL() -> String\n\n\t/// Return RSS compatible representation of the date\n\t///\n\t/// - Parameter alt: `true` to return altRSS version, `false` to return the standard RSS representation\n\t/// - Returns: string representation of the date\n\tfunc toRSS(alt: Bool) -> String\n\n\t// MARK: - Extract Components\n\n\t/// Extract time components for elapsed interval between the receiver date\n\t/// and a reference date.\n\t///\n\t/// - Parameters:\n\t///   - units: units to extract.\n\t///   - refDate: reference date\n\t/// - Returns: extracted time units\n\tfunc toUnits(_ units: Set<Calendar.Component>, to refDate: DateRepresentable) -> [Calendar.Component: Int]\n\n\t/// Extract time unit component from given date.\n\t///\n\t/// - Parameters:\n\t///   - unit: time component to extract\n\t///   - refDate: reference date\n\t/// - Returns: extracted time unit value\n\tfunc toUnit(_ unit: Calendar.Component, to refDate: DateRepresentable) -> Int\n\n}\n\npublic extension DateRepresentable {\n\n\t// MARK: - Common Properties\n\n\tvar calendar: Calendar {\n\t\treturn region.calendar\n\t}\n\n\t// MARK: - Date Components Properties\n\n\tvar year: Int {\n\t\treturn dateComponents.year!\n\t}\n\n\tvar month: Int {\n\t\treturn dateComponents.month!\n\t}\n\n\tvar monthDays: Int {\n\t\treturn calendar.range(of: .day, in: .month, for: date)!.count\n\t}\n\n\tfunc monthName(_ style: SymbolFormatStyle) -> String {\n\t\tlet formatter = self.formatter(format: nil)\n\t\tlet idx = (month - 1)\n\t\tswitch style {\n\t\tcase .default:\t\t\t\treturn formatter.monthSymbols[idx]\n\t\tcase .defaultStandalone:\treturn formatter.standaloneMonthSymbols[idx]\n\t\tcase .short:\t\t\t\treturn formatter.shortMonthSymbols[idx]\n\t\tcase .standaloneShort:\t\treturn formatter.shortStandaloneMonthSymbols[idx]\n\t\tcase .veryShort:\t\t\treturn formatter.veryShortMonthSymbols[idx]\n\t\tcase .standaloneVeryShort:\treturn formatter.veryShortStandaloneMonthSymbols[idx]\n\t\t}\n\t}\n\n\tvar day: Int {\n\t\treturn dateComponents.day!\n\t}\n\n\tvar dayOfYear: Int {\n\t\treturn calendar.ordinality(of: .day, in: .year, for: date)!\n\t}\n\n\t@available(iOS 9.0, macOS 10.11, *)\n\tvar ordinalDay: String {\n\t\tlet day = self.day\n\t\treturn DateFormatter.sharedOrdinalNumberFormatter(locale: region.locale).string(from: day as NSNumber) ?? \"\\(day)\"\n\t}\n\n\tvar hour: Int {\n\t\treturn dateComponents.hour!\n\t}\n\n\tvar nearestHour: Int {\n\t\tlet newDate = (date + (date.minute >= 30 ? 60 - date.minute : -date.minute).minutes)\n\t\treturn newDate.in(region: region).hour\n\t}\n\n\tvar minute: Int {\n\t\treturn dateComponents.minute!\n\t}\n\n\tvar second: Int {\n\t\treturn dateComponents.second!\n\t}\n\n\tvar nanosecond: Int {\n\t\treturn dateComponents.nanosecond!\n\t}\n\n\tvar msInDay: Int {\n\t\treturn (calendar.ordinality(of: .second, in: .day, for: date)! * 1000)\n\t}\n\n\tvar weekday: Int {\n\t\treturn dateComponents.weekday!\n\t}\n\n\tfunc weekdayName(_ style: SymbolFormatStyle, locale: LocaleConvertible? = nil) -> String {\n\t\tlet formatter = self.formatter(format: nil) {\n\t\t\t$0.locale = (locale ?? self.region.locale).toLocale()\n\t\t}\n\t\tlet idx = (weekday - 1)\n\t\tswitch style {\n\t\tcase .default:\t\t\t\treturn formatter.weekdaySymbols[idx]\n\t\tcase .defaultStandalone:\treturn formatter.standaloneWeekdaySymbols[idx]\n\t\tcase .short:\t\t\t\treturn formatter.shortWeekdaySymbols[idx]\n\t\tcase .standaloneShort:\t\treturn formatter.shortStandaloneWeekdaySymbols[idx]\n\t\tcase .veryShort:\t\t\treturn formatter.veryShortWeekdaySymbols[idx]\n\t\tcase .standaloneVeryShort:\treturn formatter.veryShortStandaloneWeekdaySymbols[idx]\n\t\t}\n\t}\n\n\tvar weekOfYear: Int {\n\t\treturn dateComponents.weekOfYear!\n\t}\n\n\tvar weekOfMonth: Int {\n\t\treturn dateComponents.weekOfMonth!\n\t}\n\n\tvar weekdayOrdinal: Int {\n\t\treturn dateComponents.weekdayOrdinal!\n\t}\n\n\tvar yearForWeekOfYear: Int {\n\t\treturn dateComponents.yearForWeekOfYear!\n\t}\n\n\tvar firstDayOfWeek: Int {\n\t\treturn date.dateAt(.startOfWeek).day\n\t}\n\n\tvar lastDayOfWeek: Int {\n\t\treturn date.dateAt(.endOfWeek).day\n\t}\n\n\tvar quarter: Int {\n\t\tlet monthsInQuarter = Double(Calendar.current.monthSymbols.count) / 4.0\n\t\treturn Int(ceil( Double(month) / monthsInQuarter))\n\t}\n\n\tvar isToday: Bool {\n\t\treturn calendar.isDateInToday(date)\n\t}\n\n\tvar isYesterday: Bool {\n\t\treturn calendar.isDateInYesterday(date)\n\t}\n\n\tvar isTomorrow: Bool {\n\t\treturn calendar.isDateInTomorrow(date)\n\t}\n\n\tvar isInWeekend: Bool {\n\t\treturn calendar.isDateInWeekend(date)\n\t}\n\n\tvar isInPast: Bool {\n\t\treturn date < Date()\n\t}\n\n\tvar isInFuture: Bool {\n\t\treturn date > Date()\n\t}\n\n\tfunc quarterName(_ style: SymbolFormatStyle, locale: LocaleConvertible? = nil) -> String {\n\t\tlet formatter = self.formatter(format: nil) {\n\t\t\t$0.locale = (locale ?? self.region.locale).toLocale()\n\t\t}\n\t\tlet idx = (quarter - 1)\n\t\tswitch style {\n\t\tcase .default:\t\t\t\t\t\t\t\t\treturn formatter.quarterSymbols[idx]\n\t\tcase .defaultStandalone:\t\t\t\t\t\treturn formatter.standaloneQuarterSymbols[idx]\n\t\tcase .short, .veryShort:\t\t\t\t\t\treturn formatter.shortQuarterSymbols[idx]\n\t\tcase .standaloneShort, .standaloneVeryShort:\treturn formatter.shortStandaloneQuarterSymbols[idx]\n\t\t}\n\t}\n\n\tvar era: Int {\n\t\treturn dateComponents.era!\n\t}\n\n\tfunc eraName(_ style: SymbolFormatStyle, locale: LocaleConvertible? = nil) -> String {\n\t\tlet formatter = self.formatter(format: nil) {\n\t\t\t$0.locale = (locale ?? self.region.locale).toLocale()\n\t\t}\n\t\tlet idx = (era - 1)\n\t\tswitch style {\n\t\tcase .default, .defaultStandalone:\t\t\t\t\t\t\t\treturn formatter.longEraSymbols[idx]\n\t\tcase .short, .standaloneShort, .veryShort, .standaloneVeryShort:\treturn formatter.eraSymbols[idx]\n\t\t}\n\t}\n\n\tvar DSTOffset: TimeInterval {\n\t\treturn region.timeZone.daylightSavingTimeOffset(for: date)\n\t}\n\n\t// MARK: - Date Formatters\n\n\tfunc formatter(format: String? = nil, configuration: ((DateFormatter) -> Void)? = nil) -> DateFormatter {\n\t\tlet formatter = (customFormatter ?? sharedFormatter)\n\t\tif let dFormat = format {\n\t\t\tformatter.dateFormat = dFormat\n\t\t}\n\t\tconfiguration?(formatter)\n\t\treturn formatter\n\t}\n\n\tfunc formatterForRegion(format: String? = nil, configuration: ((inout DateFormatter) -> Void)? = nil) -> DateFormatter {\n\t\tvar formatter = self.formatter(format: format, configuration: {\n            $0.timeZone = self.region.timeZone\n\t\t\t$0.calendar = self.calendar\n\t\t\t$0.locale = self.region.locale\n\t\t})\n\t\tconfiguration?(&formatter)\n\t\treturn formatter\n\t}\n\n\tvar sharedFormatter: DateFormatter {\n\t\treturn DateFormatter.sharedFormatter(forRegion: region)\n\t}\n\n\tfunc toString(_ style: DateToStringStyles? = nil) -> String {\n\t\tguard let style = style else {\n\t\t\treturn DateToStringStyles.standard.toString(self)\n\t\t}\n\t\treturn style.toString(self)\n\t}\n\n\tfunc toFormat(_ format: String, locale: LocaleConvertible? = nil) -> String {\n\t\tguard let fixedLocale = locale else {\n\t\t\treturn DateToStringStyles.custom(format).toString(self)\n\t\t}\n\t\tlet fixedRegion = Region(calendar: region.calendar, zone: region.timeZone, locale: fixedLocale)\n\t\tlet fixedDate = DateInRegion(date.date, region: fixedRegion)\n\t\treturn DateToStringStyles.custom(format).toString(fixedDate)\n\t}\n\n    func toRelative(since: DateInRegion?,\n                    dateTimeStyle: RelativeDateTimeFormatter.DateTimeStyle = .named,\n                    unitsStyle: RelativeDateTimeFormatter.UnitsStyle = .short) -> String {\n        let formatter = RelativeDateTimeFormatter()\n        formatter.dateTimeStyle = dateTimeStyle\n        formatter.unitsStyle = unitsStyle\n        return formatter.localizedString(for: self.date, relativeTo: since?.date ?? Date())\n    }\n\n\tfunc toISO(_ options: ISOFormatter.Options? = nil) -> String {\n\t\treturn DateToStringStyles.iso( (options ?? ISOFormatter.Options([.withInternetDateTime])) ).toString(self)\n\t}\n\n\tfunc toDotNET() -> String {\n\t\treturn DOTNETFormatter.format(self, options: nil)\n\t}\n\n\tfunc toRSS(alt: Bool) -> String {\n\t\tswitch alt {\n\t\tcase true: \t\treturn DateToStringStyles.altRSS.toString(self)\n\t\tcase false: \treturn DateToStringStyles.rss.toString(self)\n\t\t}\n\t}\n\n\tfunc toSQL() -> String {\n\t\treturn DateToStringStyles.sql.toString(self)\n\t}\n\n\t// MARK: - Conversion\n\n\tfunc convertTo(region: Region) -> DateInRegion {\n\t\treturn DateInRegion(date, region: region)\n\t}\n\n\t// MARK: - Extract Time Components\n\n\tfunc toUnits(_ units: Set<Calendar.Component>, to refDate: DateRepresentable) -> [Calendar.Component: Int] {\n\t\tlet cal = region.calendar\n\t\tlet components = cal.dateComponents(units, from: date, to: refDate.date)\n\t\treturn components.toDict()\n\t}\n\n\tfunc toUnit(_ unit: Calendar.Component, to refDate: DateRepresentable) -> Int {\n\t\tlet cal = region.calendar\n\t\tlet components = cal.dateComponents([unit], from: date, to: refDate.date)\n\t\treturn components.value(for: unit)!\n\t}\n\n}\n"
  },
  {
    "path": "Sources/SwiftDate/Formatters/DotNetParserFormatter.swift",
    "content": "//\n//  SwiftDate\n//  Parse, validate, manipulate, and display dates, time and timezones in Swift\n//\n//  Created by Daniele Margutti\n//   - Web: https://www.danielemargutti.com\n//   - Twitter: https://twitter.com/danielemargutti\n//   - Mail: hello@danielemargutti.com\n//\n//  Copyright © 2019 Daniele Margutti. Licensed under MIT License.\n//\n\nimport Foundation\n\npublic class DOTNETParser: StringToDateTransformable {\n\n\tinternal static let pattern = \"\\\\/Date\\\\((-?\\\\d+)((?:[\\\\+\\\\-]\\\\d+)?)\\\\)\\\\/\"\n\n\tpublic static func parse(_ string: String) -> (seconds: TimeInterval, tz: TimeZone)? {\n\t\tdo {\n\t\t\tlet parser = try NSRegularExpression(pattern: DOTNETParser.pattern, options: .caseInsensitive)\n\t\t\tguard let match = parser.firstMatch(in: string, options: .reportCompletion, range: NSRange(location: 0, length: string.count)) else {\n\t\t\t\treturn nil\n\t\t\t}\n\n\t\t\tguard let milliseconds = TimeInterval((string as NSString).substring(with: match.range(at: 1))) else { return nil }\n\n\t\t\t// Parse timezone\n\t\t\tlet raw_tz = ((string as NSString).substring(with: match.range(at: 2)) as NSString)\n\t\t\tguard raw_tz.length > 1 else {\n\t\t\t\treturn nil\n\t\t\t}\n\t\t\tlet tz_sign: String = raw_tz.substring(to: 1)\n\t\t\tif tz_sign != \"+\" && tz_sign != \"-\" {\n\t\t\t\treturn nil\n\t\t\t}\n\n\t\t\tlet tz_hours: String = raw_tz.substring(with: NSRange(location: 1, length: 2))\n\t\t\tlet tz_minutes: String = raw_tz.substring(with: NSRange(location: 3, length: 2))\n\n\t\t\tlet tz_offset = (Int(tz_hours)! * 60 * 60) + ( Int(tz_minutes)! * 60 )\n\t\t\tguard let tz_obj = TimeZone(secondsFromGMT: tz_offset) else {\n\t\t\t\treturn nil\n\t\t\t}\n\t\t\treturn ( (milliseconds / 1000), tz_obj )\n\t\t} catch {\n\t\t\treturn nil\n\t\t}\n\t}\n\n\tpublic static func parse(_ string: String, region: Region?, options: Any?) -> DateInRegion? {\n\t\tguard let result = DOTNETParser.parse(string) else { return nil }\n        let regionSet = region ?? Region.ISO\n\t\tlet adaptedRegion = Region(calendar: regionSet.calendar, zone: regionSet.timeZone, locale: regionSet.locale)\n\t\treturn DateInRegion(seconds: result.seconds, region: adaptedRegion)\n\t}\n\n}\n\npublic class DOTNETFormatter: DateToStringTrasformable {\n\n\tpublic static func format(_ date: DateRepresentable, options: Any?) -> String {\n\t\tlet milliseconds = (date.date.timeIntervalSince1970 * 1000.0)\n\t\tlet tzOffsets = (date.region.timeZone.secondsFromGMT(for: date.date) / 3600)\n\t\tlet formattedStr = String(format: \"/Date(%.0f%+03d00)/\", milliseconds, tzOffsets)\n\t\treturn formattedStr\n\t}\n\n}\n"
  },
  {
    "path": "Sources/SwiftDate/Formatters/Formatter+Protocols.swift",
    "content": "//\n//  SwiftDate\n//  Parse, validate, manipulate, and display dates, time and timezones in Swift\n//\n//  Created by Daniele Margutti\n//   - Web: https://www.danielemargutti.com\n//   - Twitter: https://twitter.com/danielemargutti\n//   - Mail: hello@danielemargutti.com\n//\n//  Copyright © 2019 Daniele Margutti. Licensed under MIT License.\n//\n\nimport Foundation\n\npublic protocol DateToStringTrasformable {\n\tstatic func format(_ date: DateRepresentable, options: Any?) -> String\n}\n\npublic protocol StringToDateTransformable {\n\tstatic func parse(_ string: String, region: Region?, options: Any?) -> DateInRegion?\n}\n\n// MARK: - Formatters\n\n/// Format to represent a date to string\n///\n/// - iso: standard iso format. The ISO8601 formatted date, time and millisec \"yyyy-MM-dd'T'HH:mm:ssZZZZZ\"\n/// - extended: Extended format. \"eee dd-MMM-yyyy GG HH:mm:ss.SSS zzz\"\n/// - rss: The RSS formatted date \"EEE, d MMM yyyy HH:mm:ss ZZZ\" i.e. \"Fri, 09 Sep 2011 15:26:08 +0200\"\n/// - altRSS: The Alternative RSS formatted date \"d MMM yyyy HH:mm:ss ZZZ\" i.e. \"09 Sep 2011 15:26:08 +0200\"\n/// - dotNet: The dotNet formatted date \"/Date(%d%d)/\" i.e. \"/Date(1268123281843)/\"\n/// - httpHeader: The http header formatted date \"EEE, dd MMM yyyy HH:mm:ss zzz\" i.e. \"Tue, 15 Nov 1994 12:45:26 GMT\"\n/// - custom: custom string format\n/// - standard: A generic standard format date i.e. \"EEE MMM dd HH:mm:ss Z yyyy\"\n/// - date: Date only format (short = \"2/27/17\", medium = \"Feb 27, 2017\", long = \"February 27, 2017\", full = \"Monday, February 27, 2017\"\n/// - time: Time only format (short = \"2:22 PM\", medium = \"2:22:06 PM\", long = \"2:22:06 PM EST\", full = \"2:22:06 PM Eastern Standard Time\"\n/// - dateTime: Date/Time format (short = \"2/27/17, 2:22 PM\", medium = \"Feb 27, 2017, 2:22:06 PM\", long = \"February 27, 2017 at 2:22:06 PM EST\", full = \"Monday, February 27, 2017 at 2:22:06 PM Eastern Standard Time\"\npublic enum DateToStringStyles {\n\tcase iso(_: ISOFormatter.Options)\n\tcase extended\n\tcase rss\n\tcase altRSS\n\tcase dotNet\n\tcase httpHeader\n\tcase sql\n\tcase date(_: DateFormatter.Style)\n\tcase time(_: DateFormatter.Style)\n\tcase dateTime(_: DateFormatter.Style)\n    case dateTimeMixed(dateStyle: DateFormatter.Style, timeStyle: DateFormatter.Style)\n\tcase custom(_: String)\n\tcase standard\n    case relative(style: RelativeDateTimeFormatter.DateTimeStyle = .named, unitsStyle: RelativeDateTimeFormatter.UnitsStyle = .short)\n\n\tpublic func toString(_ date: DateRepresentable) -> String {\n\t\tswitch self {\n\t\tcase .iso(let opts):\t\t\treturn ISOFormatter.format(date, options: opts)\n\t\tcase .extended:\t\t\t\t\treturn date.formatterForRegion(format: DateFormats.extended).string(from: date.date)\n\t\tcase .rss:\t\t\t\t\t\treturn date.formatterForRegion(format: DateFormats.rss).string(from: date.date)\n\t\tcase .altRSS:\t\t\t\t\treturn date.formatterForRegion(format: DateFormats.altRSS).string(from: date.date)\n\t\tcase .sql:\t\t\t\t\t\treturn date.formatterForRegion(format: DateFormats.sql).string(from: date.date)\n\t\tcase .dotNet:\t\t\t\t\treturn DOTNETFormatter.format(date, options: nil)\n\t\tcase .httpHeader:\t\t\t\treturn date.formatterForRegion(format: DateFormats.httpHeader).string(from: date.date)\n\t\tcase .custom(let format):\t\treturn date.formatterForRegion(format: format).string(from: date.date)\n\t\tcase .standard:\t\t\t\t\treturn date.formatterForRegion(format: DateFormats.standard).string(from: date.date)\n\t\tcase .date(let style):\n\t\t\treturn date.formatterForRegion(format: nil, configuration: {\n\t\t\t\t$0.dateStyle = style\n\t\t\t\t$0.timeStyle = .none\n\t\t\t}).string(from: date.date)\n\t\tcase .time(let style):\n\t\t\treturn date.formatterForRegion(format: nil, configuration: {\n\t\t\t\t$0.dateStyle = .none\n\t\t\t\t$0.timeStyle = style\n\t\t\t}).string(from: date.date)\n\t\tcase .dateTime(let style):\n\t\t\treturn date.formatterForRegion(format: nil, configuration: {\n\t\t\t\t$0.dateStyle = style\n\t\t\t\t$0.timeStyle = style\n\t\t\t}).string(from: date.date)\n        case .dateTimeMixed(let dateStyle, let timeStyle):\n            return date.formatterForRegion(format: nil, configuration: {\n                $0.dateStyle = dateStyle\n                $0.timeStyle = timeStyle\n            }).string(from: date.date)\n\t\tcase .relative(let style, let unitStyle):\n            return date.toRelative(since: DateInRegion(),  dateTimeStyle: style, unitsStyle: unitStyle)\n\t\t}\n\t}\n\n}\n\n// MARK: - Parsers\n\n/// String to date transform\n///\n/// - iso: standard automatic iso parser (evaluate the date components automatically)\n/// - extended: Extended format. \"eee dd-MMM-yyyy GG HH:mm:ss.SSS zzz\"\n/// - rss: The RSS formatted date \"EEE, d MMM yyyy HH:mm:ss ZZZ\" i.e. \"Fri, 09 Sep 2011 15:26:08 +0200\"\n/// - altRSS: The Alternative RSS formatted date \"d MMM yyyy HH:mm:ss ZZZ\" i.e. \"09 Sep 2011 15:26:08 +0200\"\n/// - dotNet: The dotNet formatted date \"/Date(%d%d)/\" i.e. \"/Date(1268123281843)/\"\n/// - httpHeader: The http header formatted date \"EEE, dd MMM yyyy HH:mm:ss zzz\" i.e. \"Tue, 15 Nov 1994 12:45:26 GMT\"\n/// - strict: custom string format with lenient options active\n/// - custom: custom string format\n/// - standard: A generic standard format date i.e. \"EEE MMM dd HH:mm:ss Z yyyy\"\npublic enum StringToDateStyles {\n\tcase iso(_: ISOParser.Options)\n\tcase extended\n\tcase rss\n\tcase altRSS\n\tcase dotNet\n\tcase sql\n\tcase httpHeader\n\tcase strict(_: String)\n\tcase custom(_: String)\n\tcase standard\n\n\tpublic func toDate(_ string: String, region: Region) -> DateInRegion? {\n\t\tswitch self {\n\t\tcase .iso(let options):\t\t\t\treturn ISOParser.parse(string, region: region, options: options)\n\t\tcase .custom(let format):\t\t\treturn DateInRegion(string, format: format, region: region)\n\t\tcase .extended:\t\t\t\t\t\treturn DateInRegion(string, format: DateFormats.extended, region: region)\n\t\tcase .sql:\t\t\t\t\t\t\treturn DateInRegion(string, format: DateFormats.sql, region: region)\n\t\tcase .rss:\t\t\t\t\t\t\treturn DateInRegion(string, format: DateFormats.rss, region: Region.ISO)?.convertTo(locale: region.locale)\n\t\tcase .altRSS:\t\t\t\t\t\treturn DateInRegion(string, format: DateFormats.altRSS, region: Region.ISO)?.convertTo(locale: region.locale)\n\t\tcase .dotNet:\t\t\t\t\t\treturn DOTNETParser.parse(string, region: region, options: nil)\n\t\tcase .httpHeader:\t\t\t\t\treturn DateInRegion(string, format: DateFormats.httpHeader, region: region)\n\t\tcase .standard:\t\t\t\t\t\treturn DateInRegion(string, format: DateFormats.standard, region: region)\n\t\tcase .strict(let format):\n\t\t\tlet formatter = DateFormatter.sharedFormatter(forRegion: region, format: format)\n\t\t\tformatter.isLenient = false\n\t\t\tguard let absDate = formatter.date(from: string) else { return nil }\n\t\t\treturn DateInRegion(absDate, region: region)\n\t\t}\n\t}\n}\n"
  },
  {
    "path": "Sources/SwiftDate/Formatters/ISOFormatter.swift",
    "content": "//\n//  SwiftDate\n//  Parse, validate, manipulate, and display dates, time and timezones in Swift\n//\n//  Created by Daniele Margutti\n//   - Web: https://www.danielemargutti.com\n//   - Twitter: https://twitter.com/danielemargutti\n//   - Mail: hello@danielemargutti.com\n//\n//  Copyright © 2019 Daniele Margutti. Licensed under MIT License.\n//\n\nimport Foundation\n\npublic class ISOFormatter: DateToStringTrasformable {\n\n\tpublic struct Options: OptionSet {\n\t\tpublic let rawValue: Int\n\n\t\tpublic init(rawValue: Int) {\n\t\t\tself.rawValue = rawValue\n\t\t}\n\n\t\t/// The date representation includes the year. The format for year is inferred based on the other specified options.\n\t\t/// - If withWeekOfYear is specified, YYYY is used.\n\t\t/// - Otherwise, yyyy is used.\n\t\tpublic static let withYear = ISOFormatter.Options(rawValue: 1 << 0)\n\n\t\t/// The date representation includes the month. The format for month is MM.\n\t\tpublic static let withMonth = ISOFormatter.Options(rawValue: 1 << 1)\n\n\t\t/// The date representation includes the week of the year.\n\t\t/// The format for week of year is ww, including the W prefix.\n\t\tpublic static let withWeekOfYear = ISOFormatter.Options(rawValue: 1 << 2)\n\n\t\t/// The date representation includes the day. The format for day is inferred based on provided options:\n\t\t/// - If withMonth is specified, dd is used.\n\t\t/// - If withWeekOfYear is specified, ee is used.\n\t\t/// - Otherwise, DDD is used.\n\t\tpublic static let withDay = ISOFormatter.Options(rawValue: 1 << 3)\n\n\t\t/// The date representation includes the time. The format for time is HH:mm:ss.\n\t\tpublic static let withTime = ISOFormatter.Options(rawValue: 1 << 4)\n\n\t\t/// The date representation includes the timezone. The format for timezone is ZZZZZ.\n\t\tpublic static let withTimeZone = ISOFormatter.Options(rawValue: 1 << 5)\n\n\t\t/// The date representation uses a space ( ) instead of T between the date and time.\n\t\tpublic static let withSpaceBetweenDateAndTime = ISOFormatter.Options(rawValue: 1 << 6)\n\n\t\t/// The date representation uses the dash separator (-) in the date.\n\t\tpublic static let withDashSeparatorInDate = ISOFormatter.Options(rawValue: 1 << 7)\n\n\t\t/// The date representation uses the colon separator (:) in the time.\n\t\tpublic static let withFullDate = ISOFormatter.Options(rawValue: 1 << 8)\n\n\t\t/// The date representation includes the hour, minute, and second.\n\t\tpublic static let withFullTime = ISOFormatter.Options(rawValue: 1 << 9)\n\n\t\t/// The format used for internet date times, according to the RFC 3339 standard.\n\t\t/// Equivalent to specifying withFullDate, withFullTime, withDashSeparatorInDate,\n\t\t/// withColonSeparatorInTime, and withColonSeparatorInTimeZone.\n\t\tpublic static let withInternetDateTime = ISOFormatter.Options(rawValue: 1 << 10)\n\n\t\t// The format used for internet date times; it's similar to .withInternetDateTime\n\t\t// but include milliseconds ('yyyy-MM-dd'T'HH:mm:ss.SSSZZZZZ').\n\t\tpublic static let withInternetDateTimeExtended = ISOFormatter.Options(rawValue: 1 << 11)\n\n\t\t/// Print the timezone in format `ZZZ` instead of `ZZZZZ`\n\t\t/// An example outout maybe be `+0200` instead of `+02:00`.\n\t\tpublic static let withoutTZSeparators = ISOFormatter.Options(rawValue: 1 << 12)\n\n\t\t/// Evaluate formatting string\n\t\tpublic var dateFormat: String {\n\t\t\tif contains(.withInternetDateTimeExtended) || contains(.withoutTZSeparators) {\n\t\t\t\tif contains(.withoutTZSeparators) {\n\t\t\t\t\treturn \"yyyy-MM-dd'T'HH:mm:ss.SSSZZZ\"\n\t\t\t\t}\n\t\t\t\treturn \"yyyy-MM-dd'T'HH:mm:ss.SSSZZZZZ\"\n\t\t\t}\n\n\t\t\tif contains(.withInternetDateTime) {\n\t\t\t\tif contains(.withoutTZSeparators) {\n\t\t\t\t\treturn \"yyyy-MM-dd'T'HH:mm:ss.SSSZZZ\"\n\t\t\t\t}\n\t\t\t\treturn \"yyyy-MM-dd'T'HH:mm:ssZZZZZ\"\n\t\t\t}\n\n\t\t\tvar format: String = \"\"\n\t\t\tif contains(.withFullDate) {\n\t\t\t\tformat += \"yyyy-MM-dd\"\n\t\t\t} else {\n\t\t\t\tif contains(.withYear) {\n\t\t\t\t\tif contains(.withWeekOfYear) {\n\t\t\t\t\t\tformat += \"YYYY\"\n\t\t\t\t\t} else if contains(.withMonth) || contains(.withDay) {\n\t\t\t\t\t\tformat += \"yyyy\"\n\t\t\t\t\t} else {\n\t\t\t\t\t\t// not valid\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif contains(.withMonth) {\n\t\t\t\t\tif contains(.withYear) || contains(.withDay) || contains(.withWeekOfYear) {\n\t\t\t\t\t\tformat += \"MM\"\n\t\t\t\t\t} else {\n\t\t\t\t\t\t// not valid\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif contains(.withWeekOfYear) {\n\t\t\t\t\tif contains(.withDay) {\n\t\t\t\t\t\tformat += \"'W'ww\"\n\t\t\t\t\t} else {\n\t\t\t\t\t\tif contains(.withYear) || contains(.withMonth) {\n\t\t\t\t\t\t\tif contains(.withDashSeparatorInDate) {\n\t\t\t\t\t\t\t\tformat += \"-'W'ww\"\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tformat += \"'W'ww\"\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t// not valid\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif contains(.withDay) {\n\t\t\t\t\tif contains(.withWeekOfYear) {\n\t\t\t\t\t\tformat += \"FF\"\n\t\t\t\t\t} else if contains(.withMonth) {\n\t\t\t\t\t\tformat += \"dd\"\n\t\t\t\t\t} else if contains(.withYear) {\n\t\t\t\t\t\tif contains(.withDashSeparatorInDate) {\n\t\t\t\t\t\t\tformat += \"-DDD\"\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tformat += \"DDD\"\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\t// not valid\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tlet hasDate = (contains(.withFullDate) || contains(.withMonth) || contains(.withDay) || contains(.withWeekOfYear) || contains(.withYear))\n\t\t\tif hasDate && (contains(.withFullTime) || contains(.withTimeZone) || contains(.withTime)) {\n\t\t\t\tif contains(.withSpaceBetweenDateAndTime) {\n\t\t\t\t\tformat += \" \"\n\t\t\t\t} else {\n\t\t\t\t\tformat += \"'T'\"\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif contains(.withFullTime) {\n\t\t\t\tformat += \"HH:mm:ssZZZZZ\"\n\t\t\t} else {\n\t\t\t\tif contains(.withTime) {\n\t\t\t\t\tformat += \"HH:mm:ss\"\n\t\t\t\t}\n\t\t\t\tif contains(.withTimeZone) {\n\t\t\t\t\tif contains(.withoutTZSeparators) {\n\t\t\t\t\t\treturn \"yyyy-MM-dd'T'HH:mm:ss.SSSZZZ\"\n\t\t\t\t\t}\n\t\t\t\t\tformat += \"ZZZZZ\"\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn format\n\t\t}\n\t}\n\n\tpublic static func format(_ date: DateRepresentable, options: Any?) -> String {\n\t\tlet formatOptions = ((options as? ISOFormatter.Options) ?? ISOFormatter.Options([.withInternetDateTime]))\n\t\tlet formatter = date.formatter(format: formatOptions.dateFormat) {\n\t\t\t$0.locale = Locales.englishUnitedStatesComputer.toLocale() // fix for 12/24h\n\t\t\t$0.timeZone = date.region.timeZone\n\t\t\t$0.calendar = Calendars.gregorian.toCalendar()\n\t\t}\n\t\treturn formatter.string(from: date.date)\n\t}\n\n}\n"
  },
  {
    "path": "Sources/SwiftDate/Formatters/ISOParser.swift",
    "content": "//\n//  SwiftDate\n//  Parse, validate, manipulate, and display dates, time and timezones in Swift\n//\n//  Created by Daniele Margutti\n//   - Web: https://www.danielemargutti.com\n//   - Twitter: https://twitter.com/danielemargutti\n//   - Mail: hello@danielemargutti.com\n//\n//  Copyright © 2019 Daniele Margutti. Licensed under MIT License.\n//\n\n// swiftlint:disable file_length\n\nimport Foundation\n\n/// This defines all possible errors you can encounter parsing ISO8601 string\n///\n/// - eof: end of file\n/// - notDigit: expected digit, value cannot be parsed as int\n/// - notDouble: expected double digit, value cannot be parsed as double\n/// - invalid: invalid state reached. Something in the format is not correct\npublic enum ISO8601ParserError: Error {\n\tcase eof\n\tcase notDigit\n\tcase notDouble\n\tcase invalid\n}\n\nfileprivate extension Int {\n\n\t/// Return `true` if current year is a leap year, `false` otherwise\n\tvar isLeapYear: Bool {\n\t\treturn ((self % 4) == 0) && (((self % 100) != 0) || ((self % 400) == 0))\n\t}\n\n}\n\n// MARK: - Internal Extension for UnicodeScalar type\n\ninternal extension UnicodeScalar {\n\n\t/// return `true` if current character is a digit (arabic), `false` otherwise\n\tvar isDigit: Bool {\n\t\treturn \"0\"...\"9\" ~= self\n\t}\n\n\t/// return `true` if current character is a space\n\tvar isSpace: Bool {\n\t\treturn CharacterSet.whitespaces.contains(self)\n\t}\n\n}\n\n/// This is the ISO8601 Parser class: it evaluates automatically the format of the ISO8601 date\n/// and attempt to parse it in a valid `Date` object.\n/// Resulting date also includes Time Zone settings and a property which allows you to inspect\n/// single date components.\n///\n/// This work is inspired to the original ISO8601DateFormatter class written in ObjC by\n/// Peter Hosey (available here https://bitbucket.org/boredzo/iso-8601-parser-unparser).\n/// I've made a Swift porting and fixed some issues when parsing several ISO8601 date variants.\n\n// swiftlint:disable type_body_length\npublic class ISOParser: StringToDateTransformable {\n\n\t/// Internal structure\n\tinternal enum Weekday: Int {\n\t\tcase monday = 0\n\t\tcase tuesday = 1\n\t\tcase wednesday = 2\n\t\tcase thursday = 3\n\t}\n\n\tpublic struct Options {\n\n\t\t/// Time separator character. By default is `:`.\n\t\tvar time_separator: ISOParser.ISOChar = \":\"\n\n\t\t/// Strict parsing. By default is `false`.\n\t\tvar strict: Bool = false\n\n\t\tpublic init(strict: Bool = false) {\n\t\t\tself.strict = strict\n\t\t}\n\t}\n\n\t/// Some typealias to make the code cleaner\n\tpublic typealias ISOString = String.UnicodeScalarView\n\tpublic typealias ISOIndex = String.UnicodeScalarView.Index\n\tpublic typealias ISOChar = UnicodeScalar\n\tpublic typealias ISOParsedDate\t= (date: Date?, timezone: TimeZone?)\n\n\t/// This represent the internal parser status representation\n\tpublic struct ParsedDate {\n\n\t\t/// Type of date parsed\n\t\t///\n\t\t/// - monthAndDate: month and date style\n\t\t/// - week: date with week number\n\t\t/// - dateOnly: date only\n\t\t// swiftlint:disable nesting\n\t\tpublic enum DateStyle {\n\t\t\tcase monthAndDate\n\t\t\tcase week\n\t\t\tcase dateOnly\n\t\t}\n\n\t\t/// Parsed year value\n\t\tvar year: Int = 0\n\n\t\t/// Parsed month or week number\n\t\tvar month_or_week:\tInt = 0\n\n\t\t/// Parsed day value\n\t\tvar day: Int = 0\n\n\t\t/// Parsed hour value\n\t\tvar hour: Int = 0\n\n\t\t/// Parsed minutes value\n\t\tvar minute: TimeInterval = 0.0\n\n\t\t/// Parsed seconds value\n\t\tvar seconds: TimeInterval = 0.0\n\n\t\t/// Parsed nanoseconds value\n\t\tvar nanoseconds:\tTimeInterval = 0.0\n\n\t\t/// Parsed weekday number (1=monday, 7=sunday)\n\t\t/// If `nil` source string has not specs about weekday.\n\t\tvar weekday: Int?\n\n\t\t/// Timezone parsed hour value\n\t\tvar tz_hour: Int = 0\n\n\t\t/// Timezone parsed minute value\n\t\tvar tz_minute: Int = 0\n\n\t\t/// Type of parsed date\n\t\tvar type: DateStyle = .monthAndDate\n\n\t\t/// Parsed timezone object\n\t\tvar timezone: TimeZone?\n\t}\n\n\t/// Source generation calendar.\n\tprivate var srcCalendar = Calendars.gregorian.toCalendar()\n\n\t/// Source raw parsed values\n\tprivate var date = ParsedDate()\n\n\t/// Source string represented as unicode scalars\n\tprivate var string: ISOString\n\n\t/// Current position of the parser in source string.\n\t/// Initially is equal to `string.startIndex`\n\tprivate var cIdx: ISOIndex\n\n\t/// Just a shortcut to the last index in source string\n\tprivate var eIdx: ISOIndex\n\n\t/// Lenght of the string\n\tprivate var length: Int\n\n\t/// Number of hyphens characters found before any value\n\t/// Consequential \"-\" are used to define implicit values in dates.\n\tprivate var hyphens:\tInt = 0\n\n\t/// Private date components used for default values\n\tprivate var now_cmps:\tDateComponents\n\n\t/// Configuration used for parser\n\tprivate var options: ISOParser.Options\n\n\t/// Date components parsed\n\tprivate(set) var date_components: DateComponents?\n\n\t/// Parsed date\n\tprivate(set) var parsedDate: Date?\n\n\t/// Parsed timezone\n\tprivate(set) var parsedTimeZone: TimeZone?\n\n\t/// Date adjusted at parsed timezone\n\tprivate var dateInTimezone: Date? {\n\t\tget {\n\t\t\tsrcCalendar.timeZone = date.timezone ?? TimeZone(identifier: \"UTC\")!\n\t\t\treturn srcCalendar.date(from: date_components!)\n\t\t}\n\t}\n\n\t/// Initialize a new parser with a source ISO8601 string to parse\n\t/// Parsing is done during initialization; any exception is reported\n\t/// before allocating.\n\t///\n\t/// - Parameters:\n\t///   - src: source ISO8601 string\n\t///   - config: configuration used for parsing\n\t/// - Throws: throw an `ISO8601Error` if parsing operation fails\n\n\tpublic init?(_ src: String, options: ISOParser.Options? = nil) {\n\t\tlet src_trimmed = src.trimmingCharacters(in: CharacterSet.whitespacesAndNewlines)\n\t\tguard src_trimmed.count > 0 else {\n\t\t\treturn nil\n\t\t}\n\t\tstring = src_trimmed.unicodeScalars\n\t\tlength = src_trimmed.count\n\t\tcIdx = string.startIndex\n\t\teIdx = string.endIndex\n\t\tself.options = (options ?? ISOParser.Options())\n\t\tself.now_cmps = srcCalendar.dateComponents([.year, .month, .day], from: Date())\n\n\t\tvar idx = cIdx\n\t\twhile idx < eIdx {\n\t\t\tif string[idx] == \"-\" { hyphens += 1 } else { break }\n\t\t\tidx = string.index(after: idx)\n\t\t}\n\n\t\tdo {\n\t\t\ttry parse()\n\t\t} catch {\n\t\t\treturn nil\n\t\t}\n\t}\n\n\t// MARK: - Internal Parser\n\n\t/// Private parsing function\n\t///\n\t/// - Throws: throw an `ISO8601Error` if parsing operation fails\n\t@discardableResult\n\tprivate func parse() throws -> ISOParsedDate {\n\n\t\t// PARSE DATE\n\n\t\tif current() == \"T\" {\n\t\t\t// There is no date here, only a time.\n\t\t\t// Set the date to now; then we'll parse the time.\n\t\t\tnext()\n\t\t\tguard current()?.isDigit ?? false else {\n\t\t\t\tthrow ISO8601ParserError.invalid\n\t\t\t}\n\n\t\t\tdate.year = now_cmps.year!\n\t\t\tdate.month_or_week = now_cmps.month!\n\t\t\tdate.day = now_cmps.day!\n\t\t} else {\n\t\t\tmoveUntil(is: \"-\")\n\t\t\tlet is_time_only = (string.contains(\"T\") == false && string.contains(\":\") && !string.contains(\"-\"))\n\n\t\t\tif is_time_only == false {\n\t\t\t\tvar (num_digits, segment) = try read_int()\n\t\t\t\tswitch num_digits {\n\t\t\t\tcase 0:\t\ttry parse_digits_0(num_digits, &segment)\n\t\t\t\tcase 8:\t\ttry parse_digits_8(num_digits, &segment)\n\t\t\t\tcase 6:\t\ttry parse_digits_6(num_digits, &segment)\n\t\t\t\tcase 4:\t\ttry parse_digits_4(num_digits, &segment)\n\t\t\t\tcase 5:\t\ttry parse_digits_5(num_digits, &segment)\n\t\t\t\tcase 1:\t\ttry parse_digits_1(num_digits, &segment)\n\t\t\t\tcase 2:\t\ttry parse_digits_2(num_digits, &segment)\n\t\t\t\tcase 7:\t\ttry parse_digits_7(num_digits, &segment) //YYYY DDD (ordinal date)\n\t\t\t\tcase 3:\t\ttry parse_digits_3(num_digits, &segment) //--DDD (ordinal date, implicit year)\n\t\t\t\tdefault:\tthrow ISO8601ParserError.invalid\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tdate.year = now_cmps.year!\n\t\t\t\tdate.month_or_week = now_cmps.month!\n\t\t\t\tdate.day = now_cmps.day!\n\t\t\t}\n\t\t}\n\n\t\tvar hasTime = false\n\t\tif current()?.isSpace ?? false || current() == \"T\" {\n\t\t\thasTime = true\n\t\t\tnext()\n\t\t}\n\n\t\t// PARSE TIME\n\n\t\tif current()?.isDigit ?? false == true {\n\t\t\tlet time_sep = options.time_separator\n\t\t\tlet hasTimeSeparator = string.contains(time_sep)\n\n\t\t\tdate.hour = try read_int(2).value\n\n\t\t\tif hasTimeSeparator == false && hasTime {\n\t\t\t\tdate.minute = TimeInterval(try read_int(2).value)\n\t\t\t} else if current() == time_sep {\n\t\t\t\tnext()\n\n\t\t\t\tif time_sep == \",\" || time_sep == \".\" {\n\t\t\t\t\t//We can't do fractional minutes when '.' is the segment separator.\n\t\t\t\t\t//Only allow whole minutes and whole seconds.\n\t\t\t\t\tdate.minute = TimeInterval(try read_int(2).value)\n\t\t\t\t\tif current() == time_sep {\n\t\t\t\t\t\tnext()\n\t\t\t\t\t\tdate.seconds = TimeInterval(try read_int(2).value)\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\t//Allow a fractional minute.\n\t\t\t\t\t//If we don't get a fraction, look for a seconds segment.\n\t\t\t\t\t//Otherwise, the fraction of a minute is the seconds.\n\t\t\t\t\tdate.minute = try read_double().value\n\n\t\t\t\t\tif current() != \":\" {\n\t\t\t\t\t\tvar int_part: Double = 0.0\n\t\t\t\t\t\tvar frac_part: Double = 0.0\n\t\t\t\t\t\tfrac_part = modf(date.minute, &int_part)\n\t\t\t\t\t\tdate.minute = int_part\n\t\t\t\t\t\tdate.seconds = frac_part\n\t\t\t\t\t\tif date.seconds > Double.ulpOfOne {\n\t\t\t\t\t\t\t// Convert fraction (e.g. .5) into seconds (e.g. 30).\n\t\t\t\t\t\t\tdate.seconds *= 60\n\t\t\t\t\t\t} else if current() == time_sep {\n\t\t\t\t\t\t\tnext()\n\t\t\t\t\t\t\t//\tdate.seconds = try read_double().value\n\t\t\t\t\t\t\tlet value = try modf(read_double().value)\n\t\t\t\t\t\t\tdate.nanoseconds = TimeInterval(round(value.1 * 1000) * 1_000_000)\n\t\t\t\t\t\t\tdate.seconds = TimeInterval(value.0)\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\t// fractional minutes\n\t\t\t\t\t\tnext()\n\t\t\t\t\t\tlet value = try modf(read_double().value)\n\t\t\t\t\t\tdate.nanoseconds = TimeInterval(round(value.1 * 1000) * 1_000_000)\n\t\t\t\t\t\tdate.seconds = TimeInterval(value.0)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif options.strict == false {\n\t\t\t\tif cIdx != eIdx && current()?.isSpace ?? false == true {\n\t\t\t\t\tnext()\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif cIdx != eIdx {\n\t\t\t\tswitch current() {\n\t\t\t\tcase \"Z\":\n\t\t\t\t\tdate.timezone = TimeZone(abbreviation: \"UTC\")\n\n\t\t\t\tcase \"+\", \"-\":\n\t\t\t\t\tlet is_negative = current() == \"-\"\n\t\t\t\t\tnext()\n\t\t\t\t\tif current()?.isDigit ?? false == true {\n\t\t\t\t\t\t//Read hour offset.\n\t\t\t\t\t\tdate.tz_hour = try read_int(2).value\n\t\t\t\t\t\tif is_negative == true { date.tz_hour = -date.tz_hour }\n\n\t\t\t\t\t\t// Optional separator\n\t\t\t\t\t\tif current() == time_sep {\n\t\t\t\t\t\t\tnext()\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif current()?.isDigit ?? false {\n\t\t\t\t\t\t\t// Read minute offset\n\t\t\t\t\t\t\tdate.tz_minute = try read_int(2).value\n\t\t\t\t\t\t\tif is_negative == true { date.tz_minute = -date.tz_minute }\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tlet timezone_offset = (date.tz_hour * 3600) + (date.tz_minute * 60)\n\t\t\t\t\t\tdate.timezone = TimeZone(secondsFromGMT: timezone_offset)\n\t\t\t\t\t}\n\t\t\t\tdefault:\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tdate_components = DateComponents()\n\t\tdate_components!.year = date.year\n\t\tdate_components!.day = date.day\n\t\tdate_components!.hour = date.hour\n\t\tdate_components!.minute = Int(date.minute)\n\t\tdate_components!.second = Int(date.seconds)\n\t\tdate_components!.nanosecond = Int(date.nanoseconds)\n\n\t\tswitch date.type {\n\t\tcase .monthAndDate:\n\t\t\tdate_components!.month = date.month_or_week\n\t\tcase .week:\n\t\t\t//Adapted from <http://personal.ecu.edu/mccartyr/ISOwdALG.txt>.\n\t\t\t//This works by converting the week date into an ordinal date, then letting the next case handle it.\n\t\t\tlet prevYear = date.year - 1\n\t\t\tlet YY = prevYear % 100\n\t\t\tlet prevC = prevYear - YY\n\t\t\tlet prevG = YY + YY / 4\n\t\t\tlet isLeapYear = (((prevC / 100) % 4) * 5)\n\t\t\tlet jan1Weekday = ((isLeapYear + prevG) % 7)\n\n\t\t\tvar day = ((8 - jan1Weekday) + (7 * (jan1Weekday > Weekday.thursday.rawValue ? 1 : 0)))\n\t\t\tday += (date.day - 1) + (7 * (date.month_or_week - 2))\n\n\t\t\tif let weekday = date.weekday {\n\t\t\t\t//date_components!.weekday = weekday\n\t\t\t\tdate_components!.day = day + weekday\n\t\t\t} else {\n\t\t\t\tdate_components!.day = day\n\t\t\t}\n\t\tcase .dateOnly: //An \"ordinal date\".\n\t\t\tbreak\n\n\t\t}\n\n\t\t//cfg.calendar.timeZone = date.timezone ?? TimeZone(identifier: \"UTC\")!\n\t\t//parsedDate = cfg.calendar.date(from: date_components!)\n\n\t\tlet tz = date.timezone ?? TimeZone(identifier: \"UTC\")!\n\t\tparsedTimeZone = tz\n\t\tsrcCalendar.timeZone = tz\n\t\tparsedDate = srcCalendar.date(from: date_components!)\n\n\t\treturn (parsedDate, parsedTimeZone)\n\t}\n\n\tprivate func parse_digits_3(_ num_digits: Int, _ segment: inout Int) throws {\n\t\t//Technically, the standard only allows one hyphen. But it says that two hyphens is the logical implementation, and one was dropped for brevity. So I have chosen to allow the missing hyphen.\n\t\tif hyphens < 1 || (hyphens > 2 && options.strict == false) {\n\t\t\tthrow ISO8601ParserError.invalid\n\t\t}\n\n\t\tdate.day = segment\n\t\tdate.year = now_cmps.year!\n\t\tdate.type = .dateOnly\n\t\tif options.strict == true && (date.day > (365 + (date.year.isLeapYear ? 1 : 0))) {\n\t\t\tthrow ISO8601ParserError.invalid\n\t\t}\n\t}\n\n\tprivate func parse_digits_7(_ num_digits: Int, _ segment: inout Int) throws {\n\t\tguard hyphens == 0 else { throw ISO8601ParserError.invalid }\n\n\t\tdate.day = segment % 1000\n\t\tdate.year = segment / 1000\n\t\tdate.type = .dateOnly\n\t\tif options.strict == true && (date.day > (365 + (date.year.isLeapYear ? 1 : 0))) {\n\t\t\tthrow ISO8601ParserError.invalid\n\t\t}\n\t}\n\n\tprivate func parse_digits_2(_ num_digits: Int, _ segment: inout Int) throws {\n\n\t\tfunc parse_hyphens_3(_ num_digits: Int, _ segment: inout Int) throws {\n\t\t\tdate.year = now_cmps.year!\n\t\t\tdate.month_or_week = now_cmps.month!\n\t\t\tdate.day = segment\n\t\t}\n\n\t\tfunc parse_hyphens_2(_ num_digits: Int, _ segment: inout Int) throws {\n\t\t\tdate.year = now_cmps.year!\n\t\t\tdate.month_or_week = segment\n\t\t\tif current() == \"-\" {\n\t\t\t\tnext()\n\t\t\t\tdate.day = try read_int(2).value\n\t\t\t} else {\n\t\t\t\tdate.day = 1\n\t\t\t}\n\t\t}\n\n\t\tfunc parse_hyphens_1(_ num_digits: Int, _ segment: inout Int) throws {\n\t\t\tlet current_year = now_cmps.year!\n\t\t\tlet current_century = (current_year % 100)\n\t\t\tdate.year = segment + (current_year - current_century)\n\t\t\tif num_digits == 1 { // implied decade\n\t\t\t\tdate.year += current_century - (current_year % 10)\n\t\t\t}\n\n\t\t\tif current() == \"-\" {\n\t\t\t\tnext()\n\t\t\t\tif current() == \"W\" {\n\t\t\t\t\tnext()\n\t\t\t\t\tdate.type = .week\n\t\t\t\t}\n\t\t\t\tdate.month_or_week = try read_int(2).value\n\n\t\t\t\tif current() == \"-\" {\n\t\t\t\t\tnext()\n\t\t\t\t\tif date.type == .week {\n\t\t\t\t\t\t// weekday number\n\t\t\t\t\t\tlet weekday = try read_int().value\n\t\t\t\t\t\tif weekday > 7 {\n\t\t\t\t\t\t\tthrow ISO8601ParserError.invalid\n\t\t\t\t\t\t}\n\t\t\t\t\t\tdate.weekday = weekday\n\t\t\t\t\t} else {\n\t\t\t\t\t\tdate.day = try read_int().value\n\t\t\t\t\t\tif date.day == 0 {\n\t\t\t\t\t\t\tdate.day = 1\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif date.month_or_week == 0 {\n\t\t\t\t\t\t\tdate.month_or_week = 1\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tdate.day = 1\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tdate.month_or_week = 1\n\t\t\t\tdate.day = 1\n\t\t\t}\n\t\t}\n\n\t\tfunc parse_hyphens_0(_ num_digits: Int, _ segment: inout Int) throws {\n\t\t\tif current() == \"-\" {\n\t\t\t\t// Implicit century\n\t\t\t\tdate.year = now_cmps.year!\n\t\t\t\tdate.year -= (date.year % 100)\n\t\t\t\tdate.year += segment\n\n\t\t\t\tnext()\n\t\t\t\tif current() == \"W\" {\n\t\t\t\t\ttry parseWeekAndDay()\n\t\t\t\t} else if current()?.isDigit ?? false == false {\n\t\t\t\t\ttry centuryOnly(&segment)\n\t\t\t\t} else {\n\t\t\t\t\t// Get month and/or date.\n\t\t\t\t\tlet (v_count, v_seg) = try read_int()\n\t\t\t\t\tswitch v_count {\n\t\t\t\t\tcase 4: // YY-MMDD\n\t\t\t\t\t\tdate.day = v_seg % 100\n\t\t\t\t\t\tdate.month_or_week = v_seg / 100\n\t\t\t\t\tcase 1: // YY-M; YY-M-DD (extension)\n\t\t\t\t\t\tif options.strict == true {\n\t\t\t\t\t\t\tthrow ISO8601ParserError.invalid\n\t\t\t\t\t\t}\n\t\t\t\t\tcase 2: // YY-MM; YY-MM-DD\n\t\t\t\t\t\tdate.month_or_week = v_seg\n\t\t\t\t\t\tif current() == \"-\" {\n\t\t\t\t\t\t\tnext()\n\t\t\t\t\t\t\tif current()?.isDigit ?? false == true {\n\t\t\t\t\t\t\t\tdate.day = try read_int(2).value\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tdate.day = 1\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tdate.day = 1\n\t\t\t\t\t\t}\n\t\t\t\t\tcase 3: // Ordinal date\n\t\t\t\t\t\tdate.day = v_seg\n\t\t\t\t\t\tdate.type = .dateOnly\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tbreak\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else if current() == \"W\" {\n\t\t\t\tdate.year = now_cmps.year!\n\t\t\t\tdate.year -= (date.year % 100)\n\t\t\t\tdate.year += segment\n\n\t\t\t\ttry parseWeekAndDay()\n\t\t\t} else {\n\t\t\t\ttry centuryOnly(&segment)\n\t\t\t}\n\t\t}\n\n\t\tswitch hyphens {\n\t\tcase 0:\t\ttry parse_hyphens_0(num_digits, &segment)\n\t\tcase 1:\t\ttry parse_hyphens_1(num_digits, &segment) //-YY; -YY-MM (implicit century)\n\t\tcase 2:\t\ttry parse_hyphens_2(num_digits, &segment) //--MM; --MM-DD\n\t\tcase 3:\t\ttry parse_hyphens_3(num_digits, &segment) //---DD\n\t\tdefault:\tthrow ISO8601ParserError.invalid\n\t\t}\n\t}\n\n\tprivate func parse_digits_1(_ num_digits: Int, _ segment: inout Int) throws {\n\t\tif options.strict == true {\n\t\t\t// Two digits only - never just one.\n\t\t\tguard hyphens == 1 else { throw ISO8601ParserError.invalid }\n\t\t\tif current() == \"-\" {\n\t\t\t\tnext()\n\t\t\t}\n\t\t\tnext()\n\t\t\tguard current() == \"W\" else { throw ISO8601ParserError.invalid }\n\n\t\t\tdate.year = now_cmps.year!\n\t\t\tdate.year -= (date.year % 10)\n\t\t\tdate.year += segment\n\t\t} else {\n\t\t\ttry parse_digits_2(num_digits, &segment)\n\t\t}\n\t}\n\n\tprivate func parse_digits_5(_ num_digits: Int, _ segment: inout Int) throws {\n\t\tguard hyphens == 0 else { throw ISO8601ParserError.invalid }\n\t\t// YYDDD\n\t\tdate.year = now_cmps.year!\n\t\tdate.year -= (date.year % 100)\n\t\tdate.year += segment / 1000\n\n\t\tdate.day = segment % 1000\n\t\tdate.type = .dateOnly\n\t}\n\n\tprivate func parse_digits_4(_ num_digits: Int, _ segment: inout Int) throws {\n\n\t\tfunc parse_hyphens_0(_ num_digits: Int, _ segment: inout Int) throws {\n\t\t\tdate.year = segment\n\t\t\tif current() == \"-\" {\n\t\t\t\tnext()\n\t\t\t}\n\n\t\t\tif current()?.isDigit ?? false == false {\n\t\t\t\tif current() == \"W\" {\n\t\t\t\t\ttry parseWeekAndDay()\n\t\t\t\t} else {\n\t\t\t\t\tdate.month_or_week = 1\n\t\t\t\t\tdate.day = 1\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tlet (v_num, v_seg) = try read_int()\n\t\t\t\tswitch v_num {\n\t\t\t\tcase 4: // MMDD\n\t\t\t\t\tdate.day = v_seg % 100\n\t\t\t\t\tdate.month_or_week = v_seg / 100\n\t\t\t\tcase 2: // MM\n\t\t\t\t\tdate.month_or_week = v_seg\n\n\t\t\t\t\tif current() == \"-\" {\n\t\t\t\t\t\tnext()\n\t\t\t\t\t}\n\t\t\t\t\tif current()?.isDigit ?? false == false {\n\t\t\t\t\t\tdate.day = 1\n\t\t\t\t\t} else {\n\t\t\t\t\t\tdate.day = try read_int().value\n\t\t\t\t\t}\n\t\t\t\tcase 3: // DDD\n\t\t\t\t\tdate.day = v_seg % 1000\n\t\t\t\t\tdate.type = .dateOnly\n\t\t\t\t\tif options.strict == true && (date.day > 365 + (date.year.isLeapYear ? 1 : 0)) {\n\t\t\t\t\t\tthrow ISO8601ParserError.invalid\n\t\t\t\t\t}\n\t\t\t\tdefault:\n\t\t\t\t\tthrow ISO8601ParserError.invalid\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tfunc parse_hyphens_1(_ num_digits: Int, _ segment: inout Int) throws {\n\t\t\tdate.month_or_week = segment % 100\n\t\t\tdate.year = segment / 100\n\n\t\t\tif current() == \"-\" {\n\t\t\t\tnext()\n\t\t\t}\n\t\t\tif current()?.isDigit ?? false == false {\n\t\t\t\tdate.day = 1\n\t\t\t} else {\n\t\t\t\tdate.day = try read_int().value\n\t\t\t}\n\t\t}\n\n\t\tfunc parse_hyphens_2(_ num_digits: Int, _ segment: inout Int) throws {\n\t\t\tdate.day = segment % 100\n\t\t\tdate.month_or_week = segment / 100\n\t\t\tdate.year = now_cmps.year!\n\t\t}\n\n\t\tswitch hyphens {\n\t\tcase 0:\t\ttry parse_hyphens_0(num_digits, &segment) // YYYY\n\t\tcase 1:\t\ttry parse_hyphens_1(num_digits, &segment) // YYMM\n\t\tcase 2:\t\ttry parse_hyphens_2(num_digits, &segment) // MMDD\n\t\tdefault:\tthrow ISO8601ParserError.invalid\n\t\t}\n\n\t}\n\n\tprivate func parse_digits_6(_ num_digits: Int, _ segment: inout Int) throws {\n\t\t// YYMMDD (implicit century)\n\t\tguard hyphens == 0 else {\n\t\t\tthrow ISO8601ParserError.invalid\n\t\t}\n\n\t\tdate.day = segment % 100\n\t\tsegment /= 100\n\t\tdate.month_or_week = segment % 100\n\t\tdate.year = now_cmps.year!\n\t\tdate.year -= (date.year % 100)\n\t\tdate.year += (segment / 100)\n\t}\n\n\tprivate func parse_digits_8(_ num_digits: Int, _ segment: inout Int) throws {\n\t\t// YYYY MM DD\n\t\tguard hyphens == 0 else {\n\t\t\tthrow ISO8601ParserError.invalid\n\t\t}\n\n\t\tdate.day = segment % 100\n\t\tsegment /= 100\n\t\tdate.month_or_week = segment % 100\n\t\tdate.year = segment / 100\n\t}\n\n\tprivate func parse_digits_0(_ num_digits: Int, _ segment: inout Int) throws {\n\t\tguard current() == \"W\" else {\n\t\t\tthrow ISO8601ParserError.invalid\n\t\t}\n\n\t\tif seek(1) == \"-\" && isDigit(seek(2)) &&\n\t\t\t((hyphens == 1 || hyphens == 2) && options.strict == false) {\n\n\t\t\tdate.year = now_cmps.year!\n\t\t\tdate.month_or_week = 1\n\t\t\tnext(2)\n\t\t\ttry parseDayAfterWeek()\n\t\t} else if hyphens == 1 {\n\t\t\tdate.year = now_cmps.year!\n\t\t\tif current() == \"W\" {\n\t\t\t\tnext()\n\t\t\t\tdate.month_or_week = try read_int(2).value\n\t\t\t\tdate.type = .week\n\t\t\t\ttry parseWeekday()\n\t\t\t} else {\n\t\t\t\ttry parseDayAfterWeek()\n\t\t\t}\n\t\t} else {\n\t\t\tthrow ISO8601ParserError.invalid\n\t\t}\n\t}\n\n\tprivate func parseWeekday() throws {\n\t\tif current() == \"-\" {\n\t\t\tnext()\n\t\t}\n\t\tlet weekday = try read_int().value\n\t\tif weekday > 7 {\n\t\t\tthrow ISO8601ParserError.invalid\n\t\t}\n\t\tdate.type = .week\n\t\tdate.weekday = weekday\n\t}\n\n\tprivate func parseWeekAndDay() throws {\n\t\tnext()\n\t\tif current()?.isDigit ?? false == false {\n\t\t\t//Not really a week-based date; just a year followed by '-W'.\n\t\t\tguard options.strict == false else {\n\t\t\t\tthrow ISO8601ParserError.invalid\n\t\t\t}\n\t\t\tdate.month_or_week = 1\n\t\t\tdate.day = 1\n\t\t} else {\n\t\t\tdate.month_or_week = try read_int(2).value\n\t\t\ttry parseWeekday()\n\t\t}\n\t}\n\n\tprivate func parseDayAfterWeek() throws {\n\t\tdate.day = current()?.isDigit ?? false == true ? try read_int(2).value : 1\n\t\tdate.type = .week\n\t}\n\n\tprivate func centuryOnly(_ segment: inout Int) throws {\n\t\tdate.year = segment * 100 + now_cmps.year! % 100\n\t\tdate.month_or_week = 1\n\t\tdate.day = 1\n\t}\n\n\t/// Return `true` if given character is a char\n\t///\n\t/// - Parameter char: char to evaluate\n\t/// - Returns: `true` if char is a digit, `false` otherwise\n\tprivate func isDigit(_ char: UnicodeScalar?) -> Bool {\n\t\tguard let char = char else { return false }\n\t\treturn char.isDigit\n\t}\n\n\t// MARK: - Scanner internal functions\n\n\t/// Get the value at specified offset from current scanner position without\n\t/// moving the current scanner's index.\n\t///\n\t/// - Parameter offset: offset to move\n\t/// - Returns: char at given position, `nil` if not found\n\t@discardableResult\n\tpublic func seek(_ offset: Int = 1) -> ISOChar? {\n\t\tlet move_idx = string.index(cIdx, offsetBy: offset)\n\t\tguard move_idx < eIdx else {\n\t\t\treturn nil\n\t\t}\n\t\treturn string[move_idx]\n\t}\n\n\t/// Return the char at the current position of the scanner\n\t///\n\t/// - Parameter next: if `true` return the current char and move to the next position\n\t/// - Returns: the char sat the current position of the scanner\n\t@discardableResult\n\tpublic func current(_ next: Bool = false) -> ISOChar? {\n\t\tguard cIdx != eIdx else { return nil }\n\t\tlet current = string[cIdx]\n\t\tif next == true { cIdx = string.index(after: cIdx) }\n\t\treturn current\n\t}\n\n\t/// Move by `offset` characters the index of the scanner and return the char at the current\n\t/// position. If EOF is reached `nil` is returned.\n\t///\n\t/// - Parameter offset: offset value (use negative number to move backwards)\n\t/// - Returns: character at the current position.\n\t@discardableResult\n\tprivate func next(_ offset: Int = 1) -> ISOChar? {\n\t\tlet next = string.index(cIdx, offsetBy: offset)\n\t\tguard next < eIdx else {\n\t\t\treturn nil\n\t\t}\n\t\tcIdx = next\n\t\treturn string[cIdx]\n\t}\n\n\t/// Read from the current scanner index and parse the value as Int.\n\t///\n\t/// - Parameter max_count: number of characters to move. If nil scanners continues until a non\n\t///   digit value is encountered.\n\t/// - Returns: parsed value\n\t/// - Throws: throw an exception if parser fails\n\t@discardableResult\n\tprivate func read_int(_ max_count: Int? = nil) throws -> (count: Int, value: Int) {\n\t\tvar move_idx = cIdx\n\t\tvar count = 0\n\t\twhile move_idx < eIdx {\n\t\t\tif let max = max_count, count >= max { break }\n\t\t\tif string[move_idx].isDigit == false { break }\n\t\t\tcount += 1\n\t\t\tmove_idx = string.index(after: move_idx)\n\t\t}\n\n\t\tlet raw_value = String(string[cIdx..<move_idx])\n\t\tif raw_value == \"\" {\n\t\t\treturn (count, 0)\n\t\t}\n\t\tguard let value = Int(raw_value) else {\n\t\t\tthrow ISO8601ParserError.notDigit\n\t\t}\n\n\t\tcIdx = move_idx\n\t\treturn (count, value)\n\t}\n\n\t/// Read from the current scanner index and parse the value as Double.\n\t/// If parser fails an exception is throw.\n\t/// Unit separator can be `-` or `,`.\n\t///\n\t/// - Returns: double value\n\t/// - Throws: throw an exception if parser fails\n\t@discardableResult\n\tprivate func read_double() throws -> (count: Int, value: Double) {\n\t\tvar move_idx = cIdx\n\t\tvar count = 0\n\t\tvar fractional_start = false\n\t\twhile move_idx < eIdx {\n\t\t\tlet char = string[move_idx]\n\t\t\tif char == \".\" || char == \",\" {\n\t\t\t\tif fractional_start == true { throw ISO8601ParserError.notDouble } else { fractional_start = true }\n\t\t\t} else {\n\t\t\t\tif char.isDigit == false { break }\n\t\t\t}\n\t\t\tcount += 1\n\t\t\tmove_idx = string.index(after: move_idx)\n\t\t}\n\n\t\tlet raw_value = String(string[cIdx..<move_idx]).replacingOccurrences(of: \",\", with: \".\")\n\t\tif raw_value == \"\" {\n\t\t\treturn (count, 0.0)\n\t\t}\n\t\tguard let value = Double(raw_value) else {\n\t\t\tthrow ISO8601ParserError.notDouble\n\t\t}\n\t\tcIdx = move_idx\n\t\treturn (count, value)\n\t}\n\n\t/// Move the current scanner index to the next position until the current char of the scanner\n\t/// is the given `char` value.\n\t///\n\t/// - Parameter char: char\n\t/// - Returns: the number of characters passed\n\t@discardableResult\n\tprivate func moveUntil(is char: UnicodeScalar) -> Int {\n\t\tvar move_idx = cIdx\n\t\tvar count = 0\n\t\twhile move_idx < eIdx {\n\t\t\tguard string[move_idx] == char else { break }\n\t\t\tmove_idx = string.index(after: move_idx)\n\t\t\tcount += 1\n\t\t}\n\t\tcIdx = move_idx\n\t\treturn count\n\t}\n\n\t/// Move the current scanner index to the next position until passed `char` value is\n\t/// encountered or `eof` is reached.\n\t///\n\t/// - Parameter char: char\n\t/// - Returns: the number of characters passed\n\t@discardableResult\n\tprivate func moveUntil(isNot char: UnicodeScalar) -> Int {\n\t\tvar move_idx = cIdx\n\t\tvar count = 0\n\t\twhile move_idx < eIdx {\n\t\t\tguard string[move_idx] != char else { break }\n\t\t\tmove_idx = string.index(after: move_idx)\n\t\t\tcount += 1\n\t\t}\n\t\tcIdx = move_idx\n\t\treturn count\n\t}\n\n\t/// Return a date parsed from a valid ISO8601 string\n\t///\n\t/// - Parameter string: source string\n\t/// - Returns: a valid `Date` object or `nil` if date cannot be parsed\n\tpublic static func date(from string: String) -> ISOParsedDate? {\n\t\tguard let parser = ISOParser(string) else {\n\t\t\treturn nil\n\t\t}\n\t\treturn (parser.parsedDate, parser.parsedTimeZone)\n\t}\n\n\tpublic static func parse(_ string: String, region: Region?, options: Any?) -> DateInRegion? {\n\t\tlet formatOptions = options as? ISOParser.Options\n\t\tguard let parser = ISOParser(string, options: formatOptions),\n\t\t\tlet date = parser.parsedDate else {\n\t\t\treturn nil\n\t\t}\n\t\tlet parsedRegion = Region(calendar: region?.calendar ?? Region.ISO.calendar,\n\t\t\t\t\t\t\t\t  zone: (region?.timeZone ?? parser.parsedTimeZone ?? Region.ISO.timeZone),\n\t\t\t\t\t\t\t\t  locale: region?.locale ?? Region.ISO.locale)\n\t\treturn DateInRegion(date, region: parsedRegion)\n\t}\n\n}\n"
  },
  {
    "path": "Sources/SwiftDate/Foundation+Extras/DateComponents+Extras.swift",
    "content": "//\n//  SwiftDate\n//  Parse, validate, manipulate, and display dates, time and timezones in Swift\n//\n//  Created by Daniele Margutti\n//   - Web: https://www.danielemargutti.com\n//   - Twitter: https://twitter.com/danielemargutti\n//   - Mail: hello@danielemargutti.com\n//\n//  Copyright © 2019 Daniele Margutti. Licensed under MIT License.\n//\n\nimport Foundation\n\n// MARK: - Date Components Extensions\n\npublic extension Calendar.Component {\n\n\t/// Return a description of the calendar component in seconds.\n\t/// Note: \tValues for `era`,`weekday`,`weekdayOrdinal`, `yearForWeekOfYear`, `calendar`, `timezone` are `nil`.\n\t/// \t\tFor `weekOfYear` it return the same value of `weekOfMonth`.\n\tvar timeInterval: Double? {\n\t\tswitch self {\n\t\tcase .era: \t\t\t\t\t\treturn nil\n\t\tcase .year: \t\t\t\t\treturn (Calendar.Component.day.timeInterval! * 365.0)\n\t\tcase .month: \t\t\t\t\treturn (Calendar.Component.minute.timeInterval! * 43800)\n\t\tcase .day: \t\t\t\t\t\treturn 86400\n\t\tcase .hour: \t\t\t\t\treturn 3600\n\t\tcase .minute: \t\t\t\t\treturn 60\n\t\tcase .second: \t\t\t\t\treturn 1\n\t\tcase .quarter: \t\t\t\t\treturn (Calendar.Component.day.timeInterval! * 91.25)\n\t\tcase .weekOfMonth, .weekOfYear: return (Calendar.Component.day.timeInterval! * 7)\n\t\tcase .nanosecond: \t\t\t\treturn 1e-9\n\t\tdefault: \t\t\t\t\t\treturn nil\n\t\t}\n\t}\n\n\t/// Return the localized identifier of a calendar component\n\t///\n\t/// - parameter unit:  unit\n\t/// - parameter value: value\n\t///\n\t/// - returns: return the plural or singular form of the time unit used to compose a valid identifier for search a localized\n\t///   string in resource bundle\n\tinternal func localizedKey(forValue value: Int) -> String {\n\t\tlet locKey = localizedKey\n\t\tlet absValue = abs(value)\n\t\tswitch absValue {\n\t\tcase 0: // zero difference for this unit\n\t\t\treturn \"0\\(locKey)\"\n\t\tcase 1: // one unit of difference\n\t\t\treturn locKey\n\t\tdefault: // more than 1 unit of difference\n\t\t\treturn \"\\(locKey)\\(locKey)\"\n\t\t}\n\t}\n\n\tinternal var localizedKey: String {\n\t\tswitch self {\n\t\tcase .year:\t\t\treturn \"y\"\n\t\tcase .month:\t\treturn \"m\"\n\t\tcase .weekOfYear:\treturn \"w\"\n\t\tcase .day:\t\t\treturn \"d\"\n\t\tcase .hour:\t\t\treturn \"h\"\n\t\tcase .minute:\t\treturn \"M\"\n\t\tcase .second:\t\treturn \"s\"\n\t\tdefault:\n\t\t\treturn \"\"\n\t\t}\n\t}\n\n}\n\npublic extension DateComponents {\n\n\t/// Shortcut for 'all calendar components'.\n\tstatic var allComponentsSet: Set<Calendar.Component> {\n\t\treturn [.era, .year, .month, .day, .hour, .minute,\n\t\t\t\t.second, .weekday, .weekdayOrdinal, .quarter,\n\t\t\t\t.weekOfMonth, .weekOfYear, .yearForWeekOfYear,\n\t\t\t\t.nanosecond, .calendar, .timeZone]\n\t}\n\n\tinternal static let allComponents: [Calendar.Component] =  [.nanosecond, .second, .minute, .hour,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.day, .month, .year, .yearForWeekOfYear,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.weekOfYear, .weekday, .quarter, .weekdayOrdinal,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.weekOfMonth]\n\n\t/// This function return the absolute amount of seconds described by the components of the receiver.\n\t/// Note: \tevaluated value maybe not strictly exact because it ignore the context (calendar/date) of\n\t/// \t\tthe date components. In details:\n\t/// \t\t- The following keys are ignored: `era`,`weekday`,`weekdayOrdinal`,\n\t///\t\t\t\t`weekOfYear`, `yearForWeekOfYear`, `calendar`, `timezone\n\t///\n\t/// Some other values dependant from dates are fixed. This is a complete table:\n\t///\t\t\t- `year` is 365.0 `days`\n\t///\t\t\t- `month` is 30.4167 `days` (or 43800 minutes)\n\t///\t\t\t- `quarter` is 91.25 `days`\n\t///\t\t\t- `weekOfMonth` is 7 `days`\n\t///\t\t\t- `day` is 86400 `seconds`\n\t///\t\t\t- `hour` is 3600 `seconds`\n\t///\t\t\t- `minute` is 60 `seconds`\n\t///\t\t\t- `nanosecond` is 1e-9 `seconds`\n\tvar timeInterval: TimeInterval {\n\t\tvar totalAmount: TimeInterval = 0\n\t\tDateComponents.allComponents.forEach {\n\t\t\tif let multipler = $0.timeInterval, let value = value(for: $0), value != Int(NSDateComponentUndefined) {\n\t\t\t\ttotalAmount += (TimeInterval(value) * multipler)\n\t\t\t}\n\t\t}\n\t\treturn totalAmount\n\t}\n\n\t/// Create a new `DateComponents` instance with builder pattern.\n\t///\n\t/// - Parameter builder: callback for builder\n\t/// - Returns: new instance\n\tstatic func create(_ builder: ((inout DateComponents) -> Void)) -> DateComponents {\n\t\tvar components = DateComponents()\n\t\tbuilder(&components)\n\t\treturn components\n\t}\n\n\t/// Return the current date plus the receive's interval\n\t/// The default calendar used is the `SwiftDate.defaultRegion`'s calendar.\n\tvar fromNow: Date {\n\t\treturn SwiftDate.defaultRegion.calendar.date(byAdding: (self as DateComponents) as DateComponents, to: Date() as Date)!\n\t}\n\n\t/// Returns the current date minus the receiver's interval\n\t/// The default calendar used is the `SwiftDate.defaultRegion`'s calendar.\n\tvar ago: Date {\n\t\treturn SwiftDate.defaultRegion.calendar.date(byAdding: -self as DateComponents, to: Date())!\n\t}\n\n\t/// - returns: the date that will occur once the receiver's components pass after the provide date.\n\tfunc from(_ date: DateRepresentable) -> Date? {\n\t\treturn date.calendar.date(byAdding: self, to: date.date)\n\t}\n\n\t/// Return `true` if all interval components are zeroes\n\tvar isZero: Bool {\n\t\tfor component in DateComponents.allComponents {\n\t\t\tif let value = value(for: component), value != 0 {\n\t\t\t\treturn false\n\t\t\t}\n\t\t}\n\t\treturn true\n\t}\n\n\t/// Transform a `DateComponents` instance to a dictionary where key is the `Calendar.Component` and value is the\n\t/// value associated.\n\t///\n\t/// - returns: a new `[Calendar.Component : Int]` dict representing source `DateComponents` instance\n\tinternal func toDict() -> [Calendar.Component: Int] {\n\t\tvar list: [Calendar.Component: Int] = [:]\n\t\tDateComponents.allComponents.forEach { component in\n\t\t\tlet value = self.value(for: component)\n\t\t\tif value != nil && value != Int(NSDateComponentUndefined) {\n\t\t\t\tlist[component] = value!\n\t\t\t}\n\t\t}\n\t\treturn list\n\t}\n\n\t/// Alter date components specified into passed dictionary.\n\t///\n\t/// - Parameter components: components dictionary with their values.\n\tinternal mutating func alterComponents(_ components: [Calendar.Component: Int?]) {\n\t\tcomponents.forEach {\n\t\t\tif let v = $0.value {\n\t\t\t\tsetValue(v, for: $0.key)\n\t\t\t}\n\t\t}\n\t}\n\n\t/// Adds two NSDateComponents and returns their combined individual components.\n\tstatic func + (lhs: DateComponents, rhs: DateComponents) -> DateComponents {\n\t\treturn combine(lhs, rhs: rhs, transform: +)\n\t}\n\n\t/// Subtracts two NSDateComponents and returns the relative difference between them.\n\tstatic func - (lhs: DateComponents, rhs: DateComponents) -> DateComponents {\n\t\treturn lhs + (-rhs)\n\t}\n\n\t/// Applies the `transform` to the two `T` provided, defaulting either of them if it's\n\t/// `nil`\n\tinternal static func bimap<T>(_ a: T?, _ b: T?, default: T, _ transform: (T, T) -> T) -> T? {\n\t\tif a == nil && b == nil { return nil }\n\t\treturn transform(a ?? `default`, b ?? `default`)\n\t}\n\n\t/// - returns: a new `NSDateComponents` that represents the negative of all values within the\n\t/// components that are not `NSDateComponentUndefined`.\n\tstatic prefix func - (rhs: DateComponents) -> DateComponents {\n\t\tvar components = DateComponents()\n\t\tcomponents.era = rhs.era.map(-)\n\t\tcomponents.year = rhs.year.map(-)\n\t\tcomponents.month = rhs.month.map(-)\n\t\tcomponents.day = rhs.day.map(-)\n\t\tcomponents.hour = rhs.hour.map(-)\n\t\tcomponents.minute = rhs.minute.map(-)\n\t\tcomponents.second = rhs.second.map(-)\n\t\tcomponents.nanosecond = rhs.nanosecond.map(-)\n\t\tcomponents.weekday = rhs.weekday.map(-)\n\t\tcomponents.weekdayOrdinal = rhs.weekdayOrdinal.map(-)\n\t\tcomponents.quarter = rhs.quarter.map(-)\n\t\tcomponents.weekOfMonth = rhs.weekOfMonth.map(-)\n\t\tcomponents.weekOfYear = rhs.weekOfYear.map(-)\n\t\tcomponents.yearForWeekOfYear = rhs.yearForWeekOfYear.map(-)\n\t\treturn components\n\t}\n\n\t/// Combines two date components using the provided `transform` on all\n\t/// values within the components that are not `NSDateComponentUndefined`.\n\tprivate static func combine(_ lhs: DateComponents, rhs: DateComponents, transform: (Int, Int) -> Int) -> DateComponents {\n\t\tvar components = DateComponents()\n\t\tcomponents.era = bimap(lhs.era, rhs.era, default: 0, transform)\n\t\tcomponents.year = bimap(lhs.year, rhs.year, default: 0, transform)\n\t\tcomponents.month = bimap(lhs.month, rhs.month, default: 0, transform)\n\t\tcomponents.day = bimap(lhs.day, rhs.day, default: 0, transform)\n\t\tcomponents.hour = bimap(lhs.hour, rhs.hour, default: 0, transform)\n\t\tcomponents.minute = bimap(lhs.minute, rhs.minute, default: 0, transform)\n\t\tcomponents.second = bimap(lhs.second, rhs.second, default: 0, transform)\n\t\tcomponents.nanosecond = bimap(lhs.nanosecond, rhs.nanosecond, default: 0, transform)\n\t\tcomponents.weekday = bimap(lhs.weekday, rhs.weekday, default: 0, transform)\n\t\tcomponents.weekdayOrdinal = bimap(lhs.weekdayOrdinal, rhs.weekdayOrdinal, default: 0, transform)\n\t\tcomponents.quarter = bimap(lhs.quarter, rhs.quarter, default: 0, transform)\n\t\tcomponents.weekOfMonth = bimap(lhs.weekOfMonth, rhs.weekOfMonth, default: 0, transform)\n\t\tcomponents.weekOfYear = bimap(lhs.weekOfYear, rhs.weekOfYear, default: 0, transform)\n\t\tcomponents.yearForWeekOfYear = bimap(lhs.yearForWeekOfYear, rhs.yearForWeekOfYear, default: 0, transform)\n\t\treturn components\n\t}\n\n\t/// Subscription support for `DateComponents` instances.\n\t/// ie. `cmps[.day] = 5`\n\t///\n\t/// Note: This does not take into account any built-in errors, `Int.max` returned instead of `nil`.\n\t///\n\t/// - Parameter component: component to get\n\tsubscript(component: Calendar.Component) -> Int? {\n\t\tswitch component {\n\t\tcase .era: \t\t\t\t\treturn era\n\t\tcase .year: \t\t\t\treturn year\n\t\tcase .month: \t\t\t\treturn month\n\t\tcase .day: \t\t\t\t\treturn day\n\t\tcase .hour: \t\t\t\treturn hour\n\t\tcase .minute: \t\t\t\treturn minute\n\t\tcase .second: \t\t\t\treturn second\n\t\tcase .weekday: \t\t\t\treturn weekday\n\t\tcase .weekdayOrdinal: \t\treturn weekdayOrdinal\n\t\tcase .quarter: \t\t\t\treturn quarter\n\t\tcase .weekOfMonth: \t\t\treturn weekOfMonth\n\t\tcase .weekOfYear:\t \t\treturn weekOfYear\n\t\tcase .yearForWeekOfYear: \treturn yearForWeekOfYear\n\t\tcase .nanosecond: \t\t\treturn nanosecond\n\t\tdefault: \t\t\t\t\treturn nil // `calendar` and `timezone` are ignored in this context\n\t\t}\n\t}\n\n\t/// Express a `DateComponents` instance in another time unit you choose.\n\t///\n\t/// - parameter component: time component\n\t/// - parameter calendar:  context calendar to use\n\t///\n\t/// - returns: the value of interval expressed in selected `Calendar.Component`\n\tfunc `in`(_ component: Calendar.Component, of calendar: CalendarConvertible? = nil) -> Int? {\n\t\tlet cal = (calendar?.toCalendar() ?? SwiftDate.defaultRegion.calendar)\n\t\tlet dateFrom = Date()\n\t\tlet dateTo = (dateFrom + self)\n\t\tlet components: Set<Calendar.Component> = [component]\n\t\tlet value = cal.dateComponents(components, from: dateFrom, to: dateTo).value(for: component)\n\t\treturn value\n\t}\n\n\t/// Express a `DateComponents` instance in a set of time units you choose.\n\t///\n\t/// - Parameters:\n\t///   - component: time component\n\t///   - calendar: context calendar to use\n\t/// - Returns: a dictionary of extract values.\n\tfunc `in`(_ components: Set<Calendar.Component>, of calendar: CalendarConvertible? = nil) -> [Calendar.Component: Int] {\n\t\tlet cal = (calendar?.toCalendar() ?? SwiftDate.defaultRegion.calendar)\n\t\tlet dateFrom = Date()\n\t\tlet dateTo = (dateFrom + self)\n\t\tlet extractedCmps = cal.dateComponents(components, from: dateFrom, to: dateTo)\n\t\treturn extractedCmps.toDict()\n\t}\n}\n"
  },
  {
    "path": "Sources/SwiftDate/Foundation+Extras/Int+DateComponents.swift",
    "content": "//\n//  SwiftDate\n//  Parse, validate, manipulate, and display dates, time and timezones in Swift\n//\n//  Created by Daniele Margutti\n//   - Web: https://www.danielemargutti.com\n//   - Twitter: https://twitter.com/danielemargutti\n//   - Mail: hello@danielemargutti.com\n//\n//  Copyright © 2019 Daniele Margutti. Licensed under MIT License.\n//\n\nimport Foundation\n\n// MARK: Int Extension\n\n/// This allows us to transform a literal number in a `DateComponents` and use it in math operations\n/// For example `5.days` will create a new `DateComponents` where `.day = 5`.\n\npublic extension Int {\n\n\t/// Internal transformation function\n\t///\n\t/// - parameter type: component to use\n\t///\n\t/// - returns: return self value in form of `DateComponents` where given `Calendar.Component` has `self` as value\n\tinternal func toDateComponents(type: Calendar.Component) -> DateComponents {\n\t\tvar dateComponents = DateComponents()\n        DateComponents.allComponents.forEach( { dateComponents.setValue(0, for: $0 )})\n        dateComponents.setValue(self, for: type)\n        dateComponents.setValue(0, for: .era)\n\t\treturn dateComponents\n\t}\n\n\t/// Create a `DateComponents` with `self` value set as nanoseconds\n\tvar nanoseconds: DateComponents {\n        toDateComponents(type: .nanosecond)\n\t}\n\n\t/// Create a `DateComponents` with `self` value set as seconds\n\tvar seconds: DateComponents {\n        toDateComponents(type: .second)\n\t}\n\n\t/// Create a `DateComponents` with `self` value set as minutes\n\tvar minutes: DateComponents {\n        toDateComponents(type: .minute)\n\t}\n\n\t/// Create a `DateComponents` with `self` value set as hours\n\tvar hours: DateComponents {\n        toDateComponents(type: .hour)\n\t}\n\n\t/// Create a `DateComponents` with `self` value set as days\n\tvar days: DateComponents {\n        toDateComponents(type: .day)\n\t}\n\n\t/// Create a `DateComponents` with `self` value set as weeks\n\tvar weeks: DateComponents {\n        toDateComponents(type: .weekOfYear)\n\t}\n\n\t/// Create a `DateComponents` with `self` value set as months\n\tvar months: DateComponents {\n        toDateComponents(type: .month)\n\t}\n\n\t/// Create a `DateComponents` with `self` value set as years\n\tvar years: DateComponents {\n        toDateComponents(type: .year)\n\t}\n\n\t/// Create a `DateComponents` with `self` value set as quarters\n\tvar quarters: DateComponents {\n        toDateComponents(type: .quarter)\n\t}\n\n}\n"
  },
  {
    "path": "Sources/SwiftDate/Foundation+Extras/String+Parser.swift",
    "content": "//\n//  SwiftDate\n//  Parse, validate, manipulate, and display dates, time and timezones in Swift\n//\n//  Created by Daniele Margutti\n//   - Web: https://www.danielemargutti.com\n//   - Twitter: https://twitter.com/danielemargutti\n//   - Mail: hello@danielemargutti.com\n//\n//  Copyright © 2019 Daniele Margutti. Licensed under MIT License.\n//\n\nimport Foundation\n\n// MARK: - DataParsable Protocol\n\npublic protocol DateParsable {\n\n\t/// Convert a string to a `DateInRegion` instance by parsing it with given parser\n\t/// or using one of the built-in parser (if you know the format of the date you\n\t/// should consider explicitly pass it to avoid unecessary computations).\n\t///\n\t/// - Parameters:\n\t///   - format: format of the date, `nil` to leave the library to found the best\n\t///\t\t\t\tone via `SwiftDate.autoFormats`\n\t///   - region: region in which the date should be expressed in.\n\t///\t\t\t\tRegion's locale is used to format the date when using long readable unit names (like MMM\n\t///\t\t\t\tfor month).\n\t/// - Returns: date in region representation, `nil` if parse fails\n\tfunc toDate(_ format: String?, region: Region) -> DateInRegion?\n\n\t/// Convert a string to a `DateInRegion` instance by parsing it with the ordered\n\t/// list of provided formats.\n\t/// If `formats` array is not provided it uses the `SwiftDate.autoFormats` array instead.\n\t/// Note: if you knwo the format of the date you should consider explicitly pass it to avoid\n\t///       unecessary computations.\n\t///\n\t/// - Parameters:\n\t///   - format: ordered formats to parse date (if you don't have a list of formats you can pass `SwiftDate.autoFormats`)\n\t///   - region: region in which the date should be expressed in.\n\t///\t\t\t\tRegion's locale is used to format the date when using long readable unit names (like MMM\n\t///\t\t\t\tfor month).\n\t/// - Returns: date in region representation, `nil` if parse fails\n\tfunc toDate(_ formats: [String], region: Region) -> DateInRegion?\n\n\t/// Convert a string to a valid `DateInRegion` using passed style.\n\t///\n\t/// - Parameters:\n\t///   - style: parsing style.\n\t///   - region: region in which the date should be expressed in\n\t/// - Returns: date in region representation, `nil` if parse fails\n\tfunc toDate(style: StringToDateStyles, region: Region) -> DateInRegion?\n\n\t/// Convert to date from a valid ISO8601 string\n\t///\n\t/// - Parameters:\n\t///   - options: options of the parser\n\t///   - region: region in which the date should be expressed in (timzone is ignored and evaluated automatically)\n\t/// - Returns: date in region representation, `nil` if parse fails\n\tfunc toISODate(_ options: ISOParser.Options?, region: Region?) -> DateInRegion?\n\n\t/// Convert to date from a valid DOTNET string\n\t///\n\t///   - region: region in which the date should be expressed in (timzone is ignored and evaluated automatically)\n\t/// - Returns: date in region representation, `nil` if parse fails\n\tfunc toDotNETDate(region: Region) -> DateInRegion?\n\n\t/// Convert to a date from a valid RSS/ALT RSS string\n\t///\n\t/// - Parameters:\n\t///   - alt: `true` if string represent an ALT RSS formatted date, `false` if a standard RSS formatted date.\n\t///   - region: region in which the date should be expressed in (timzone is ignored and evaluated automatically)\n\t/// - Returns: date in region representation, `nil` if parse fails\n\tfunc toRSSDate(alt: Bool, region: Region) -> DateInRegion?\n\n\t/// Convert to a date from a valid SQL format string.\n\t///\n\t/// - Parameters:\n\t///   - region: region in which the date should be expressed in (timzone is ignored and evaluated automatically)\n\t/// - Returns: date in region representation, `nil` if parse fails\n\tfunc toSQLDate(region: Region) -> DateInRegion?\n\n}\n\n// MARK: - DataParsable Implementation for Strings\n\nextension String: DateParsable {\n\n\tpublic func toDate(_ format: String? = nil, region: Region = SwiftDate.defaultRegion) -> DateInRegion? {\n        DateInRegion(self, format: format, region: region)\n\t}\n\n\tpublic func toDate(_ formats: [String], region: Region) -> DateInRegion? {\n        DateInRegion(self, formats: formats, region: region)\n\t}\n\n\tpublic func toDate(style: StringToDateStyles, region: Region = SwiftDate.defaultRegion) -> DateInRegion? {\n        style.toDate(self, region: region)\n\t}\n\n\tpublic func toISODate(_ options: ISOParser.Options? = nil, region: Region? = nil) -> DateInRegion? {\n        ISOParser.parse(self, region: region, options: options)\n\t}\n\n\tpublic func toDotNETDate(region: Region = Region.ISO) -> DateInRegion? {\n        DOTNETParser.parse(self, region: region, options: nil)\n\t}\n\n\tpublic func toRSSDate(alt: Bool, region: Region = Region.ISO) -> DateInRegion? {\n\t\tswitch alt {\n\t\tcase true: \treturn StringToDateStyles.altRSS.toDate(self, region: region)\n\t\tcase false: return StringToDateStyles.rss.toDate(self, region: region)\n\t\t}\n\t}\n\n\tpublic func toSQLDate(region: Region = Region.ISO) -> DateInRegion? {\n        StringToDateStyles.sql.toDate(self, region: region)\n\t}\n\t\n\tpublic func asLocale() -> Locale {\n        Locale(identifier: self)\n    }\n    \n}\n"
  },
  {
    "path": "Sources/SwiftDate/Foundation+Extras/TimeInterval+Formatter.swift",
    "content": "//\n//  SwiftDate\n//  Parse, validate, manipulate, and display dates, time and timezones in Swift\n//\n//  Created by Daniele Margutti\n//   - Web: https://www.danielemargutti.com\n//   - Twitter: https://twitter.com/danielemargutti\n//   - Mail: hello@danielemargutti.com\n//\n//  Copyright © 2019 Daniele Margutti. Licensed under MIT License.\n//\n\nimport Foundation\n\npublic extension TimeInterval {\n\n\tstruct ComponentsFormatterOptions {\n\n\t\t/// Fractional units may be used when a value cannot be exactly represented using the available units.\n\t\t/// For example, if minutes are not allowed, the value “1h 30m” could be formatted as “1.5h”.\n\t\tpublic var allowsFractionalUnits: Bool?\n\n\t\t/// Specify the units that can be used in the output.\n\t\tpublic var allowedUnits: NSCalendar.Unit?\n\n\t\t/// A Boolean value indicating whether to collapse the largest unit into smaller units when a certain threshold is met.\n\t\tpublic var collapsesLargestUnit: Bool?\n\n\t\t/// The maximum number of time units to include in the output string.\n\t\t/// If 0 does not cause the elimination of any units.\n\t\tpublic var maximumUnitCount: Int?\n\n\t\t/// The formatting style for units whose value is 0.\n\t\tpublic var zeroFormattingBehavior: DateComponentsFormatter.ZeroFormattingBehavior?\n\n\t\t/// The preferred style for units.\n\t\tpublic var unitsStyle: DateComponentsFormatter.UnitsStyle?\n\n\t\t/// Locale of the formatter\n\t\tpublic var locale: LocaleConvertible? {\n\t\t\tset { calendar.locale = newValue?.toLocale() }\n\t\t\tget { return calendar.locale }\n\t\t}\n\n\t\t/// Calendar\n        public var calendar = Calendar.autoupdatingCurrent\n\n\t\tpublic func apply(toFormatter formatter: DateComponentsFormatter) {\n            formatter.calendar = calendar\n\n            if let allowsFractionalUnits = self.allowsFractionalUnits {\n                formatter.allowsFractionalUnits = allowsFractionalUnits\n            }\n            if let allowedUnits = self.allowedUnits {\n                formatter.allowedUnits = allowedUnits\n            }\n            if let collapsesLargestUnit = self.collapsesLargestUnit {\n                formatter.collapsesLargestUnit = collapsesLargestUnit\n            }\n            if let maximumUnitCount = self.maximumUnitCount {\n                formatter.maximumUnitCount = maximumUnitCount\n            }\n            if let zeroFormattingBehavior = self.zeroFormattingBehavior {\n                formatter.zeroFormattingBehavior = zeroFormattingBehavior\n            }\n            if let unitsStyle = self.unitsStyle {\n                formatter.unitsStyle = unitsStyle\n            }\n\t\t}\n\n\t\tpublic init() {}\n\t}\n\n\t/// Return the local thread shared formatter for date components\n\tprivate static func sharedFormatter() -> DateComponentsFormatter {\n\t\tlet name = \"SwiftDate_\\(NSStringFromClass(DateComponentsFormatter.self))\"\n\t\treturn threadSharedObject(key: name, create: {\n\t\t\tlet formatter = DateComponentsFormatter()\n\t\t\tformatter.includesApproximationPhrase = false\n\t\t\tformatter.includesTimeRemainingPhrase = false\n\t\t\treturn formatter\n\t\t})\n\t}\n\n\t//@available(*, deprecated: 5.0.13, obsoleted: 5.1, message: \"Use toIntervalString function instead\")\n\tfunc toString(options callback: ((inout ComponentsFormatterOptions) -> Void)? = nil) -> String {\n\t\treturn self.toIntervalString(options: callback)\n\t}\n\n\t/// Format a time interval in a string with desidered components with passed style.\n\t///\n\t/// - Parameters:\n\t///   - units: units to include in string.\n\t///   - style: style of the units, by default is `.abbreviated`\n\t/// - Returns: string representation\n\tfunc toIntervalString(options callback: ((inout ComponentsFormatterOptions) -> Void)? = nil) -> String {\n\t\tlet formatter = DateComponentsFormatter()\n\t\tvar options = ComponentsFormatterOptions()\n\t\tcallback?(&options)\n\t\toptions.apply(toFormatter: formatter)\n\n        let formattedValue = (formatter.string(from: self) ?? \"\")\n        if options.zeroFormattingBehavior?.contains(.pad) ?? false {\n            // for some strange reason padding is not added at the very beginning positional item.\n            // we'll add it manually if necessaru\n            if let index = formattedValue.firstIndex(of: \":\"), index.utf16Offset(in: formattedValue) < 2 {\n                return \"0\\(formattedValue)\"\n            }\n        }\n        return formattedValue\n\t}\n\n\t/// Format a time interval in a string with desidered components with passed style.\n\t///\n\t/// - Parameter options: options for formatting.\n\t/// - Returns: string representation\n\tfunc toString(options: ComponentsFormatterOptions) -> String {\n\t\tlet formatter = TimeInterval.sharedFormatter()\n\t\toptions.apply(toFormatter: formatter)\n\t\treturn (formatter.string(from: self) ?? \"\")\n\t}\n\n\t/// Return a string representation of the time interval in form of clock countdown (ie. 57:00:00)\n\t///\n\t/// - Parameter zero: behaviour with zero.\n\t/// - Returns: string representation\n\tfunc toClock(zero: DateComponentsFormatter.ZeroFormattingBehavior =  [.pad, .dropLeading]) -> String {\n\t\treturn toIntervalString(options: {\n            $0.collapsesLargestUnit = true\n            $0.maximumUnitCount = 0\n\t\t\t$0.unitsStyle = .positional\n            $0.locale = Locales.englishUnitedStatesComputer\n\t\t\t$0.zeroFormattingBehavior = zero\n\t\t})\n\t}\n\n\t/// Extract requeste time units components from given interval.\n\t/// Reference date's calendar is used to make the extraction.\n\t///\n\t/// NOTE:\n\t///\t\tExtraction is calendar/date based; if you specify a `refDate` calculation is made\n\t/// \tbetween the `refDate` and `refDate + interval`.\n\t/// \tIf `refDate` is `nil` evaluation is made from `now()` and `now() + interval` in the context\n\t/// \tof the `SwiftDate.defaultRegion` set.\n\t///\n\t/// - Parameters:\n\t///   - units: units to extract\n\t///   - from: starting reference date, `nil` means `now()` in the context of the default region set.\n\t/// - Returns: dictionary with extracted components\n\tfunc toUnits(_ units: Set<Calendar.Component>, to refDate: DateInRegion? = nil) -> [Calendar.Component: Int] {\n\t\tlet dateTo = (refDate ?? DateInRegion())\n\t\tlet dateFrom = dateTo.addingTimeInterval(-self)\n\t\tlet components = dateFrom.calendar.dateComponents(units, from: dateFrom.date, to: dateTo.date)\n\t\treturn components.toDict()\n\t}\n\n\t/// Express a time interval (expressed in seconds) in another time unit you choose.\n\t/// Reference date's calendar is used to make the extraction.\n\t///\n\t/// - parameter component: time unit in which you want to express the calendar component\n\t/// - parameter from: starting reference date, `nil` means `now()` in the context of the default region set.\n\t///\n\t/// - returns: the value of interval expressed in selected `Calendar.Component`\n\tfunc toUnit(_ component: Calendar.Component, to refDate: DateInRegion? = nil) -> Int? {\n        toUnits([component], to: refDate)[component]\n\t}\n\n}\n"
  },
  {
    "path": "Sources/SwiftDate/Supports/AssociatedValues.swift",
    "content": "//\n//  SwiftDate\n//  Parse, validate, manipulate, and display dates, time and timezones in Swift\n//\n//  Created by Daniele Margutti\n//   - Web: https://www.danielemargutti.com\n//   - Twitter: https://twitter.com/danielemargutti\n//   - Mail: hello@danielemargutti.com\n//\n//  Copyright © 2019 Daniele Margutti. Licensed under MIT License.\n//\n\nimport Foundation\nimport ObjectiveC.runtime\n\ninternal func getAssociatedValue<T>(key: String, object: AnyObject) -> T? {\n    (objc_getAssociatedObject(object, key.address) as? AssociatedValue)?.value as? T\n}\n\ninternal func getAssociatedValue<T>(key: String, object: AnyObject, initialValue: @autoclosure () -> T) -> T {\n    getAssociatedValue(key: key, object: object) ?? setAndReturn(initialValue: initialValue(), key: key, object: object)\n}\n\ninternal func getAssociatedValue<T>(key: String, object: AnyObject, initialValue: () -> T) -> T {\n    getAssociatedValue(key: key, object: object) ?? setAndReturn(initialValue: initialValue(), key: key, object: object)\n}\n\nprivate func setAndReturn<T>(initialValue: T, key: String, object: AnyObject) -> T {\n\tset(associatedValue: initialValue, key: key, object: object)\n\treturn initialValue\n}\n\ninternal func set<T>(associatedValue: T?, key: String, object: AnyObject) {\n\tset(associatedValue: AssociatedValue(associatedValue), key: key, object: object)\n}\n\ninternal func set<T: AnyObject>(weakAssociatedValue: T?, key: String, object: AnyObject) {\n\tset(associatedValue: AssociatedValue(weak: weakAssociatedValue), key: key, object: object)\n}\n\nextension String {\n\n\tfileprivate var address: UnsafeRawPointer {\n\t\treturn UnsafeRawPointer(bitPattern: abs(hashValue))!\n\t}\n\n}\n\nprivate func set(associatedValue: AssociatedValue, key: String, object: AnyObject) {\n\tobjc_setAssociatedObject(object, key.address, associatedValue, .OBJC_ASSOCIATION_RETAIN_NONATOMIC)\n}\n\nprivate class AssociatedValue {\n\n\tweak var _weakValue: AnyObject?\n\tvar _value: Any?\n\n\tvar value: Any? {\n\t\treturn _weakValue ?? _value\n\t}\n\n\tinit(_ value: Any?) {\n\t\t_value = value\n\t}\n\n\tinit(weak: AnyObject?) {\n\t\t_weakValue = weak\n\t}\n\n}\n"
  },
  {
    "path": "Sources/SwiftDate/Supports/Calendars.swift",
    "content": "//\n//  SwiftDate\n//  Parse, validate, manipulate, and display dates, time and timezones in Swift\n//\n//  Created by Daniele Margutti\n//   - Web: https://www.danielemargutti.com\n//   - Twitter: https://twitter.com/danielemargutti\n//   - Mail: hello@danielemargutti.com\n//\n//  Copyright © 2019 Daniele Margutti. Licensed under MIT License.\n//\n\nimport Foundation\n\npublic typealias Calendars = Calendar.Identifier\n\npublic protocol CalendarConvertible {\n\tfunc toCalendar() -> Calendar\n}\n\nextension Calendar: CalendarConvertible {\n\n\tpublic func toCalendar() -> Calendar {\n\t\treturn self\n\t}\n\n\tinternal static func newCalendar(_ calendar: CalendarConvertible, configure: ((inout Calendar) -> Void)? = nil) -> Calendar {\n\t\tvar cal = calendar.toCalendar()\n\t\tconfigure?(&cal)\n\t\treturn cal\n\t}\n\n}\n\nextension Calendar.Identifier: CalendarConvertible {\n\n\tpublic func toCalendar() -> Calendar {\n\t\treturn Calendar(identifier: self)\n\t}\n\n}\n\n// MARK: - Support for Calendar.Identifier encoding with Codable\n\nextension Calendar.Identifier: CustomStringConvertible {\n\n\tpublic var description: String {\n\t\tswitch self {\n\t\tcase .gregorian:\t\t\treturn \"gregorian\"\n\t\tcase .buddhist:\t\t\t\treturn \"buddhist\"\n\t\tcase .chinese:\t\t\t\treturn \"chinese\"\n\t\tcase .coptic:\t\t\t\treturn \"coptic\"\n\t\tcase .ethiopicAmeteMihret:\treturn \"ethiopicAmeteMihret\"\n\t\tcase .ethiopicAmeteAlem:\treturn \"ethiopicAmeteAlem\"\n\t\tcase .hebrew:\t\t\t\treturn \"hebrew\"\n\t\tcase .iso8601:\t\t\t\treturn \"iso8601\"\n\t\tcase .indian:\t\t\t\treturn \"indian\"\n\t\tcase .islamic:\t\t\t\treturn \"islamic\"\n\t\tcase .islamicCivil:\t\t\treturn \"islamicCivil\"\n\t\tcase .japanese:\t\t\t\treturn \"japanese\"\n\t\tcase .persian:\t\t\t\treturn \"persian\"\n\t\tcase .republicOfChina:\t\treturn \"republicOfChina\"\n\t\tcase .islamicTabular:\t\treturn \"islamicTabular\"\n\t\tcase .islamicUmmAlQura:\t\treturn \"islamicUmmAlQura\"\n\t\t@unknown default:\n\t\t\tfatalError(\"Unsupported calendar \\(self)\")\n\t\t}\n\t}\n\n\tpublic init(_ rawValue: String) {\n\t\tswitch rawValue {\n\t\tcase Calendar.Identifier.gregorian.description:\t\t\t\tself = .gregorian\n\t\tcase Calendar.Identifier.buddhist.description:\t\t\t\tself = .buddhist\n\t\tcase Calendar.Identifier.chinese.description:\t\t\t\tself = .chinese\n\t\tcase Calendar.Identifier.coptic.description:\t\t\t\tself = .coptic\n\t\tcase Calendar.Identifier.ethiopicAmeteMihret.description:\tself = .ethiopicAmeteMihret\n\t\tcase Calendar.Identifier.ethiopicAmeteAlem.description:\t\tself = .ethiopicAmeteAlem\n\t\tcase Calendar.Identifier.hebrew.description:\t\t\t\tself = .hebrew\n\t\tcase Calendar.Identifier.iso8601.description:\t\t\t\tself = .iso8601\n\t\tcase Calendar.Identifier.indian.description:\t\t\t\tself = .indian\n\t\tcase Calendar.Identifier.islamic.description:\t\t\t\tself = .islamic\n\t\tcase Calendar.Identifier.islamicCivil.description:\t\t\tself = .islamicCivil\n\t\tcase Calendar.Identifier.japanese.description:\t\t\t\tself = .japanese\n\t\tcase Calendar.Identifier.persian.description:\t\t\t\tself = .persian\n\t\tcase Calendar.Identifier.republicOfChina.description:\t\tself = .republicOfChina\n\t\tcase Calendar.Identifier.islamicTabular.description:\t\tself = .islamicTabular\n\t\tcase Calendar.Identifier.islamicTabular.description:\t\tself = .islamicTabular\n\t\tcase Calendar.Identifier.islamicUmmAlQura.description:\t\tself = .islamicUmmAlQura\n\t\tdefault:\n\t\t\tlet defaultCalendar = SwiftDate.defaultRegion.calendar.identifier\n\t\t\tdebugPrint(\"Calendar Identifier '\\(rawValue)' not recognized. Using default (\\(defaultCalendar))\")\n\t\t\tself = defaultCalendar\n\t\t}\n\t}\n\n}\n"
  },
  {
    "path": "Sources/SwiftDate/Supports/Commons.swift",
    "content": "//\n//  SwiftDate\n//  Parse, validate, manipulate, and display dates, time and timezones in Swift\n//\n//  Created by Daniele Margutti\n//   - Web: https://www.danielemargutti.com\n//   - Twitter: https://twitter.com/danielemargutti\n//   - Mail: hello@danielemargutti.com\n//\n//  Copyright © 2019 Daniele Margutti. Licensed under MIT License.\n//\n\nimport Foundation\n\n// MARK: - Atomic Variable Support\n\n@propertyWrapper\ninternal struct Atomic<Value> {\n    private let queue = DispatchQueue(label: \"com.vadimbulavin.atomic\")\n    private var value: Value\n\n    init(wrappedValue: Value) {\n        self.value = wrappedValue\n    }\n    \n    var wrappedValue: Value {\n        get {\n            return queue.sync { value }\n        }\n        set {\n            queue.sync { value = newValue }\n        }\n    }\n    \n}\n\n// MARK: - DateFormatter\n\npublic extension DateFormatter {\n\n\t/// Return the local thread shared formatter initialized with the configuration of the region passed.\n\t///\n\t/// - Parameters:\n\t///   - region: region used to pre-configure the cell.\n\t///   - format: optional format used to set the `dateFormat` property.\n\t/// - Returns: date formatter instance\n\tstatic func sharedFormatter(forRegion region: Region?, format: String? = nil) -> DateFormatter {\n\t\tlet name = \"SwiftDate_\\(NSStringFromClass(DateFormatter.self))\"\n\t\tlet formatter: DateFormatter = threadSharedObject(key: name, create: { return DateFormatter() })\n\t\tif let region = region {\n\t\t\tformatter.timeZone = region.timeZone\n\t\t\tformatter.calendar = region.calendar\n\t\t\tformatter.locale = region.locale\n\t\t}\n\t\tformatter.dateFormat = (format ?? DateFormats.iso8601)\n\t\treturn formatter\n\t}\n\n\t/// Returned number formatter instance shared along calling thread to format ordinal numbers.\n\t///\n\t/// - Parameter locale: locale to set\n\t/// - Returns: number formatter instance\n\t@available(iOS 9.0, macOS 10.11, *)\n\tstatic func sharedOrdinalNumberFormatter(locale: LocaleConvertible) -> NumberFormatter {\n\t\tlet name = \"SwiftDate_\\(NSStringFromClass(NumberFormatter.self))\"\n\t\tlet formatter = threadSharedObject(key: name, create: { return NumberFormatter() })\n\t\tformatter.numberStyle = .ordinal\n\t\tformatter.locale = locale.toLocale()\n\t\treturn formatter\n\t}\n\n}\n\n/// This function create (if necessary) and return a thread singleton instance of the\n/// object you want.\n///\n/// - Parameters:\n///   - key: identifier of the object.\n///   - create: create routine used the first time you are about to create the object in thread.\n/// - Returns: instance of the object for caller's thread.\ninternal func threadSharedObject<T: AnyObject>(key: String, create: () -> T) -> T {\n\tif let cachedObj = Thread.current.threadDictionary[key] as? T {\n\t\treturn cachedObj\n\t} else {\n\t\tlet newObject = create()\n\t\tThread.current.threadDictionary[key] = newObject\n\t\treturn newObject\n\t}\n}\n\n/// Style used to format month, weekday, quarter symbols.\n/// Stand-alone properties are for use in places like calendar headers.\n/// Non-stand-alone properties are for use in context (for example, “Saturday, November 12th”).\n///\n/// - `default`: Default formatter (ie. `4th quarter` for quarter, `April` for months and `Wednesday` for weekdays)\n/// - defaultStandalone:  See `default`; See `short`; stand-alone properties are for use in places like calendar headers.\n/// - short: Short symbols (ie. `Jun` for months, `Fri` for weekdays, `Q1` for quarters).\n/// - veryShort: Very short symbols (ie. `J` for months, `F` for weekdays, for quarter it just return `short` variant).\n/// - standaloneShort: See `short`; stand-alone properties are for use in places like calendar headers.\n/// - standaloneVeryShort: See `veryShort`; stand-alone properties are for use in places like calendar headers.\npublic enum SymbolFormatStyle {\n\tcase `default`\n\tcase defaultStandalone\n\tcase short\n\tcase veryShort\n\tcase standaloneShort\n\tcase standaloneVeryShort\n}\n\n/// Encapsulate the logic to use date format strings\npublic struct DateFormats {\n\n\t/// This is the built-in list of all supported formats for auto-parsing of a string to a date.\n\tinternal static let builtInAutoFormat: [String] =  [\n\t\tDateFormats.iso8601,\n\t\t\"yyyy'-'MM'-'dd'T'HH':'mm':'ssZ\",\n\t\t\"yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'SSSZ\",\n\t\t\"yyyy-MM-dd'T'HH:mm:ss.SSSZ\",\n\t\t\"yyyy-MM-dd HH:mm:ss\",\n\t\t\"yyyy-MM-dd HH:mm\",\n\t\t\"yyyy-MM-dd\",\n\t\t\"h:mm:ss A\",\n\t\t\"h:mm A\",\n\t\t\"MM/dd/yyyy\",\n\t\t\"MMMM d, yyyy\",\n\t\t\"MMMM d, yyyy LT\",\n\t\t\"dddd, MMMM D, yyyy LT\",\n\t\t\"yyyyyy-MM-dd\",\n\t\t\"yyyy-MM-dd\",\n\t\t\"yyyy-'W'ww-E\",\n\t\t\"GGGG-'['W']'ww-E\",\n\t\t\"yyyy-'W'ww\",\n\t\t\"GGGG-'['W']'ww\",\n\t\t\"yyyy'W'ww\",\n\t\t\"yyyy-ddd\",\n\t\t\"HH:mm:ss.SSSS\",\n\t\t\"HH:mm:ss\",\n\t\t\"HH:mm\",\n\t\t\"HH\"\n\t]\n\n\t/// This is the ordered list of all formats SwiftDate can use in order to attempt parsing a passaed\n\t/// date expressed as string. Evaluation is made in order; you can add or remove new formats as you wish.\n\t/// In order to reset the list call `resetAutoFormats()` function.\n\tpublic static var autoFormats: [String] = DateFormats.builtInAutoFormat\n\n\t/// Default ISO8601 format string\n\tpublic static let iso8601: String = \"yyyy-MM-dd'T'HH:mm:ssZZZZZ\"\n\n\t/// Extended format\n\tpublic static let extended: String = \"eee dd-MMM-yyyy GG HH:mm:ss.SSS zzz\"\n\n\t/// The Alternative RSS formatted date \"d MMM yyyy HH:mm:ss ZZZ\" i.e. \"09 Sep 2011 15:26:08 +0200\"\n\tpublic static let altRSS: String = \"d MMM yyyy HH:mm:ss ZZZ\"\n\n\t/// The RSS formatted date \"EEE, d MMM yyyy HH:mm:ss ZZZ\" i.e. \"Fri, 09 Sep 2011 15:26:08 +0200\"\n\tpublic static let rss: String = \"EEE, d MMM yyyy HH:mm:ss ZZZ\"\n\n\t/// The http header formatted date \"EEE, dd MMM yyyy HH:mm:ss zzz\" i.e. \"Tue, 15 Nov 1994 12:45:26 GMT\"\n\tpublic static let httpHeader: String = \"EEE, dd MMM yyyy HH:mm:ss zzz\"\n\n\t/// A generic standard format date i.e. \"EEE MMM dd HH:mm:ss Z yyyy\"\n\tpublic static let standard: String = \"EEE MMM dd HH:mm:ss Z yyyy\"\n\n\t/// SQL date format\n\tpublic static let sql: String = \"yyyy-MM-dd'T'HH:mm:ss.SSSX\"\n\n\t/// Reset the list of auto formats to the initial settings.\n\tpublic static func resetAutoFormats() {\n\t\tautoFormats = DateFormats.builtInAutoFormat\n\t}\n\n\t/// Parse a new string optionally passing the format in which is encoded. If no format is passed\n\t/// an attempt is made by cycling all the formats set in `autoFormats` property.\n\t///\n\t/// - Parameters:\n\t///   - string: date expressed as string.\n\t///   - suggestedFormat: optional format of the date expressed by the string (set it if you can in order to optimize the parse task).\n\t///   - region: region in which the date is expressed.\n\t/// - Returns: parsed absolute `Date`, `nil` if parse fails.\n\tpublic static func parse(string: String, format: String?, region: Region) -> Date? {\n\t\tlet formats = (format != nil ? [format!] : DateFormats.autoFormats)\n\t\treturn DateFormats.parse(string: string, formats: formats, region: region)\n\t}\n\n\tpublic static func parse(string: String, formats: [String], region: Region) -> Date? {\n\t\tlet formatter = DateFormatter.sharedFormatter(forRegion: region)\n\n\t\tvar parsedDate: Date?\n\t\tfor format in formats {\n\t\t\tformatter.dateFormat = format\n\t\t\tformatter.locale = region.locale\n\t\t\tif let date = formatter.date(from: string) {\n\t\t\t\tparsedDate = date\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\treturn parsedDate\n\t}\n}\n\n// MARK: - Calendar Extension\n\npublic extension Calendar.Component {\n\n\tinternal static func toSet(_ src: [Calendar.Component]) -> Set<Calendar.Component> {\n\t\tvar l: Set<Calendar.Component> = []\n\t\tsrc.forEach { l.insert($0) }\n\t\treturn l\n\t}\n\n\tinternal var nsCalendarUnit: NSCalendar.Unit {\n\t\tswitch self {\n\t\tcase .era: return NSCalendar.Unit.era\n\t\tcase .year: return NSCalendar.Unit.year\n\t\tcase .month: return NSCalendar.Unit.month\n\t\tcase .day: return NSCalendar.Unit.day\n\t\tcase .hour: return NSCalendar.Unit.hour\n\t\tcase .minute: return NSCalendar.Unit.minute\n\t\tcase .second: return NSCalendar.Unit.second\n\t\tcase .weekday: return NSCalendar.Unit.weekday\n\t\tcase .weekdayOrdinal: return NSCalendar.Unit.weekdayOrdinal\n\t\tcase .quarter: return NSCalendar.Unit.quarter\n\t\tcase .weekOfMonth: return NSCalendar.Unit.weekOfMonth\n\t\tcase .weekOfYear: return NSCalendar.Unit.weekOfYear\n\t\tcase .yearForWeekOfYear: return NSCalendar.Unit.yearForWeekOfYear\n\t\tcase .nanosecond: return NSCalendar.Unit.nanosecond\n\t\tcase .calendar: return NSCalendar.Unit.calendar\n\t\tcase .timeZone: return NSCalendar.Unit.timeZone\n\t\t@unknown default:\n\t\t\tfatalError(\"Unsupported type \\(self)\")\n\t\t}\n\t}\n}\n\n/// Rounding mode for dates.\n/// Round off/up (ceil) or down (floor) target date.\npublic enum RoundDateMode {\n\tcase to5Mins\n\tcase to10Mins\n\tcase to30Mins\n\tcase toMins(_: Int)\n\tcase toCeil5Mins\n\tcase toCeil10Mins\n\tcase toCeil30Mins\n\tcase toCeilMins(_: Int)\n\tcase toFloor5Mins\n\tcase toFloor10Mins\n\tcase toFloor30Mins\n\tcase toFloorMins(_: Int)\n}\n\n/// Related type enum to get derivated date from a receiver date.\npublic enum DateRelatedType {\n\tcase startOfDay\n\tcase endOfDay\n\tcase startOfWeek\n\tcase endOfWeek\n\tcase startOfMonth\n\tcase endOfMonth\n\tcase tomorrow\n\tcase tomorrowAtStart\n\tcase yesterday\n\tcase yesterdayAtStart\n\tcase nearestMinute(minute: Int)\n\tcase nearestHour(hour :Int)\n\tcase nextWeekday(_: WeekDay)\n\tcase nextDSTDate\n\tcase prevMonth\n\tcase nextMonth\n\tcase prevWeek\n\tcase nextWeek\n\tcase nextYear\n\tcase prevYear\n\tcase nextDSTTransition\n}\n\npublic struct TimeCalculationOptions {\n\n\t/// Specifies the technique the search algorithm uses to find result\n\tpublic var matchingPolicy: Calendar.MatchingPolicy\n\n\t/// Specifies the behavior when multiple matches are found\n\tpublic var repeatedTimePolicy: Calendar.RepeatedTimePolicy\n\n\t/// Specifies the direction in time to search\n\tpublic var direction: Calendar.SearchDirection\n\n\tpublic init(matching: Calendar.MatchingPolicy = .nextTime,\n\t\t\t\ttimePolicy: Calendar.RepeatedTimePolicy = .first,\n\t\t\t\tdirection: Calendar.SearchDirection = .forward) {\n\t\tself.matchingPolicy = matching\n\t\tself.repeatedTimePolicy = timePolicy\n\t\tself.direction = direction\n\t}\n}\n\n// MARK: - compactMap for Swift 4.0 (not necessary > 4.0)\n\n#if swift(>=4.1)\n#else\n\textension Collection {\n\t\tfunc compactMap<ElementOfResult>(\n\t\t\t_ transform: (Element) throws -> ElementOfResult?\n\t\t\t) rethrows -> [ElementOfResult] {\n\t\t\treturn try flatMap(transform)\n\t\t}\n\t}\n#endif\n\n// MARK: - Foundation Bundle\n\nprivate class BundleFinder {}\n\nextension Foundation.Bundle {\n    \n    /// Returns the resource bundle associated with the current Swift module.\n    /// This is used instead of `module` to allows compatibility outside the SwiftPM environment (ie. CocoaPods).\n    static var appModule: Bundle? = {\n        let bundleName = \"SwiftDate_SwiftDate\"\n\n        let candidates = [\n            // Bundle should be present here when the package is linked into an App.\n            Bundle.main.resourceURL,\n\n            // Bundle should be present here when the package is linked into a framework.\n            Bundle(for: BundleFinder.self).resourceURL,\n\n            // For command-line tools.\n            Bundle.main.bundleURL,\n        ]\n\n        for candidate in candidates {\n            let bundlePath = candidate?.appendingPathComponent(bundleName + \".bundle\")\n            if let bundle = bundlePath.flatMap(Bundle.init(url:)) {\n                return bundle\n            }\n        }\n        \n        return nil\n    }()\n    \n}\n"
  },
  {
    "path": "Sources/SwiftDate/Supports/Locales.swift",
    "content": "//\n//  SwiftDate\n//  Parse, validate, manipulate, and display dates, time and timezones in Swift\n//\n//  Created by Daniele Margutti\n//   - Web: https://www.danielemargutti.com\n//   - Twitter: https://twitter.com/danielemargutti\n//   - Mail: hello@danielemargutti.com\n//\n//  Copyright © 2019 Daniele Margutti. Licensed under MIT License.\n//\n\n// swiftlint:disable file_length\n\nimport Foundation\n\npublic protocol LocaleConvertible {\n\tfunc toLocale() -> Locale\n}\n\nextension Locale: LocaleConvertible {\n\tpublic func toLocale() -> Locale {\n\t\treturn self\n\t}\n}\n\n// swiftlint:disable type_body_length\npublic enum Locales: String, LocaleConvertible {\n\n\tcase current = \"current\"\n\tcase autoUpdating = \"currentAutoUpdating\"\n\n\tcase afrikaans = \"af\"\n\tcase afrikaansNamibia = \"af_NA\"\n\tcase afrikaansSouthAfrica = \"af_ZA\"\n\tcase aghem = \"agq\"\n\tcase aghemCameroon = \"agq_CM\"\n\tcase akan = \"ak\"\n\tcase akanGhana = \"ak_GH\"\n\tcase albanian = \"sq\"\n\tcase albanianAlbania = \"sq_AL\"\n\tcase albanianKosovo = \"sq_XK\"\n\tcase albanianMacedonia = \"sq_MK\"\n\tcase amharic = \"am\"\n\tcase amharicEthiopia = \"am_ET\"\n\tcase arabic = \"ar\"\n\tcase arabicAlgeria = \"ar_DZ\"\n\tcase arabicBahrain = \"ar_BH\"\n\tcase arabicChad = \"ar_TD\"\n\tcase arabicComoros = \"ar_KM\"\n\tcase arabicDjibouti = \"ar_DJ\"\n\tcase arabicEgypt = \"ar_EG\"\n\tcase arabicEritrea = \"ar_ER\"\n\tcase arabicIraq = \"ar_IQ\"\n\tcase arabicIsrael = \"ar_IL\"\n\tcase arabicJordan = \"ar_JO\"\n\tcase arabicKuwait = \"ar_KW\"\n\tcase arabicLebanon = \"ar_LB\"\n\tcase arabicLibya = \"ar_LY\"\n\tcase arabicMauritania = \"ar_MR\"\n\tcase arabicMorocco = \"ar_MA\"\n\tcase arabicOman = \"ar_OM\"\n\tcase arabicPalestinianTerritories = \"ar_PS\"\n\tcase arabicQatar = \"ar_QA\"\n\tcase arabicSaudiArabia = \"ar_SA\"\n\tcase arabicSomalia = \"ar_SO\"\n\tcase arabicSouthSudan = \"ar_SS\"\n\tcase arabicSudan = \"ar_SD\"\n\tcase arabicSyria = \"ar_SY\"\n\tcase arabicTunisia = \"ar_TN\"\n\tcase arabicUnitedArabEmirates = \"ar_AE\"\n\tcase arabicWesternSahara = \"ar_EH\"\n\tcase arabicWorld = \"ar_001\"\n\tcase arabicYemen = \"ar_YE\"\n\tcase armenian = \"hy\"\n\tcase armenianArmenia = \"hy_AM\"\n\tcase assamese = \"as\"\n\tcase assameseIndia = \"as_IN\"\n\tcase asu = \"asa\"\n\tcase asuTanzania = \"asa_TZ\"\n\tcase azerbaijani = \"az_Latn\"\n\tcase azerbaijaniAzerbaijan = \"az_Latn_AZ\"\n\tcase azerbaijaniCyrillic = \"az_Cyrl\"\n\tcase azerbaijaniCyrillicAzerbaijan = \"az_Cyrl_AZ\"\n\tcase bafia = \"ksf\"\n\tcase bafiaCameroon = \"ksf_CM\"\n\tcase bambara = \"bm_Latn\"\n\tcase bambaraMali = \"bm_Latn_ML\"\n\tcase basaa = \"bas\"\n\tcase basaaCameroon = \"bas_CM\"\n\tcase basque = \"eu\"\n\tcase basqueSpain = \"eu_ES\"\n\tcase belarusian = \"be\"\n\tcase belarusianBelarus = \"be_BY\"\n\tcase bemba = \"bem\"\n\tcase bembaZambia = \"bem_ZM\"\n\tcase bena = \"bez\"\n\tcase benaTanzania = \"bez_TZ\"\n\tcase bengali = \"bn\"\n\tcase bengaliBangladesh = \"bn_BD\"\n\tcase engaliIndia = \"bn_IN\"\n\tcase bodo = \"brx\"\n\tcase bodoIndia = \"brx_IN\"\n\tcase bosnian = \"bs_Latn\"\n\tcase bosnianBosniaHerzegovina = \"bs_Latn_BA\"\n\tcase bosnianCyrillic = \"bs_Cyrl\"\n\tcase bosnianCyrillicBosniaHerzegovina = \"bs_Cyrl_BA\"\n\tcase breton = \"br\"\n\tcase bretonFrance = \"br_FR\"\n\tcase bulgarian = \"bg\"\n\tcase bulgarianBulgaria = \"bg_BG\"\n\tcase burmese = \"my\"\n\tcase burmeseMyanmarBurma = \"my_MM\"\n\tcase catalan = \"ca\"\n\tcase catalanAndorra = \"ca_AD\"\n\tcase catalanFrance = \"ca_FR\"\n\tcase catalanItaly = \"ca_IT\"\n\tcase catalanSpain = \"ca_ES\"\n\tcase centralAtlasTamazight = \"tzm_Latn\"\n\tcase centralAtlasTamazightMorocco = \"tzm_Latn_MA\"\n\tcase centralKurdish = \"ckb\"\n\tcase centralKurdishIran = \"ckb_IR\"\n\tcase centralKurdishIraq = \"ckb_IQ\"\n\tcase cherokee = \"chr\"\n\tcase cherokeeUnitedStates = \"chr_US\"\n\tcase chiga = \"cgg\"\n\tcase chigaUganda = \"cgg_UG\"\n\tcase chinese = \"zh\"\n\tcase chineseChina = \"zh_Hans_CN\"\n\tcase chineseHongKongSarChina = \"zh_Hant_HK\"\n\tcase chineseMacauSarChina = \"zh_Hant_MO\"\n\tcase chineseSimplified = \"zh_Hans\"\n\tcase chineseSimplifiedHongKongSarChina = \"zh_Hans_HK\"\n\tcase chineseSimplifiedMacauSarChina = \"zh_Hans_MO\"\n\tcase chineseSingapore = \"zh_Hans_SG\"\n\tcase chineseTaiwan = \"zh_Hant_TW\"\n\tcase chineseTraditional = \"zh_Hant\"\n\tcase colognian = \"ksh\"\n\tcase colognianGermany = \"ksh_DE\"\n\tcase cornish = \"kw\"\n\tcase cornishUnitedKingdom = \"kw_GB\"\n\tcase croatian = \"hr\"\n\tcase croatianBosniaHerzegovina = \"hr_BA\"\n\tcase croatianCroatia = \"hr_HR\"\n\tcase czech = \"cs\"\n\tcase czechCzechRepublic = \"cs_CZ\"\n\tcase danish = \"da\"\n\tcase danishDenmark = \"da_DK\"\n\tcase danishGreenland = \"da_GL\"\n\tcase duala = \"dua\"\n\tcase dualaCameroon = \"dua_CM\"\n\tcase dutch = \"nl\"\n\tcase dutchAruba = \"nl_AW\"\n\tcase dutchBelgium = \"nl_BE\"\n\tcase dutchCaribbeanNetherlands = \"nl_BQ\"\n\tcase dutchCuraao = \"nl_CW\"\n\tcase dutchNetherlands = \"nl_NL\"\n\tcase dutchSintMaarten = \"nl_SX\"\n\tcase dutchSuriname = \"nl_SR\"\n\tcase dzongkha = \"dz\"\n\tcase dzongkhaBhutan = \"dz_BT\"\n\tcase embu = \"ebu\"\n\tcase embuKenya = \"ebu_KE\"\n\tcase english = \"en\"\n\tcase englishAlbania = \"en_AL\"\n\tcase englishAmericanSamoa = \"en_AS\"\n\tcase englishAndorra = \"en_AD\"\n\tcase englishAnguilla = \"en_AI\"\n\tcase englishAntiguaBarbuda = \"en_AG\"\n\tcase englishAustralia = \"en_AU\"\n\tcase englishAustria = \"en_AT\"\n\tcase englishBahamas = \"en_BS\"\n\tcase englishBarbados = \"en_BB\"\n\tcase englishBelgium = \"en_BE\"\n\tcase englishBelize = \"en_BZ\"\n\tcase englishBermuda = \"en_BM\"\n\tcase englishBosniaHerzegovina = \"en_BA\"\n\tcase englishBotswana = \"en_BW\"\n\tcase englishBritishIndianOceanTerritory = \"en_IO\"\n\tcase englishBritishVirginIslands = \"en_VG\"\n\tcase englishCameroon = \"en_CM\"\n\tcase englishCanada = \"en_CA\"\n\tcase englishCaymanIslands = \"en_KY\"\n\tcase englishChristmasIsland = \"en_CX\"\n\tcase englishCocosKeelingIslands = \"en_CC\"\n\tcase englishCookIslands = \"en_CK\"\n\tcase englishCroatia = \"en_HR\"\n\tcase englishCyprus = \"en_CY\"\n\tcase englishCzechRepublic = \"en_CZ\"\n\tcase englishDenmark = \"en_DK\"\n\tcase englishDiegoGarcia = \"en_DG\"\n\tcase englishDominica = \"en_DM\"\n\tcase englishEritrea = \"en_ER\"\n\tcase englishEstonia = \"en_EE\"\n\tcase englishEurope = \"en_150\"\n\tcase englishFalklandIslands = \"en_FK\"\n\tcase englishFiji = \"en_FJ\"\n\tcase englishFinland = \"en_FI\"\n\tcase englishFrance = \"en_FR\"\n\tcase englishGambia = \"en_GM\"\n\tcase englishGermany = \"en_DE\"\n\tcase englishGhana = \"en_GH\"\n\tcase englishGibraltar = \"en_GI\"\n\tcase englishGreece = \"en_GR\"\n\tcase englishGrenada = \"en_GD\"\n\tcase englishGuam = \"en_GU\"\n\tcase englishGuernsey = \"en_GG\"\n\tcase englishGuyana = \"en_GY\"\n\tcase englishHongKongSarChina = \"en_HK\"\n\tcase englishHungary = \"en_HU\"\n\tcase englishIceland = \"en_IS\"\n\tcase englishIndia = \"en_IN\"\n\tcase englishIreland = \"en_IE\"\n\tcase englishIsleOfMan = \"en_IM\"\n\tcase englishIsrael = \"en_IL\"\n\tcase englishItaly = \"en_IT\"\n\tcase englishJamaica = \"en_JM\"\n\tcase englishJersey = \"en_JE\"\n\tcase englishKenya = \"en_KE\"\n\tcase englishKiribati = \"en_KI\"\n\tcase englishLatvia = \"en_LV\"\n\tcase englishLesotho = \"en_LS\"\n\tcase englishLiberia = \"en_LR\"\n\tcase englishLithuania = \"en_LT\"\n\tcase englishLuxembourg = \"en_LU\"\n\tcase englishMacauSarChina = \"en_MO\"\n\tcase englishMadagascar = \"en_MG\"\n\tcase englishMalawi = \"en_MW\"\n\tcase englishMalaysia = \"en_MY\"\n\tcase englishMalta = \"en_MT\"\n\tcase englishMarshallIslands = \"en_MH\"\n\tcase englishMauritius = \"en_MU\"\n\tcase englishMicronesia = \"en_FM\"\n\tcase englishMontenegro = \"en_ME\"\n\tcase englishMontserrat = \"en_MS\"\n\tcase englishNamibia = \"en_NA\"\n\tcase englishNauru = \"en_NR\"\n\tcase englishNetherlands = \"en_NL\"\n\tcase englishNewZealand = \"en_NZ\"\n\tcase englishNigeria = \"en_NG\"\n\tcase englishNiue = \"en_NU\"\n\tcase englishNorfolkIsland = \"en_NF\"\n\tcase englishNorthernMarianaIslands = \"en_MP\"\n\tcase englishNorway = \"en_NO\"\n\tcase englishPakistan = \"en_PK\"\n\tcase englishPalau = \"en_PW\"\n\tcase englishPapuaNewGuinea = \"en_PG\"\n\tcase englishPhilippines = \"en_PH\"\n\tcase englishPitcairnIslands = \"en_PN\"\n\tcase englishPoland = \"en_PL\"\n\tcase englishPortugal = \"en_PT\"\n\tcase englishPuertoRico = \"en_PR\"\n\tcase englishRomania = \"en_RO\"\n\tcase englishRussia = \"en_RU\"\n\tcase englishRwanda = \"en_RW\"\n\tcase englishSamoa = \"en_WS\"\n\tcase englishSeychelles = \"en_SC\"\n\tcase englishSierraLeone = \"en_SL\"\n\tcase englishSingapore = \"en_SG\"\n\tcase englishSintMaarten = \"en_SX\"\n\tcase englishSlovakia = \"en_SK\"\n\tcase englishSlovenia = \"en_SI\"\n\tcase englishSolomonIslands = \"en_SB\"\n\tcase englishSouthAfrica = \"en_ZA\"\n\tcase englishSouthSudan = \"en_SS\"\n\tcase englishSpain = \"en_ES\"\n\tcase englishStHelena = \"en_SH\"\n\tcase englishStKittsNevis = \"en_KN\"\n\tcase englishStLucia = \"en_LC\"\n\tcase englishStVincentGrenadines = \"en_VC\"\n\tcase englishSudan = \"en_SD\"\n\tcase englishSwaziland = \"en_SZ\"\n\tcase englishSweden = \"en_SE\"\n\tcase englishSwitzerland = \"en_CH\"\n\tcase englishTanzania = \"en_TZ\"\n\tcase englishTokelau = \"en_TK\"\n\tcase englishTonga = \"en_TO\"\n\tcase englishTrinidadTobago = \"en_TT\"\n\tcase englishTurkey = \"en_TR\"\n\tcase englishTurksCaicosIslands = \"en_TC\"\n\tcase englishTuvalu = \"en_TV\"\n\tcase englishUSOutlyingIslands = \"en_UM\"\n\tcase englishUSVirginIslands = \"en_VI\"\n\tcase englishUganda = \"en_UG\"\n\tcase englishUnitedKingdom = \"en_GB\"\n\tcase englishUnitedStates = \"en_US\"\n\tcase englishUnitedStatesComputer = \"en_US_POSIX\"\n\tcase englishVanuatu = \"en_VU\"\n\tcase englishWorld = \"en_001\"\n\tcase englishZambia = \"en_ZM\"\n\tcase englishZimbabwe = \"en_ZW\"\n\tcase esperanto = \"eo\"\n\tcase estonian = \"et\"\n\tcase estonianEstonia = \"et_EE\"\n\tcase ewe = \"ee\"\n\tcase eweGhana = \"ee_GH\"\n\tcase eweTogo = \"ee_TG\"\n\tcase ewondo = \"ewo\"\n\tcase ewondoCameroon = \"ewo_CM\"\n\tcase faroese = \"fo\"\n\tcase faroeseFaroeIslands = \"fo_FO\"\n\tcase filipino = \"fil\"\n\tcase filipinoPhilippines = \"fil_PH\"\n\tcase finnish = \"fi\"\n\tcase finnishFinland = \"fi_FI\"\n\tcase french = \"fr\"\n\tcase frenchAlgeria = \"fr_DZ\"\n\tcase frenchBelgium = \"fr_BE\"\n\tcase frenchBenin = \"fr_BJ\"\n\tcase frenchBurkinaFaso = \"fr_BF\"\n\tcase frenchBurundi = \"fr_BI\"\n\tcase frenchCameroon = \"fr_CM\"\n\tcase frenchCanada = \"fr_CA\"\n\tcase frenchCentralAfricanRepublic = \"fr_CF\"\n\tcase frenchChad = \"fr_TD\"\n\tcase frenchComoros = \"fr_KM\"\n\tcase frenchCongoBrazzaville = \"fr_CG\"\n\tcase frenchCongoKinshasa = \"fr_CD\"\n\tcase frenchCteDivoire = \"fr_CI\"\n\tcase frenchDjibouti = \"fr_DJ\"\n\tcase frenchEquatorialGuinea = \"fr_GQ\"\n\tcase frenchFrance = \"fr_FR\"\n\tcase frenchFrenchGuiana = \"fr_GF\"\n\tcase frenchFrenchPolynesia = \"fr_PF\"\n\tcase frenchGabon = \"fr_GA\"\n\tcase frenchGuadeloupe = \"fr_GP\"\n\tcase frenchGuinea = \"fr_GN\"\n\tcase frenchHaiti = \"fr_HT\"\n\tcase frenchLuxembourg = \"fr_LU\"\n\tcase frenchMadagascar = \"fr_MG\"\n\tcase frenchMali = \"fr_ML\"\n\tcase frenchMartinique = \"fr_MQ\"\n\tcase frenchMauritania = \"fr_MR\"\n\tcase frenchMauritius = \"fr_MU\"\n\tcase frenchMayotte = \"fr_YT\"\n\tcase frenchMonaco = \"fr_MC\"\n\tcase frenchMorocco = \"fr_MA\"\n\tcase frenchNewCaledonia = \"fr_NC\"\n\tcase frenchNiger = \"fr_NE\"\n\tcase frenchRunion = \"fr_RE\"\n\tcase frenchRwanda = \"fr_RW\"\n\tcase frenchSenegal = \"fr_SN\"\n\tcase frenchSeychelles = \"fr_SC\"\n\tcase frenchStBarthlemy = \"fr_BL\"\n\tcase frenchStMartin = \"fr_MF\"\n\tcase frenchStPierreMiquelon = \"fr_PM\"\n\tcase frenchSwitzerland = \"fr_CH\"\n\tcase frenchSyria = \"fr_SY\"\n\tcase frenchTogo = \"fr_TG\"\n\tcase frenchTunisia = \"fr_TN\"\n\tcase frenchVanuatu = \"fr_VU\"\n\tcase frenchWallisFutuna = \"fr_WF\"\n\tcase friulian = \"fur\"\n\tcase friulianItaly = \"fur_IT\"\n\tcase fulah = \"ff\"\n\tcase fulahCameroon = \"ff_CM\"\n\tcase fulahGuinea = \"ff_GN\"\n\tcase fulahMauritania = \"ff_MR\"\n\tcase fulahSenegal = \"ff_SN\"\n\tcase galician = \"gl\"\n\tcase galicianSpain = \"gl_ES\"\n\tcase ganda = \"lg\"\n\tcase gandaUganda = \"lg_UG\"\n\tcase georgian = \"ka\"\n\tcase georgianGeorgia = \"ka_GE\"\n\tcase german = \"de\"\n\tcase germanAustria = \"de_AT\"\n\tcase germanBelgium = \"de_BE\"\n\tcase germanGermany = \"de_DE\"\n\tcase germanLiechtenstein = \"de_LI\"\n\tcase germanLuxembourg = \"de_LU\"\n\tcase germanSwitzerland = \"de_CH\"\n\tcase greek = \"el\"\n\tcase greekCyprus = \"el_CY\"\n\tcase greekGreece = \"el_GR\"\n\tcase gujarati = \"gu\"\n\tcase gujaratiIndia = \"gu_IN\"\n\tcase gusii = \"guz\"\n\tcase gusiiKenya = \"guz_KE\"\n\tcase hausa = \"ha_Latn\"\n\tcase hausaGhana = \"ha_Latn_GH\"\n\tcase hausaNiger = \"ha_Latn_NE\"\n\tcase hausaNigeria = \"ha_Latn_NG\"\n\tcase hawaiian = \"haw\"\n\tcase hawaiianUnitedStates = \"haw_US\"\n\tcase hebrew = \"he\"\n\tcase hebrewIsrael = \"he_IL\"\n\tcase hindi = \"hi\"\n\tcase hindiIndia = \"hi_IN\"\n\tcase hungarian = \"hu\"\n\tcase hungarianHungary = \"hu_HU\"\n\tcase icelandic = \"is\"\n\tcase icelandicIceland = \"is_IS\"\n\tcase igbo = \"ig\"\n\tcase igboNigeria = \"ig_NG\"\n\tcase inariSami = \"smn\"\n\tcase inariSamiFinland = \"smn_FI\"\n\tcase indonesian = \"id\"\n\tcase indonesianIndonesia = \"id_ID\"\n\tcase inuktitut = \"iu\"\n\tcase inuktitutUnifiedCanadianAboriginalSyllabics = \"iu_Cans\"\n\tcase inuktitutUnifiedCanadianAboriginalSyllabicsCanada = \"iu_Cans_CA\"\n\tcase irish = \"ga\"\n\tcase irishIreland = \"ga_IE\"\n\tcase italian = \"it\"\n\tcase italianItaly = \"it_IT\"\n\tcase italianSanMarino = \"it_SM\"\n\tcase italianSwitzerland = \"it_CH\"\n\tcase japanese = \"ja\"\n\tcase japaneseJapan = \"ja_JP\"\n\tcase jolaFonyi = \"dyo\"\n\tcase jolaFonyiSenegal = \"dyo_SN\"\n\tcase kabuverdianu = \"kea\"\n\tcase kabuverdianuCapeVerde = \"kea_CV\"\n\tcase kabyle = \"kab\"\n\tcase kabyleAlgeria = \"kab_DZ\"\n\tcase kako = \"kkj\"\n\tcase kakoCameroon = \"kkj_CM\"\n\tcase kalaallisut = \"kl\"\n\tcase kalaallisutGreenland = \"kl_GL\"\n\tcase kalenjin = \"kln\"\n\tcase kalenjinKenya = \"kln_KE\"\n\tcase kamba = \"kam\"\n\tcase kambaKenya = \"kam_KE\"\n\tcase kannada = \"kn\"\n\tcase kannadaIndia = \"kn_IN\"\n\tcase kashmiri = \"ks\"\n\tcase kashmiriArabic = \"ks_Arab\"\n\tcase kashmiriArabicIndia = \"ks_Arab_IN\"\n\tcase kazakh = \"kk_Cyrl\"\n\tcase kazakhKazakhstan = \"kk_Cyrl_KZ\"\n\tcase khmer = \"km\"\n\tcase khmerCambodia = \"km_KH\"\n\tcase kikuyu = \"ki\"\n\tcase kikuyuKenya = \"ki_KE\"\n\tcase kinyarwanda = \"rw\"\n\tcase kinyarwandaRwanda = \"rw_RW\"\n\tcase konkani = \"kok\"\n\tcase konkaniIndia = \"kok_IN\"\n\tcase korean = \"ko\"\n\tcase koreanNorthKorea = \"ko_KP\"\n\tcase koreanSouthKorea = \"ko_KR\"\n\tcase koyraChiini = \"khq\"\n\tcase koyraChiiniMali = \"khq_ML\"\n\tcase koyraboroSenni = \"ses\"\n\tcase koyraboroSenniMali = \"ses_ML\"\n\tcase kwasio = \"nmg\"\n\tcase kwasioCameroon = \"nmg_CM\"\n\tcase kyrgyz = \"ky_Cyrl\"\n\tcase kyrgyzKyrgyzstan = \"ky_Cyrl_KG\"\n\tcase lakota = \"lkt\"\n\tcase lakotaUnitedStates = \"lkt_US\"\n\tcase langi = \"lag\"\n\tcase langiTanzania = \"lag_TZ\"\n\tcase lao = \"lo\"\n\tcase laoLaos = \"lo_LA\"\n\tcase latvian = \"lv\"\n\tcase latvianLatvia = \"lv_LV\"\n\tcase lingala = \"ln\"\n\tcase lingalaAngola = \"ln_AO\"\n\tcase lingalaCentralAfricanRepublic = \"ln_CF\"\n\tcase lingalaCongoBrazzaville = \"ln_CG\"\n\tcase lingalaCongoKinshasa = \"ln_CD\"\n\tcase lithuanian = \"lt\"\n\tcase lithuanianLithuania = \"lt_LT\"\n\tcase lowerSorbian = \"dsb\"\n\tcase lowerSorbianGermany = \"dsb_DE\"\n\tcase lubaKatanga = \"lu\"\n\tcase lubaKatangaCongoKinshasa = \"lu_CD\"\n\tcase luo = \"luo\"\n\tcase luoKenya = \"luo_KE\"\n\tcase luxembourgish = \"lb\"\n\tcase luxembourgishLuxembourg = \"lb_LU\"\n\tcase luyia = \"luy\"\n\tcase luyiaKenya = \"luy_KE\"\n\tcase macedonian = \"mk\"\n\tcase macedonianMacedonia = \"mk_MK\"\n\tcase machame = \"jmc\"\n\tcase machameTanzania = \"jmc_TZ\"\n\tcase makhuwaMeetto = \"mgh\"\n\tcase makhuwaMeettoMozambique = \"mgh_MZ\"\n\tcase makonde = \"kde\"\n\tcase makondeTanzania = \"kde_TZ\"\n\tcase malagasy = \"mg\"\n\tcase malagasyMadagascar = \"mg_MG\"\n\tcase malay = \"ms_Latn\"\n\tcase malayArabic = \"ms_Arab\"\n\tcase malayArabicBrunei = \"ms_Arab_BN\"\n\tcase malayArabicMalaysia = \"ms_Arab_MY\"\n\tcase malayBrunei = \"ms_Latn_BN\"\n\tcase malayMalaysia = \"ms_Latn_MY\"\n\tcase malaySingapore = \"ms_Latn_SG\"\n\tcase malayalam = \"ml\"\n\tcase malayalamIndia = \"ml_IN\"\n\tcase maltese = \"mt\"\n\tcase malteseMalta = \"mt_MT\"\n\tcase manx = \"gv\"\n\tcase manxIsleOfMan = \"gv_IM\"\n\tcase marathi = \"mr\"\n\tcase marathiIndia = \"mr_IN\"\n\tcase masai = \"mas\"\n\tcase masaiKenya = \"mas_KE\"\n\tcase masaiTanzania = \"mas_TZ\"\n\tcase meru = \"mer\"\n\tcase meruKenya = \"mer_KE\"\n\tcase meta = \"mgo\"\n\tcase metaCameroon = \"mgo_CM\"\n\tcase mongolian = \"mn_Cyrl\"\n\tcase mongolianMongolia = \"mn_Cyrl_MN\"\n\tcase morisyen = \"mfe\"\n\tcase morisyenMauritius = \"mfe_MU\"\n\tcase mundang = \"mua\"\n\tcase mundangCameroon = \"mua_CM\"\n\tcase nama = \"naq\"\n\tcase namaNamibia = \"naq_NA\"\n\tcase nepali = \"ne\"\n\tcase nepaliIndia = \"ne_IN\"\n\tcase nepaliNepal = \"ne_NP\"\n\tcase ngiemboon = \"nnh\"\n\tcase ngiemboonCameroon = \"nnh_CM\"\n\tcase ngomba = \"jgo\"\n\tcase ngombaCameroon = \"jgo_CM\"\n\tcase northNdebele = \"nd\"\n\tcase northNdebeleZimbabwe = \"nd_ZW\"\n\tcase northernSami = \"se\"\n\tcase northernSamiFinland = \"se_FI\"\n\tcase northernSamiNorway = \"se_NO\"\n\tcase northernSamiSweden = \"se_SE\"\n\tcase norwegianBokml = \"nb\"\n\tcase norwegianBokmlNorway = \"nb_NO\"\n\tcase norwegianBokmlSvalbardJanMayen = \"nb_SJ\"\n\tcase norwegianNynorsk = \"nn\"\n\tcase norwegianNynorskNorway = \"nn_NO\"\n\tcase nuer = \"nus\"\n\tcase nuerSudan = \"nus_SD\"\n\tcase nyankole = \"nyn\"\n\tcase nyankoleUganda = \"nyn_UG\"\n\tcase oriya = \"or\"\n\tcase oriyaIndia = \"or_IN\"\n\tcase oromo = \"om\"\n\tcase oromoEthiopia = \"om_ET\"\n\tcase oromoKenya = \"om_KE\"\n\tcase ossetic = \"os\"\n\tcase osseticGeorgia = \"os_GE\"\n\tcase osseticRussia = \"os_RU\"\n\tcase pashto = \"ps\"\n\tcase pashtoAfghanistan = \"ps_AF\"\n\tcase persian = \"fa\"\n\tcase persianAfghanistan = \"fa_AF\"\n\tcase persianIran = \"fa_IR\"\n\tcase polish = \"pl\"\n\tcase polishPoland = \"pl_PL\"\n\tcase portuguese = \"pt\"\n\tcase portugueseAngola = \"pt_AO\"\n\tcase portugueseBrazil = \"pt_BR\"\n\tcase portugueseCapeVerde = \"pt_CV\"\n\tcase portugueseGuineaBissau = \"pt_GW\"\n\tcase portugueseMacauSarChina = \"pt_MO\"\n\tcase portugueseMozambique = \"pt_MZ\"\n\tcase portuguesePortugal = \"pt_PT\"\n\tcase portugueseSoTomPrncipe = \"pt_ST\"\n\tcase portugueseTimorLeste = \"pt_TL\"\n\tcase punjabi = \"pa_Guru\"\n\tcase punjabiArabic = \"pa_Arab\"\n\tcase punjabiArabicPakistan = \"pa_Arab_PK\"\n\tcase punjabiIndia = \"pa_Guru_IN\"\n\tcase quechua = \"qu\"\n\tcase quechuaBolivia = \"qu_BO\"\n\tcase quechuaEcuador = \"qu_EC\"\n\tcase quechuaPeru = \"qu_PE\"\n\tcase romanian = \"ro\"\n\tcase romanianMoldova = \"ro_MD\"\n\tcase romanianRomania = \"ro_RO\"\n\tcase romansh = \"rm\"\n\tcase romanshSwitzerland = \"rm_CH\"\n\tcase rombo = \"rof\"\n\tcase romboTanzania = \"rof_TZ\"\n\tcase rundi = \"rn\"\n\tcase rundiBurundi = \"rn_BI\"\n\tcase russian = \"ru\"\n\tcase russianBelarus = \"ru_BY\"\n\tcase russianKazakhstan = \"ru_KZ\"\n\tcase russianKyrgyzstan = \"ru_KG\"\n\tcase russianMoldova = \"ru_MD\"\n\tcase russianRussia = \"ru_RU\"\n\tcase russianUkraine = \"ru_UA\"\n\tcase rwa = \"rwk\"\n\tcase rwaTanzania = \"rwk_TZ\"\n\tcase sakha = \"sah\"\n\tcase sakhaRussia = \"sah_RU\"\n\tcase samburu = \"saq\"\n\tcase samburuKenya = \"saq_KE\"\n\tcase sango = \"sg\"\n\tcase sangoCentralAfricanRepublic = \"sg_CF\"\n\tcase sangu = \"sbp\"\n\tcase sanguTanzania = \"sbp_TZ\"\n\tcase scottishGaelic = \"gd\"\n\tcase scottishGaelicUnitedKingdom = \"gd_GB\"\n\tcase sena = \"seh\"\n\tcase senaMozambique = \"seh_MZ\"\n\tcase serbian = \"sr_Cyrl\"\n\tcase serbianBosniaHerzegovina = \"sr_Cyrl_BA\"\n\tcase serbianKosovo = \"sr_Cyrl_XK\"\n\tcase serbianLatin = \"sr_Latn\"\n\tcase serbianLatinBosniaHerzegovina = \"sr_Latn_BA\"\n\tcase serbianLatinKosovo = \"sr_Latn_XK\"\n\tcase serbianLatinMontenegro = \"sr_Latn_ME\"\n\tcase serbianLatinSerbia = \"sr_Latn_RS\"\n\tcase serbianMontenegro = \"sr_Cyrl_ME\"\n\tcase serbianSerbia = \"sr_Cyrl_RS\"\n\tcase shambala = \"ksb\"\n\tcase shambalaTanzania = \"ksb_TZ\"\n\tcase shona = \"sn\"\n\tcase shonaZimbabwe = \"sn_ZW\"\n\tcase sichuanYi = \"ii\"\n\tcase sichuanYiChina = \"ii_CN\"\n\tcase sinhala = \"si\"\n\tcase sinhalaSriLanka = \"si_LK\"\n\tcase slovak = \"sk\"\n\tcase slovakSlovakia = \"sk_SK\"\n\tcase slovenian = \"sl\"\n\tcase slovenianSlovenia = \"sl_SI\"\n\tcase soga = \"xog\"\n\tcase sogaUganda = \"xog_UG\"\n\tcase somali = \"so\"\n\tcase somaliDjibouti = \"so_DJ\"\n\tcase somaliEthiopia = \"so_ET\"\n\tcase somaliKenya = \"so_KE\"\n\tcase somaliSomalia = \"so_SO\"\n\tcase spanish = \"es\"\n\tcase spanishArgentina = \"es_AR\"\n\tcase spanishBolivia = \"es_BO\"\n\tcase spanishCanaryIslands = \"es_IC\"\n\tcase spanishCeutaMelilla = \"es_EA\"\n\tcase spanishChile = \"es_CL\"\n\tcase spanishColombia = \"es_CO\"\n\tcase spanishCostaRica = \"es_CR\"\n\tcase spanishCuba = \"es_CU\"\n\tcase spanishDominicanRepublic = \"es_DO\"\n\tcase spanishEcuador = \"es_EC\"\n\tcase spanishElSalvador = \"es_SV\"\n\tcase spanishEquatorialGuinea = \"es_GQ\"\n\tcase spanishGuatemala = \"es_GT\"\n\tcase spanishHonduras = \"es_HN\"\n\tcase spanishLatinAmerica = \"es_419\"\n\tcase spanishMexico = \"es_MX\"\n\tcase spanishNicaragua = \"es_NI\"\n\tcase spanishPanama = \"es_PA\"\n\tcase spanishParaguay = \"es_PY\"\n\tcase spanishPeru = \"es_PE\"\n\tcase spanishPhilippines = \"es_PH\"\n\tcase spanishPuertoRico = \"es_PR\"\n\tcase spanishSpain = \"es_ES\"\n\tcase spanishUnitedStates = \"es_US\"\n\tcase spanishUruguay = \"es_UY\"\n\tcase spanishVenezuela = \"es_VE\"\n\tcase standardMoroccanTamazight = \"zgh\"\n\tcase standardMoroccanTamazightMorocco = \"zgh_MA\"\n\tcase swahili = \"sw\"\n\tcase swahiliCongoKinshasa = \"sw_CD\"\n\tcase swahiliKenya = \"sw_KE\"\n\tcase swahiliTanzania = \"sw_TZ\"\n\tcase swahiliUganda = \"sw_UG\"\n\tcase swedish = \"sv\"\n\tcase swedishlandIslands = \"sv_AX\"\n\tcase swedishFinland = \"sv_FI\"\n\tcase swedishSweden = \"sv_SE\"\n\tcase swissGerman = \"gsw\"\n\tcase swissGermanFrance = \"gsw_FR\"\n\tcase swissGermanLiechtenstein = \"gsw_LI\"\n\tcase swissGermanSwitzerland = \"gsw_CH\"\n\tcase tachelhit = \"shi_Latn\"\n\tcase tachelhitMorocco = \"shi_Latn_MA\"\n\tcase tachelhitTifinagh = \"shi_Tfng\"\n\tcase tachelhitTifinaghMorocco = \"shi_Tfng_MA\"\n\tcase taita = \"dav\"\n\tcase taitaKenya = \"dav_KE\"\n\tcase tajik = \"tg_Cyrl\"\n\tcase tajikTajikistan = \"tg_Cyrl_TJ\"\n\tcase tamil = \"ta\"\n\tcase tamilIndia = \"ta_IN\"\n\tcase tamilMalaysia = \"ta_MY\"\n\tcase tamilSingapore = \"ta_SG\"\n\tcase tamilSriLanka = \"ta_LK\"\n\tcase tasawaq = \"twq\"\n\tcase tasawaqNiger = \"twq_NE\"\n\tcase telugu = \"te\"\n\tcase teluguIndia = \"te_IN\"\n\tcase teso = \"teo\"\n\tcase tesoKenya = \"teo_KE\"\n\tcase tesoUganda = \"teo_UG\"\n\tcase thai = \"th\"\n\tcase thaiThailand = \"th_TH\"\n\tcase tibetan = \"bo\"\n\tcase tibetanChina = \"bo_CN\"\n\tcase tibetanIndia = \"bo_IN\"\n\tcase tigrinya = \"ti\"\n\tcase tigrinyaEritrea = \"ti_ER\"\n\tcase tigrinyaEthiopia = \"ti_ET\"\n\tcase tongan = \"to\"\n\tcase tonganTonga = \"to_TO\"\n\tcase turkish = \"tr\"\n\tcase turkishCyprus = \"tr_CY\"\n\tcase turkishTurkey = \"tr_TR\"\n\tcase turkmen = \"tk_Latn\"\n\tcase turkmenTurkmenistan = \"tk_Latn_TM\"\n\tcase ukrainian = \"uk\"\n\tcase ukrainianUkraine = \"uk_UA\"\n\tcase upperSorbian = \"hsb\"\n\tcase upperSorbianGermany = \"hsb_DE\"\n\tcase urdu = \"ur\"\n\tcase urduIndia = \"ur_IN\"\n\tcase urduPakistan = \"ur_PK\"\n\tcase uyghur = \"ug\"\n\tcase uyghurArabic = \"ug_Arab\"\n\tcase uyghurArabicChina = \"ug_Arab_CN\"\n\tcase uzbek = \"uz_Cyrl\"\n\tcase uzbekArabic = \"uz_Arab\"\n\tcase uzbekArabicAfghanistan = \"uz_Arab_AF\"\n\tcase uzbekLatin = \"uz_Latn\"\n\tcase uzbekLatinUzbekistan = \"uz_Latn_UZ\"\n\tcase uzbekUzbekistan = \"uz_Cyrl_UZ\"\n\tcase vai = \"vai_Vaii\"\n\tcase vaiLatin = \"vai_Latn\"\n\tcase vaiLatinLiberia = \"vai_Latn_LR\"\n\tcase vaiLiberia = \"vai_Vaii_LR\"\n\tcase vietnamese = \"vi\"\n\tcase vietnameseVietnam = \"vi_VN\"\n\tcase vunjo = \"vun\"\n\tcase vunjoTanzania = \"vun_TZ\"\n\tcase walser = \"wae\"\n\tcase walserSwitzerland = \"wae_CH\"\n\tcase welsh = \"cy\"\n\tcase welshUnitedKingdom = \"cy_GB\"\n\tcase westernFrisian = \"fy\"\n\tcase westernFrisianNetherlands = \"fy_NL\"\n\tcase yangben = \"yav\"\n\tcase yangbenCameroon = \"yav_CM\"\n\tcase yiddish = \"yi\"\n\tcase yiddishWorld = \"yi_001\"\n\tcase yoruba = \"yo\"\n\tcase yorubaBenin = \"yo_BJ\"\n\tcase yorubaNigeria = \"yo_NG\"\n\tcase zarma = \"dje\"\n\tcase zarmaNiger = \"dje_NE\"\n\tcase zulu = \"zu\"\n\tcase zuluSouthAfrica = \"zu_ZA\"\n\n\t/// Return a valid `Locale` instance from current selected locale enum\n\tpublic func toLocale() -> Locale {\n\t\tswitch self {\n\t\tcase .current:\t\t\treturn Locale.current\n\t\tcase .autoUpdating:\t\treturn Locale.autoupdatingCurrent\n\t\tdefault:\t\t\t\treturn Locale(identifier: rawValue)\n\t\t}\n\t}\n}\n"
  },
  {
    "path": "Sources/SwiftDate/Supports/TimeStructures.swift",
    "content": "//\n//  SwiftDate\n//  Parse, validate, manipulate, and display dates, time and timezones in Swift\n//\n//  Created by Daniele Margutti\n//   - Web: https://www.danielemargutti.com\n//   - Twitter: https://twitter.com/danielemargutti\n//   - Mail: hello@danielemargutti.com\n//\n//  Copyright © 2019 Daniele Margutti. Licensed under MIT License.\n//\n\nimport Foundation\n\n// MARK: - Weekday\n\n/// This define the weekdays for some functions.\npublic enum WeekDay: Int {\n\tcase sunday = 1, monday, tuesday, wednesday, thursday, friday, saturday\n\n\t/// Returns the name of the day given a specific locale.\n\t/// For example, for the `Friday` enum value, the en_AU locale would return \"Friday\" and fr_FR would return \"samedi\"\n\t///\n\t/// - Parameter locale: locale of the output, omit to use the `defaultRegion`'s locale.\n\t/// - Returns: display name\n\tpublic func name(style: SymbolFormatStyle = .`default`, locale: LocaleConvertible = SwiftDate.defaultRegion.locale) -> String {\n\t\tlet region = Region(calendar: SwiftDate.defaultRegion.calendar, zone: SwiftDate.defaultRegion.timeZone, locale: locale)\n\t\tlet formatter = DateFormatter.sharedFormatter(forRegion: region, format: nil)\n\n\t\tlet idx = (self.rawValue - 1)\n\t\tswitch style {\n\t\tcase .default:\t\t\t\treturn formatter.weekdaySymbols[idx]\n\t\tcase .defaultStandalone:\treturn formatter.standaloneWeekdaySymbols[idx]\n\t\tcase .short:\t\t\t\treturn formatter.shortWeekdaySymbols[idx]\n\t\tcase .standaloneShort:\t\treturn formatter.shortStandaloneWeekdaySymbols[idx]\n\t\tcase .veryShort:\t\t\treturn formatter.veryShortWeekdaySymbols[idx]\n\t\tcase .standaloneVeryShort:\treturn formatter.veryShortStandaloneWeekdaySymbols[idx]\n\t\t}\n\t}\n\n\t/// Adds a number of days to the current weekday and returns the new weekday.\n\t///\n\t/// - Parameter months: number of months to add\n\t/// - Returns: new month.\n\tpublic func add(days: Int) -> WeekDay {\n\t\tlet normalized = days % 7\n\t\treturn WeekDay(rawValue: ((self.rawValue + normalized + 7 - 1) % 7) + 1)!\n\t}\n\n\t/// Subtracts a number of days from the current weekday and returns the new weekday.\n\t///\n\t/// - Parameter months: number of days to subtract. May be negative, in which case it will be added\n\t/// - Returns: new weekday.\n\tpublic func subtract(days: Int) -> WeekDay {\n\t\treturn add(days: -(days % 7))\n\t}\n\n}\n\n// MARK: - Year\n\npublic struct Year: CustomStringConvertible, Equatable {\n\tlet year: Int\n\n\tpublic var description: String {\n\t\treturn \"\\(self.year)\"\n\t}\n\n\t/// Constructs a `Year` from the passed value.\n\t///\n\t/// - Parameter year: year value. Can be negative.\n\tpublic init(_ year: Int) {\n\t\tself.year = year\n\t}\n\n\t/// Returns whether this year is a leap year\n\t///\n\t/// - Returns: A boolean indicating whether this year is a leap year\n\tpublic func isLeap() -> Bool {\n\t\treturn ((year & 3) == 0) && ((year % 100) != 0 || (year % 400) == 0)\n\t}\n\n\t/// Returns the number of days in this year\n\t///\n\t/// - Returns: The number of days in this year\n\tpublic func numberOfDays() -> Int {\n\t\treturn self.isLeap() ? 366 : 365\n\t}\n\n}\n\n// MARK: - Month\n\n/// Defines months in a year\npublic enum Month: Int, CustomStringConvertible, Equatable {\n\tcase january = 0, february, march, april, may, june, july, august, september, october, november, december\n\n\tpublic var description: String {\n\t\treturn self.name()\n\t}\n\n\t/// Returns the name of the month given a specific locale.\n\t/// For example, for the `January` enum value, the en_AU locale would return \"January\" and fr_FR would return \"janvier\"\n\t///\n\t/// - Parameter locale: locale of the output, omit to use the `defaultRegion`'s locale.\n\t/// - Returns: display name\n\tpublic func name(style: SymbolFormatStyle = .`default`, locale: LocaleConvertible = SwiftDate.defaultRegion.locale) -> String {\n\t\tlet region = Region(calendar: SwiftDate.defaultRegion.calendar, zone: SwiftDate.defaultRegion.timeZone, locale: locale)\n\t\tlet formatter = DateFormatter.sharedFormatter(forRegion: region, format: nil)\n\t\tswitch style {\n\t\tcase .default:\t\t\t\treturn formatter.monthSymbols[self.rawValue]\n\t\tcase .defaultStandalone:\treturn formatter.standaloneMonthSymbols[self.rawValue]\n\t\tcase .short:\t\t\t\treturn formatter.shortMonthSymbols[self.rawValue]\n\t\tcase .standaloneShort:\t\treturn formatter.shortStandaloneMonthSymbols[self.rawValue]\n\t\tcase .veryShort:\t\t\treturn formatter.veryShortMonthSymbols[self.rawValue]\n\t\tcase .standaloneVeryShort:\treturn formatter.veryShortStandaloneMonthSymbols[self.rawValue]\n\t\t}\n\t}\n\n\t/// Adds a number of months to the current month and returns the new month.\n\t///\n\t/// - Parameter months: number of months to add\n\t/// - Returns: new month.\n\tpublic func add(months: Int) -> Month {\n\t\tlet normalized = months % 12\n\t\treturn Month(rawValue: (self.rawValue + normalized + 12) % 12)!\n\t}\n\n\t/// Subtracts a number of months from the current month and returns the new month.\n\t///\n\t/// - Parameter months: number of months to subtract. May be negative, in which case it will be added\n\t/// - Returns: new month.\n\tpublic func subtract(months: Int) -> Month {\n\t\treturn add(months: -(months % 12))\n\t}\n\n\t/// Returns the number of days in a this month for a given year\n\t///\n\t/// - Parameter year: reference year.\n\t/// - Returns: The number of days in this month.\n\tpublic func numberOfDays(year: Int) -> Int {\n\t\tswitch self {\n\t\tcase .february:\n\t\t\treturn Year(year).isLeap() ? 29 : 28\n\t\tcase .april, .june, .september, .november:\n\t\t\treturn 30\n\t\tdefault:\n\t\t\treturn 31\n\t\t}\n\t}\n\n}\n"
  },
  {
    "path": "Sources/SwiftDate/Supports/Zones.swift",
    "content": "//\n//  SwiftDate\n//  Parse, validate, manipulate, and display dates, time and timezones in Swift\n//\n//  Created by Daniele Margutti\n//   - Web: https://www.danielemargutti.com\n//   - Twitter: https://twitter.com/danielemargutti\n//   - Mail: hello@danielemargutti.com\n//\n//  Copyright © 2019 Daniele Margutti. Licensed under MIT License.\n//\n\nimport Foundation\n\npublic protocol ZoneConvertible {\n\tfunc toTimezone() -> TimeZone\n}\n\nextension TimeZone: ZoneConvertible {\n\tpublic func toTimezone() -> TimeZone {\n\t\treturn self\n\t}\n}\n\n// swiftlint:disable type_body_length\npublic enum Zones: String, ZoneConvertible {\n\tcase current = \"Current\"\n\tcase autoUpdating = \"CurrentAutoUpdating\"\n\tcase africaAbidjan = \"Africa/Abidjan\"\n\tcase africaAccra = \"Africa/Accra\"\n\tcase africaAddisAbaba = \"Africa/Addis_Ababa\"\n\tcase africaAlgiers = \"Africa/Algiers\"\n\tcase africaAsmara = \"Africa/Asmara\"\n\tcase africaBamako = \"Africa/Bamako\"\n\tcase africaBangui = \"Africa/Bangui\"\n\tcase africaBanjul = \"Africa/Banjul\"\n\tcase africaBissau = \"Africa/Bissau\"\n\tcase africaBlantyre = \"Africa/Blantyre\"\n\tcase africaBrazzaville = \"Africa/Brazzaville\"\n\tcase africaBujumbura = \"Africa/Bujumbura\"\n\tcase africaCairo = \"Africa/Cairo\"\n\tcase africaCasablanca = \"Africa/Casablanca\"\n\tcase africaCeuta = \"Africa/Ceuta\"\n\tcase africaConakry = \"Africa/Conakry\"\n\tcase africaDakar = \"Africa/Dakar\"\n\tcase africaDarEsSalaam = \"Africa/Dar_es_Salaam\"\n\tcase africaDjibouti = \"Africa/Djibouti\"\n\tcase africaDouala = \"Africa/Douala\"\n\tcase africaElAaiun = \"Africa/El_Aaiun\"\n\tcase africaFreetown = \"Africa/Freetown\"\n\tcase africaGaborone = \"Africa/Gaborone\"\n\tcase africaHarare = \"Africa/Harare\"\n\tcase africaJohannesburg = \"Africa/Johannesburg\"\n\tcase africaJuba = \"Africa/Juba\"\n\tcase africaKampala = \"Africa/Kampala\"\n\tcase africaKhartoum = \"Africa/Khartoum\"\n\tcase fricaKigali = \"Africa/Kigali\"\n\tcase africaKinshasa = \"Africa/Kinshasa\"\n\tcase africaLagos = \"Africa/Lagos\"\n\tcase africaLibreville = \"Africa/Libreville\"\n\tcase africaLome = \"Africa/Lome\"\n\tcase africaLuanda = \"Africa/Luanda\"\n\tcase africaLubumbashi = \"Africa/Lubumbashi\"\n\tcase africaLusaka = \"Africa/Lusaka\"\n\tcase africaMalabo = \"Africa/Malabo\"\n\tcase africaMaputo = \"Africa/Maputo\"\n\tcase africaMaseru = \"Africa/Maseru\"\n\tcase africaMbabane = \"Africa/Mbabane\"\n\tcase africaMogadishu = \"Africa/Mogadishu\"\n\tcase africaMonrovia = \"Africa/Monrovia\"\n\tcase africaNairobi = \"Africa/Nairobi\"\n\tcase africaNdjamena = \"Africa/Ndjamena\"\n\tcase africaNiamey = \"Africa/Niamey\"\n\tcase africaNouakchott = \"Africa/Nouakchott\"\n\tcase africaOuagadougou = \"Africa/Ouagadougou\"\n\tcase africaPortoNovo = \"Africa/Porto-Novo\"\n\tcase africaSaoTome = \"Africa/Sao_Tome\"\n\tcase africaTripoli = \"Africa/Tripoli\"\n\tcase africaTunis = \"Africa/Tunis\"\n\tcase africaWindhoek = \"Africa/Windhoek\"\n\tcase americaAdak = \"America/Adak\"\n\tcase americaAnchorage = \"America/Anchorage\"\n\tcase americaAnguilla = \"America/Anguilla\"\n\tcase americaAntigua = \"America/Antigua\"\n\tcase americaAraguaina = \"America/Araguaina\"\n\tcase americaArgentinaBuenosAires = \"America/Argentina/Buenos_Aires\"\n\tcase americaArgentinaCatamarca = \"America/Argentina/Catamarca\"\n\tcase americaArgentinaCordoba = \"America/Argentina/Cordoba\"\n\tcase americaArgentinaJujuy = \"America/Argentina/Jujuy\"\n\tcase americaArgentinaLaRioja = \"America/Argentina/La_Rioja\"\n\tcase americaArgentinaMendoza = \"America/Argentina/Mendoza\"\n\tcase americaArgentinaRioGallegos = \"America/Argentina/Rio_Gallegos\"\n\tcase americaArgentinaSalta = \"America/Argentina/Salta\"\n\tcase americaArgentinaSanJuan = \"America/Argentina/San_Juan\"\n\tcase americaArgentinaSanLuis = \"America/Argentina/San_Luis\"\n\tcase americaArgentinaTucuman = \"America/Argentina/Tucuman\"\n\tcase americaArgentinaUshuaia = \"America/Argentina/Ushuaia\"\n\tcase americaAruba = \"America/Aruba\"\n\tcase americaAsuncion = \"America/Asuncion\"\n\tcase americaAtikokan = \"America/Atikokan\"\n\tcase americaBahia = \"America/Bahia\"\n\tcase americaBahiaBanderas = \"America/Bahia_Banderas\"\n\tcase americaBarbados = \"America/Barbados\"\n\tcase americaBelem = \"America/Belem\"\n\tcase americaBelize = \"America/Belize\"\n\tcase americaBlancSablon = \"America/Blanc-Sablon\"\n\tcase americaBoaVista = \"America/Boa_Vista\"\n\tcase americaBogota = \"America/Bogota\"\n\tcase americaBoise = \"America/Boise\"\n\tcase americaCambridgeBay = \"America/Cambridge_Bay\"\n\tcase americaCampoGrande = \"America/Campo_Grande\"\n\tcase americaCancun = \"America/Cancun\"\n\tcase americaCaracas = \"America/Caracas\"\n\tcase americaCayenne = \"America/Cayenne\"\n\tcase americaCayman = \"America/Cayman\"\n\tcase americaChicago = \"America/Chicago\"\n\tcase americaChihuahua = \"America/Chihuahua\"\n\tcase americaCostaRica = \"America/Costa_Rica\"\n\tcase americaCreston = \"America/Creston\"\n\tcase americaCuiaba = \"America/Cuiaba\"\n\tcase americaCuracao = \"America/Curacao\"\n\tcase americaDanmarkshavn = \"America/Danmarkshavn\"\n\tcase americaDawson = \"America/Dawson\"\n\tcase americaDawsonCreek = \"America/Dawson_Creek\"\n\tcase americaDenver = \"America/Denver\"\n\tcase americaDetroit = \"America/Detroit\"\n\tcase americaDominica = \"America/Dominica\"\n\tcase americaEdmonton = \"America/Edmonton\"\n\tcase americaEirunepe = \"America/Eirunepe\"\n\tcase americaElSalvador = \"America/El_Salvador\"\n\tcase americaFortNelson = \"America/Fort_Nelson\"\n\tcase americaFortaleza = \"America/Fortaleza\"\n\tcase americaGlaceBay = \"America/Glace_Bay\"\n\tcase americaGodthab = \"America/Godthab\"\n\tcase americaGooseBay = \"America/Goose_Bay\"\n\tcase americaGrandTurk = \"America/Grand_Turk\"\n\tcase americaGrenada = \"America/Grenada\"\n\tcase americaGuadeloupe = \"America/Guadeloupe\"\n\tcase americaGuatemala = \"America/Guatemala\"\n\tcase americaGuayaquil = \"America/Guayaquil\"\n\tcase americaGuyana = \"America/Guyana\"\n\tcase americaHalifax = \"America/Halifax\"\n\tcase americaHavana = \"America/Havana\"\n\tcase americaHermosillo = \"America/Hermosillo\"\n\tcase americaIndianaIndianapolis = \"America/Indiana/Indianapolis\"\n\tcase americaIndianaKnox = \"America/Indiana/Knox\"\n\tcase americaIndianaMarengo = \"America/Indiana/Marengo\"\n\tcase americaIndianaPetersburg = \"America/Indiana/Petersburg\"\n\tcase americaIndianaTellCity = \"America/Indiana/Tell_City\"\n\tcase americaIndianaVevay = \"America/Indiana/Vevay\"\n\tcase americaIndianaVincennes = \"America/Indiana/Vincennes\"\n\tcase americaIndianaWinamac = \"America/Indiana/Winamac\"\n\tcase americaInuvik = \"America/Inuvik\"\n\tcase americaIqaluit = \"America/Iqaluit\"\n\tcase americaJamaica = \"America/Jamaica\"\n\tcase americaJuneau = \"America/Juneau\"\n\tcase americaKentuckyLouisville = \"America/Kentucky/Louisville\"\n\tcase americaKentuckyMonticello = \"America/Kentucky/Monticello\"\n\tcase americaKralendijk = \"America/Kralendijk\"\n\tcase americaLaPaz = \"America/La_Paz\"\n\tcase americaLima = \"America/Lima\"\n\tcase americaLosAngeles = \"America/Los_Angeles\"\n\tcase americaLowerPrinces = \"America/Lower_Princes\"\n\tcase americaMaceio = \"America/Maceio\"\n\tcase americaManagua = \"America/Managua\"\n\tcase americaManaus = \"America/Manaus\"\n\tcase americaMarigot = \"America/Marigot\"\n\tcase americaMartinique = \"America/Martinique\"\n\tcase americaMatamoros = \"America/Matamoros\"\n\tcase americaMazatlan = \"America/Mazatlan\"\n\tcase americaMenominee = \"America/Menominee\"\n\tcase americaMerida = \"America/Merida\"\n\tcase americaMetlakatla = \"America/Metlakatla\"\n\tcase americaMexicoCity = \"America/Mexico_City\"\n\tcase americaMiquelon = \"America/Miquelon\"\n\tcase americaMoncton = \"America/Moncton\"\n\tcase americaMonterrey = \"America/Monterrey\"\n\tcase americaMontevideo = \"America/Montevideo\"\n\tcase americaMontreal = \"America/Montreal\"\n\tcase americaMontserrat = \"America/Montserrat\"\n\tcase americaNassau = \"America/Nassau\"\n\tcase americaNewYork = \"America/New_York\"\n\tcase americaNipigon = \"America/Nipigon\"\n\tcase americaNome = \"America/Nome\"\n\tcase americaNoronha = \"America/Noronha\"\n\tcase americaNorthDakotaBeulah = \"America/North_Dakota/Beulah\"\n\tcase americaNorthDakotaCenter = \"America/North_Dakota/Center\"\n\tcase americaNorthDakotaNewSalem = \"America/North_Dakota/New_Salem\"\n\tcase americaOjinaga = \"America/Ojinaga\"\n\tcase americaPanama = \"America/Panama\"\n\tcase americaPangnirtung = \"America/Pangnirtung\"\n\tcase americaParamaribo = \"America/Paramaribo\"\n\tcase americaPhoenix = \"America/Phoenix\"\n\tcase americaPortAuPrince = \"America/Port-au-Prince\"\n\tcase americaPortOfSpain = \"America/Port_of_Spain\"\n\tcase americaPortoVelho = \"America/Porto_Velho\"\n\tcase americaPuertoRico = \"America/Puerto_Rico\"\n\tcase americaRainyRiver = \"America/Rainy_River\"\n\tcase americaRankinInlet = \"America/Rankin_Inlet\"\n\tcase americaRecife = \"America/Recife\"\n\tcase americaRegina = \"America/Regina\"\n\tcase americaResolute = \"America/Resolute\"\n\tcase americaRioBranco = \"America/Rio_Branco\"\n\tcase americaSantaIsabel = \"America/Santa_Isabel\"\n\tcase americaSantarem = \"America/Santarem\"\n\tcase americaSantiago = \"America/Santiago\"\n\tcase americaSantoDomingo = \"America/Santo_Domingo\"\n\tcase americaSaoPaulo = \"America/Sao_Paulo\"\n\tcase americaScoresbysund = \"America/Scoresbysund\"\n\tcase americaShiprock = \"America/Shiprock\"\n\tcase americaSitka = \"America/Sitka\"\n\tcase americaStBarthelemy = \"America/St_Barthelemy\"\n\tcase americaStJohns = \"America/St_Johns\"\n\tcase americaStKitts = \"America/St_Kitts\"\n\tcase americaStLucia = \"America/St_Lucia\"\n\tcase americaStThomas = \"America/St_Thomas\"\n\tcase americaStVincent = \"America/St_Vincent\"\n\tcase americaSwiftCurrent = \"America/Swift_Current\"\n\tcase americaTegucigalpa = \"America/Tegucigalpa\"\n\tcase americaThule = \"America/Thule\"\n\tcase americaThunderBay = \"America/Thunder_Bay\"\n\tcase americaTijuana = \"America/Tijuana\"\n\tcase americaToronto = \"America/Toronto\"\n\tcase americaTortola = \"America/Tortola\"\n\tcase americaVancouver = \"America/Vancouver\"\n\tcase americaWhitehorse = \"America/Whitehorse\"\n\tcase americaWinnipeg = \"America/Winnipeg\"\n\tcase americaYakutat = \"America/Yakutat\"\n\tcase americaYellowknife = \"America/Yellowknife\"\n\tcase antarcticaCasey = \"Antarctica/Casey\"\n\tcase antarcticaDavis = \"Antarctica/Davis\"\n\tcase antarcticaDumontdurville = \"Antarctica/DumontDUrville\"\n\tcase antarcticaMacquarie = \"Antarctica/Macquarie\"\n\tcase antarcticaMawson = \"Antarctica/Mawson\"\n\tcase antarcticaMcmurdo = \"Antarctica/McMurdo\"\n\tcase antarcticaPalmer = \"Antarctica/Palmer\"\n\tcase antarcticaRothera = \"Antarctica/Rothera\"\n\tcase antarcticaSouthPole = \"Antarctica/South_Pole\"\n\tcase antarcticaSyowa = \"Antarctica/Syowa\"\n\tcase antarcticaTroll = \"Antarctica/Troll\"\n\tcase antarcticaVostok = \"Antarctica/Vostok\"\n\tcase arcticLongyearbyen = \"Arctic/Longyearbyen\"\n\tcase asiaAden = \"Asia/Aden\"\n\tcase asiaAlmaty = \"Asia/Almaty\"\n\tcase asiaAmman = \"Asia/Amman\"\n\tcase asiaAnadyr = \"Asia/Anadyr\"\n\tcase asiaAqtau = \"Asia/Aqtau\"\n\tcase asiaAqtobe = \"Asia/Aqtobe\"\n\tcase asiaAshgabat = \"Asia/Ashgabat\"\n\tcase asiaBaghdad = \"Asia/Baghdad\"\n\tcase asiaBahrain = \"Asia/Bahrain\"\n\tcase asiaBaku = \"Asia/Baku\"\n\tcase asiaBangkok = \"Asia/Bangkok\"\n\tcase asiaBeirut = \"Asia/Beirut\"\n\tcase asiaBishkek = \"Asia/Bishkek\"\n\tcase asiaBrunei = \"Asia/Brunei\"\n\tcase asiaChita = \"Asia/Chita\"\n\tcase asiaChoibalsan = \"Asia/Choibalsan\"\n\tcase asiaChongqing = \"Asia/Chongqing\"\n\tcase asiaColombo = \"Asia/Colombo\"\n\tcase asiaDamascus = \"Asia/Damascus\"\n\tcase asiaDhaka = \"Asia/Dhaka\"\n\tcase asiaDili = \"Asia/Dili\"\n\tcase asiaDubai = \"Asia/Dubai\"\n\tcase asiaDushanbe = \"Asia/Dushanbe\"\n\tcase asiaGaza = \"Asia/Gaza\"\n\tcase asiaHarbin = \"Asia/Harbin\"\n\tcase asiaHebron = \"Asia/Hebron\"\n\tcase asiaHoChiMinh = \"Asia/Ho_Chi_Minh\"\n\tcase asiaSaigon = \"Asia/Saigon\"\n\tcase asiaHongKong = \"Asia/Hong_Kong\"\n\tcase asiaHovd = \"Asia/Hovd\"\n\tcase asiaIrkutsk = \"Asia/Irkutsk\"\n\tcase asiaJakarta = \"Asia/Jakarta\"\n\tcase asiaJayapura = \"Asia/Jayapura\"\n\tcase asiaJerusalem = \"Asia/Jerusalem\"\n\tcase asiaKabul = \"Asia/Kabul\"\n\tcase asiaKamchatka = \"Asia/Kamchatka\"\n\tcase asiaKarachi = \"Asia/Karachi\"\n\tcase asiaKashgar = \"Asia/Kashgar\"\n\tcase asiaKathmandu = \"Asia/Kathmandu\"\n\tcase asiaKatmandu = \"Asia/Katmandu\"\n\tcase asiaKhandyga = \"Asia/Khandyga\"\n\tcase asiaKolkata = \"Asia/Kolkata\"\n\tcase asiaKrasnoyarsk = \"Asia/Krasnoyarsk\"\n\tcase asiaKualaLumpur = \"Asia/Kuala_Lumpur\"\n\tcase asiaKuching = \"Asia/Kuching\"\n\tcase asiaKuwait = \"Asia/Kuwait\"\n\tcase asiaMacau = \"Asia/Macau\"\n\tcase asiaMagadan = \"Asia/Magadan\"\n\tcase asiaMakassar = \"Asia/Makassar\"\n\tcase asiaManila = \"Asia/Manila\"\n\tcase asiaMuscat = \"Asia/Muscat\"\n\tcase asiaNicosia = \"Asia/Nicosia\"\n\tcase asiaNovokuznetsk = \"Asia/Novokuznetsk\"\n\tcase asiaNovosibirsk = \"Asia/Novosibirsk\"\n\tcase asiaOmsk = \"Asia/Omsk\"\n\tcase asiaOral = \"Asia/Oral\"\n\tcase asiaPhnomPenh = \"Asia/Phnom_Penh\"\n\tcase asiaPontianak = \"Asia/Pontianak\"\n\tcase asiaPyongyang = \"Asia/Pyongyang\"\n\tcase asiaQatar = \"Asia/Qatar\"\n\tcase asiaQyzylorda = \"Asia/Qyzylorda\"\n\tcase asiaRangoon = \"Asia/Rangoon\"\n\tcase asiaRiyadh = \"Asia/Riyadh\"\n\tcase asiaSakhalin = \"Asia/Sakhalin\"\n\tcase asiaSamarkand = \"Asia/Samarkand\"\n\tcase asiaSeoul = \"Asia/Seoul\"\n\tcase asiaShanghai = \"Asia/Shanghai\"\n\tcase asiaSingapore = \"Asia/Singapore\"\n\tcase asiaSrednekolymsk = \"Asia/Srednekolymsk\"\n\tcase asiaTaipei = \"Asia/Taipei\"\n\tcase asiaTashkent = \"Asia/Tashkent\"\n\tcase asiaTbilisi = \"Asia/Tbilisi\"\n\tcase asiaTehran = \"Asia/Tehran\"\n\tcase asiaThimphu = \"Asia/Thimphu\"\n\tcase asiaTokyo = \"Asia/Tokyo\"\n\tcase asiaUlaanbaatar = \"Asia/Ulaanbaatar\"\n\tcase asiaUrumqi = \"Asia/Urumqi\"\n\tcase asiaUstNera = \"Asia/Ust-Nera\"\n\tcase asiaVientiane = \"Asia/Vientiane\"\n\tcase asiaVladivostok = \"Asia/Vladivostok\"\n\tcase asiaYakutsk = \"Asia/Yakutsk\"\n\tcase asiaYekaterinburg = \"Asia/Yekaterinburg\"\n\tcase asiaYerevan = \"Asia/Yerevan\"\n\tcase atlanticAzores = \"Atlantic/Azores\"\n\tcase atlanticBermuda = \"Atlantic/Bermuda\"\n\tcase atlanticCanary = \"Atlantic/Canary\"\n\tcase atlanticCapeVerde = \"Atlantic/Cape_Verde\"\n\tcase atlanticFaroe = \"Atlantic/Faroe\"\n\tcase atlanticMadeira = \"Atlantic/Madeira\"\n\tcase atlanticReykjavik = \"Atlantic/Reykjavik\"\n\tcase atlanticSouthGeorgia = \"Atlantic/South_Georgia\"\n\tcase atlanticStHelena = \"Atlantic/St_Helena\"\n\tcase atlanticStanley = \"Atlantic/Stanley\"\n\tcase australiaAdelaide = \"Australia/Adelaide\"\n\tcase australiaBrisbane = \"Australia/Brisbane\"\n\tcase australiaBrokenHill = \"Australia/Broken_Hill\"\n\tcase australiaCurrie = \"Australia/Currie\"\n\tcase australiaDarwin = \"Australia/Darwin\"\n\tcase australiaEucla = \"Australia/Eucla\"\n\tcase australiaHobart = \"Australia/Hobart\"\n\tcase australiaLindeman = \"Australia/Lindeman\"\n\tcase australiaLordHowe = \"Australia/Lord_Howe\"\n\tcase australiaMelbourne = \"Australia/Melbourne\"\n\tcase australiaPerth = \"Australia/Perth\"\n\tcase australiaSydney = \"Australia/Sydney\"\n\tcase europeAmsterdam = \"Europe/Amsterdam\"\n\tcase europeAndorra = \"Europe/Andorra\"\n\tcase europeAthens = \"Europe/Athens\"\n\tcase europeBelgrade = \"Europe/Belgrade\"\n\tcase europeBerlin = \"Europe/Berlin\"\n\tcase europeBratislava = \"Europe/Bratislava\"\n\tcase europeBrussels = \"Europe/Brussels\"\n\tcase europeBucharest = \"Europe/Bucharest\"\n\tcase europeBudapest = \"Europe/Budapest\"\n\tcase europeBusingen = \"Europe/Busingen\"\n\tcase europeChisinau = \"Europe/Chisinau\"\n\tcase europeCopenhagen = \"Europe/Copenhagen\"\n\tcase europeDublin = \"Europe/Dublin\"\n\tcase europeGibraltar = \"Europe/Gibraltar\"\n\tcase europeGuernsey = \"Europe/Guernsey\"\n\tcase europeHelsinki = \"Europe/Helsinki\"\n\tcase europeIsleOfMan = \"Europe/Isle_of_Man\"\n\tcase europeIstanbul = \"Europe/Istanbul\"\n\tcase europeJersey = \"Europe/Jersey\"\n\tcase europeKaliningrad = \"Europe/Kaliningrad\"\n\tcase europeKiev = \"Europe/Kiev\"\n\tcase europeLisbon = \"Europe/Lisbon\"\n\tcase europeLjubljana = \"Europe/Ljubljana\"\n\tcase europeLondon = \"Europe/London\"\n\tcase europeLuxembourg = \"Europe/Luxembourg\"\n\tcase europeMadrid = \"Europe/Madrid\"\n\tcase europeMalta = \"Europe/Malta\"\n\tcase europeMariehamn = \"Europe/Mariehamn\"\n\tcase europeMinsk = \"Europe/Minsk\"\n\tcase europeMonaco = \"Europe/Monaco\"\n\tcase europeMoscow = \"Europe/Moscow\"\n\tcase europeOslo = \"Europe/Oslo\"\n\tcase europeParis = \"Europe/Paris\"\n\tcase europePodgorica = \"Europe/Podgorica\"\n\tcase europePrague = \"Europe/Prague\"\n\tcase europeRiga = \"Europe/Riga\"\n\tcase europeRome = \"Europe/Rome\"\n\tcase europeSamara = \"Europe/Samara\"\n\tcase europeSanMarino = \"Europe/San_Marino\"\n\tcase europeSarajevo = \"Europe/Sarajevo\"\n\tcase europeSimferopol = \"Europe/Simferopol\"\n\tcase europeSkopje = \"Europe/Skopje\"\n\tcase europeSofia = \"Europe/Sofia\"\n\tcase europeStockholm = \"Europe/Stockholm\"\n\tcase europeTallinn = \"Europe/Tallinn\"\n\tcase europeTirane = \"Europe/Tirane\"\n\tcase europeUzhgorod = \"Europe/Uzhgorod\"\n\tcase europeVaduz = \"Europe/Vaduz\"\n\tcase europeVatican = \"Europe/Vatican\"\n\tcase europeVienna = \"Europe/Vienna\"\n\tcase europeVilnius = \"Europe/Vilnius\"\n\tcase europeVolgograd = \"Europe/Volgograd\"\n\tcase europeWarsaw = \"Europe/Warsaw\"\n\tcase europeZagreb = \"Europe/Zagreb\"\n\tcase europeZaporozhye = \"Europe/Zaporozhye\"\n\tcase europeZurich = \"Europe/Zurich\"\n\tcase gmt = \"GMT\"\n\tcase indianAntananarivo = \"Indian/Antananarivo\"\n\tcase indianChagos = \"Indian/Chagos\"\n\tcase indianChristmas = \"Indian/Christmas\"\n\tcase indianCocos = \"Indian/Cocos\"\n\tcase indianComoro = \"Indian/Comoro\"\n\tcase indianKerguelen = \"Indian/Kerguelen\"\n\tcase indianMahe = \"Indian/Mahe\"\n\tcase indianMaldives = \"Indian/Maldives\"\n\tcase indianMauritius = \"Indian/Mauritius\"\n\tcase indianMayotte = \"Indian/Mayotte\"\n\tcase indianReunion = \"Indian/Reunion\"\n\tcase pacificApia = \"Pacific/Apia\"\n\tcase pacificAuckland = \"Pacific/Auckland\"\n\tcase pacificBougainville = \"Pacific/Bougainville\"\n\tcase pacificChatham = \"Pacific/Chatham\"\n\tcase pacificChuuk = \"Pacific/Chuuk\"\n\tcase pacificEaster = \"Pacific/Easter\"\n\tcase pacificEfate = \"Pacific/Efate\"\n\tcase pacificEnderbury = \"Pacific/Enderbury\"\n\tcase pacificFakaofo = \"Pacific/Fakaofo\"\n\tcase pacificFiji = \"Pacific/Fiji\"\n\tcase pacificFunafuti = \"Pacific/Funafuti\"\n\tcase pacificGalapagos = \"Pacific/Galapagos\"\n\tcase pacificGambier = \"Pacific/Gambier\"\n\tcase pacificGuadalcanal = \"Pacific/Guadalcanal\"\n\tcase pacificGuam = \"Pacific/Guam\"\n\tcase pacificHonolulu = \"Pacific/Honolulu\"\n\tcase pacificJohnston = \"Pacific/Johnston\"\n\tcase pacificKiritimati = \"Pacific/Kiritimati\"\n\tcase pacificKosrae = \"Pacific/Kosrae\"\n\tcase pacificKwajalein = \"Pacific/Kwajalein\"\n\tcase pacificMajuro = \"Pacific/Majuro\"\n\tcase pacificMarquesas = \"Pacific/Marquesas\"\n\tcase pacificMidway = \"Pacific/Midway\"\n\tcase pacificNauru = \"Pacific/Nauru\"\n\tcase pacificNiue = \"Pacific/Niue\"\n\tcase pacificNorfolk = \"Pacific/Norfolk\"\n\tcase pacificNoumea = \"Pacific/Noumea\"\n\tcase pacificPagoPago = \"Pacific/Pago_Pago\"\n\tcase pacificPalau = \"Pacific/Palau\"\n\tcase pacificPitcairn = \"Pacific/Pitcairn\"\n\tcase pacificPohnpei = \"Pacific/Pohnpei\"\n\tcase pacificPonape = \"Pacific/Ponape\"\n\tcase pacificPortMoresby = \"Pacific/Port_Moresby\"\n\tcase pacificRarotonga = \"Pacific/Rarotonga\"\n\tcase pacificSaipan = \"Pacific/Saipan\"\n\tcase pacificTahiti = \"Pacific/Tahiti\"\n\tcase pacificTarawa = \"Pacific/Tarawa\"\n\tcase pacificTongatapu = \"Pacific/Tongatapu\"\n\tcase pacificTruk = \"Pacific/Truk\"\n\tcase pacificWake = \"Pacific/Wake\"\n\tcase pacificWallis = \"Pacific/Wallis\"\n\n\tpublic func toTimezone() -> TimeZone {\n\t\tswitch self {\n\t\tcase .current:\t\t\treturn TimeZone.current\n\t\tcase .autoUpdating:\t\treturn TimeZone.autoupdatingCurrent\n\t\tdefault:\t\t\t\treturn TimeZone(identifier: rawValue)!\n\t\t}\n\t}\n}\n"
  },
  {
    "path": "Sources/SwiftDate/SwiftDate.swift",
    "content": "//\n//  SwiftDate\n//  Parse, validate, manipulate, and display dates, time and timezones in Swift\n//\n//  Created by Daniele Margutti\n//   - Web: https://www.danielemargutti.com\n//   - Twitter: https://twitter.com/danielemargutti\n//   - Mail: hello@danielemargutti.com\n//\n//  Copyright © 2019 Daniele Margutti. Licensed under MIT License.\n//\n\nimport Foundation\n\npublic struct SwiftDate {\n\n\tprivate init() { }\n\n\t/// The default region is used to manipulate and work with plain `Date` object and\n\t/// wherever a region parameter is optional. By default region is the to GMT timezone\n\t/// along with the default device's locale and calendar (both autoupdating).\n\tpublic static var defaultRegion = Region.UTC\n\n\t/// This is the ordered list of all formats SwiftDate can use in order to attempt parsing a passaed\n\t/// date expressed as string. Evaluation is made in order; you can add or remove new formats as you wish.\n\t/// In order to reset the list call `resetAutoFormats()` function.\n\tpublic static var autoFormats: [String] {\n\t\tset { DateFormats.autoFormats = newValue }\n\t\tget { return DateFormats.autoFormats }\n\t}\n\n\t/// Reset the list of all built-in auto formats patterns.\n\tpublic static func resetAutoFormats() {\n\t\tDateFormats.resetAutoFormats()\n\t}\n}\n"
  },
  {
    "path": "Sources/SwiftDate/TimePeriod/Groups/TimePeriodChain.swift",
    "content": "//\n//  SwiftDate\n//  Parse, validate, manipulate, and display dates, time and timezones in Swift\n//\n//  Created by Daniele Margutti\n//   - Web: https://www.danielemargutti.com\n//   - Twitter: https://twitter.com/danielemargutti\n//   - Mail: hello@danielemargutti.com\n//\n//  Copyright © 2019 Daniele Margutti. Licensed under MIT License.\n//\n\nimport Foundation\n\n/// Time period chains serve as a tightly coupled set of time periods.\n/// They are always organized by start and end date, and have their own characteristics like\n/// a StartDate and EndDate that are extrapolated from the time periods within.\n/// Time period chains do not allow overlaps within their set of time periods.\n/// This type of group is ideal for modeling schedules like sequential meetings or appointments.\nopen class TimePeriodChain: TimePeriodGroup {\n\n\t// MARK: - Chain Existence Manipulation\n\n\t/**\n\t*  Append a TimePeriodProtocol to the periods array and update the Chain's\n\t*  beginning and end.\n\t*\n\t* - parameter period: TimePeriodProtocol to add to the collection\n\t*/\n\tpublic func append(_ period: TimePeriodProtocol) {\n\t\tlet beginning = (periods.count > 0) ? periods.last!.end! : period.start\n\n\t\tlet newPeriod = TimePeriod(start: beginning!, duration: period.duration)\n\t\tperiods.append(newPeriod)\n\n\t\t//Update updateExtremes\n\t\tif periods.count == 1 {\n\t\t\tstart = period.start\n\t\t\tend = period.end\n\t\t} else {\n\t\t\tend = end?.addingTimeInterval(period.duration)\n\t\t}\n\t}\n\n\t/**\n\t*  Append a TimePeriodProtocol array to the periods array and update the Chain's\n\t*  beginning and end.\n\t*\n\t* - parameter periodArray: TimePeriodProtocol list to add to the collection\n\t*/\n\tpublic func append<G: TimePeriodGroup>(contentsOf group: G) {\n\t\tfor period in group.periods {\n\t\t\tlet beginning = (periods.count > 0) ? periods.last!.end! : period.start\n\n\t\t\tlet newPeriod = TimePeriod(start: beginning!, duration: period.duration)\n\t\t\tperiods.append(newPeriod)\n\n\t\t\t//Update updateExtremes\n\t\t\tif periods.count == 1 {\n\t\t\t\tstart = period.start\n\t\t\t\tend = period.end\n\t\t\t} else {\n\t\t\t\tend = end?.addingTimeInterval(period.duration)\n\t\t\t}\n\t\t}\n\t}\n\n\t/// Insert period into periods array at given index.\n\t///\n\t/// - Parameters:\n\t///   - period: The period to insert\n\t///   - index: Index to insert period at\n\tpublic func insert(_ period: TimePeriodProtocol, at index: Int) {\n\t\t//Check for special zero case which takes the beginning date\n\t\tif index == 0 && period.start != nil && period.end != nil {\n\t\t\t//Insert new period\n\t\t\tperiods.insert(period, at: index)\n\t\t} else if period.start != nil && period.end != nil {\n\t\t\t//Insert new period\n\t\t\tperiods.insert(period, at: index)\n\t\t} else {\n\t\t\tprint(\"All TimePeriods in a TimePeriodChain must contain a defined start and end date\")\n\t\t\treturn\n\t\t}\n\n\t\t//Shift all periods after inserted period\n\t\tfor i in 0..<periods.count {\n\t\t\tif i > index && i > 0 {\n\t\t\t\tlet currentPeriod = TimePeriod(start: period.start, end: period.end)\n\t\t\t\tperiods[i].start = periods[i - 1].end\n\t\t\t\tperiods[i].end = periods[i].start!.addingTimeInterval(currentPeriod.duration)\n\t\t\t}\n\t\t}\n\n\t\tupdateExtremes()\n\t}\n\n\t/// Remove from period array at the given index.\n\t///\n\t/// - Parameter index: The index in the collection to remove\n\tpublic func remove(at index: Int) {\n\t\t//Retrieve duration of period to be removed\n\t\tlet duration = periods[index].duration\n\n\t\t//Remove period\n\t\tperiods.remove(at: index)\n\n\t\t//Shift all periods after inserted period\n\t\tfor i in index..<periods.count {\n\t\t\tperiods[i].shift(by: -duration)\n\t\t}\n\t\tupdateExtremes()\n\t}\n\n\t/// Remove all periods from period array.\n\tpublic func removeAll() {\n\t\tperiods.removeAll()\n\t\tupdateExtremes()\n\t}\n\n\t// MARK: - Chain Content Manipulation\n\n\t/// In place, shifts all chain time periods by a given time interval\n\t///\n\t/// - Parameter duration: The time interval to shift the period by\n\tpublic func shift(by duration: TimeInterval) {\n\t\tfor var period in periods {\n\t\t\tperiod.shift(by: duration)\n\t\t}\n\t\tstart = start?.addingTimeInterval(duration)\n\t\tend = end?.addingTimeInterval(duration)\n\t}\n\n\tpublic override func map<T>(_ transform: (TimePeriodProtocol) throws -> T) rethrows -> [T] {\n\t\treturn try periods.map(transform)\n\t}\n\n\tpublic override func filter(_ isIncluded: (TimePeriodProtocol) throws -> Bool) rethrows -> [TimePeriodProtocol] {\n\t\treturn try periods.filter(isIncluded)\n\t}\n\n\tinternal override func reduce<Result>(_ initialResult: Result, _ nextPartialResult: (Result, TimePeriodProtocol) throws -> Result) rethrows -> Result {\n\t\treturn try periods.reduce(initialResult, nextPartialResult)\n\t}\n\n\t/// Removes the last object from the `TimePeriodChain` and returns it\n\tpublic func pop() -> TimePeriodProtocol? {\n\t\tlet period = periods.popLast()\n\t\tupdateExtremes()\n\n\t\treturn period\n\t}\n\n\tinternal func updateExtremes() {\n\t\tstart = periods.first?.start\n\t\tend = periods.last?.end\n\t}\n\n}\n"
  },
  {
    "path": "Sources/SwiftDate/TimePeriod/Groups/TimePeriodCollection.swift",
    "content": "//\n//  SwiftDate\n//  Parse, validate, manipulate, and display dates, time and timezones in Swift\n//\n//  Created by Daniele Margutti\n//   - Web: https://www.danielemargutti.com\n//   - Twitter: https://twitter.com/danielemargutti\n//   - Mail: hello@danielemargutti.com\n//\n//  Copyright © 2019 Daniele Margutti. Licensed under MIT License.\n//\n\nimport Foundation\n\n/// Sort type\n///\n/// - ascending: sort in ascending order\n/// - descending: sort in descending order\npublic enum SortMode {\n\tcase ascending\n\tcase descending\n}\n\n/// Sorting type\n///\n/// - start: sort by start date\n/// - end: sort by end date\n/// - duration: sort by duration\n/// - custom: sort using custom function\npublic enum SortType {\n\tcase start(_: SortMode)\n\tcase end(_: SortMode)\n\tcase duration(_: SortMode)\n\tcase custom(_: ((TimePeriodProtocol, TimePeriodProtocol) -> Bool))\n}\n\n/// Time period collections serve as loose sets of time periods.\n/// They are unorganized unless you decide to sort them, and have their own characteristics\n/// like a `start` and `end` that are extrapolated from the time periods within.\n/// Time period collections allow overlaps within their set of time periods.\nopen class TimePeriodCollection: TimePeriodGroup {\n\n\t// MARK: - Collection Manipulation\n\n\t/// Append a TimePeriodProtocol to the periods array and check if the Collection's start and end should change.\n\t///\n\t/// - Parameter period: TimePeriodProtocol to add to the collection\n\tpublic func append(_ period: TimePeriodProtocol) {\n\t\tperiods.append(period)\n\t\tupdateExtremes(period: period)\n\t}\n\n\t/// Append a TimePeriodProtocol array to the periods array and check if the Collection's\n\t/// start and end should change.\n\t///\n\t/// - Parameter periodArray: TimePeriodProtocol list to add to the collection\n\tpublic func append(_ periodArray: [TimePeriodProtocol]) {\n\t\tfor period in periodArray {\n\t\t\tperiods.append(period)\n\t\t\tupdateExtremes(period: period)\n\t\t}\n\t}\n\n\t/// Append a TimePeriodGroup's periods array to the periods array of self and check if the Collection's\n\t/// start and end should change.\n\t///\n\t/// - Parameter newPeriods: TimePeriodGroup to merge periods arrays with\n\tpublic func append<C: TimePeriodGroup>(contentsOf newPeriods: C) {\n\t\tfor period in newPeriods as TimePeriodGroup {\n\t\t\tperiods.append(period)\n\t\t\tupdateExtremes(period: period)\n\t\t}\n\t}\n\n\t/// Insert period into periods array at given index.\n\t///\n\t/// - Parameters:\n\t///   - newElement: The period to insert\n\t///   - index: Index to insert period at\n\tpublic func insert(_ newElement: TimePeriodProtocol, at index: Int) {\n\t\tperiods.insert(newElement, at: index)\n\t\tupdateExtremes(period: newElement)\n\t}\n\n\t/// Remove from period array at the given index.\n\t///\n\t/// - Parameter at: The index in the collection to remove\n\tpublic func remove(at: Int) {\n\t\tperiods.remove(at: at)\n\t\tupdateExtremes()\n\t}\n\n\t/// Remove all periods from period array.\n\tpublic func removeAll() {\n\t\tperiods.removeAll()\n\t\tupdateExtremes()\n\t}\n\n\t// MARK: - Sorting\n\n\t/// Sort elements in place using given method.\n\t///\n\t/// - Parameter type: sorting method\n\tpublic func sort(by type: SortType) {\n\t\tswitch type {\n\t\tcase .duration(let mode):\tperiods.sort(by: sortFuncDuration(mode))\n\t\tcase .start(let mode):\t\tperiods.sort(by: sortFunc(byStart: true, type: mode))\n\t\tcase .end(let mode):\t\tperiods.sort(by: sortFunc(byStart: false, type: mode))\n\t\tcase .custom(let f):\t\tperiods.sort(by: f)\n\t\t}\n\t}\n\n\t/// Generate a new `TimePeriodCollection` where items are sorted with specified method.\n\t///\n\t/// - Parameters:\n\t///   - type: sorting method\n\t/// - Returns: collection ordered by given function\n\tpublic func sorted(by type: SortType) -> TimePeriodCollection {\n\t\tvar sortedList: [TimePeriodProtocol]!\n\t\tswitch type {\n\t\tcase .duration(let mode):\tsortedList = periods.sorted(by: sortFuncDuration(mode))\n\t\tcase .start(let mode):\t\tsortedList = periods.sorted(by: sortFunc(byStart: true, type: mode))\n\t\tcase .end(let mode):\t\tsortedList = periods.sorted(by: sortFunc(byStart: false, type: mode))\n\t\tcase .custom(let f):\t\tsortedList = periods.sorted(by: f)\n\t\t}\n\t\treturn TimePeriodCollection(sortedList)\n\t}\n\n\t// MARK: - Collection Relationship\n\n\t/// Returns from the `TimePeriodCollection` a sub-collection of `TimePeriod`s\n\t/// whose start and end dates fall completely inside the interval of the given `TimePeriod`.\n\t///\n\t/// - Parameter period: The period to compare each other period against\n\t/// - Returns: Collection of periods inside the given period\n\tpublic func periodsInside(period: TimePeriodProtocol) -> TimePeriodCollection {\n\t\treturn TimePeriodCollection(periods.filter({ $0.isInside(period) }))\n\t}\n\n\t//  Returns from the `TimePeriodCollection` a sub-collection of `TimePeriod`s containing the given date.\n\t///\n\t/// - Parameter date: The date to compare each period to\n\t/// - Returns: Collection of periods intersected by the given date\n\tpublic func periodsIntersected(by date: DateInRegion) -> TimePeriodCollection {\n\t\treturn TimePeriodCollection(periods.filter({ $0.contains(date: date, interval: .closed) }))\n\t}\n\n\t/// Returns from the `TimePeriodCollection` a sub-collection of `TimePeriod`s\n\t/// containing either the start date or the end date--or both--of the given `TimePeriod`.\n\t///\n\t/// - Parameter period: The period to compare each other period to\n\t/// - Returns: Collection of periods intersected by the given period\n\tpublic func periodsIntersected(by period: TimePeriodProtocol) -> TimePeriodCollection {\n\t\treturn TimePeriodCollection(periods.filter({ $0.intersects(with: period) }))\n\t}\n\n\t/// Returns an instance of DTTimePeriodCollection with all the time periods in the receiver that overlap a given time period.\n\t/// Overlap with the given time period does NOT include other time periods that simply touch it.\n\t/// (i.e. one's start date is equal to another's end date)\n\t///\n\t/// - Parameter period: The time period to check against the receiver's time periods.\n\t/// - Returns: Collection of periods overlapped by the given period\n\tpublic func periodsOverlappedBy(_ period: TimePeriodProtocol) -> TimePeriodCollection {\n\t\treturn TimePeriodCollection(periods.filter({ $0.overlaps(with: period) }))\n\t}\n\n\t// MARK: - Map\n\n\tpublic func map(_ transform: (TimePeriodProtocol) throws -> TimePeriodProtocol) rethrows -> TimePeriodCollection {\n\t\tvar mappedArray = [TimePeriodProtocol]()\n\t\tmappedArray = try periods.map(transform)\n\t\tlet mappedCollection = TimePeriodCollection()\n\t\tfor period in mappedArray {\n\t\t\tmappedCollection.periods.append(period)\n\t\t\tmappedCollection.updateExtremes(period: period)\n\t\t}\n\t\treturn mappedCollection\n\t}\n\n\t// MARK: - Helpers\n\n\tprivate func sortFuncDuration(_ type: SortMode) -> ((TimePeriodProtocol, TimePeriodProtocol) -> Bool) {\n\t\tswitch type {\n\t\tcase .ascending: \treturn { $0.duration < $1.duration }\n\t\tcase .descending: \treturn { $0.duration > $1.duration }\n\t\t}\n\t}\n\n\tprivate func sortFunc(byStart start: Bool = true, type: SortMode) -> ((TimePeriodProtocol, TimePeriodProtocol) -> Bool) {\n\t\treturn {\n\t\t\tlet date0 = (start ? $0.start : $0.end)\n\t\t\tlet date1 = (start ? $1.start : $1.end)\n\t\t\tif date0 == nil && date1 == nil {\n\t\t\t\treturn false\n\t\t\t} else if date0 == nil {\n\t\t\t\treturn true\n\t\t\t} else if date1 == nil {\n\t\t\t\treturn false\n\t\t\t} else {\n\t\t\t\treturn (type == .ascending ? date1! > date0! : date0! > date1!)\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate func updateExtremes(period: TimePeriodProtocol) {\n\t\t//Check incoming period against previous start and end date\n\t\tguard count != 1 else {\n\t\t\tstart = period.start\n\t\t\tend = period.end\n\t\t\treturn\n\t\t}\n\t\tstart = nilOrEarlier(date1: start, date2: period.start)\n\t\tend = nilOrLater(date1: end, date2: period.end)\n\t}\n\n\tprivate func updateExtremes() {\n\t\tguard periods.count > 0 else {\n\t\t\tstart = nil\n\t\t\tend = nil\n\t\t\treturn\n\t\t}\n\n\t\tstart = periods.first!.start\n\t\tend = periods.first!.end\n\t\tfor i in 1..<periods.count {\n\t\t\tstart = nilOrEarlier(date1: start, date2: periods[i].start)\n\t\t\tend = nilOrEarlier(date1: end, date2: periods[i].end)\n\t\t}\n\t}\n\n\tprivate func nilOrEarlier(date1: DateInRegion?, date2: DateInRegion?) -> DateInRegion? {\n\t\tguard date1 != nil && date2 != nil else { return nil }\n\t\treturn date1!.earlierDate(date2!)\n\t}\n\n\tprivate func nilOrLater(date1: DateInRegion?, date2: DateInRegion?) -> DateInRegion? {\n\t\tguard date1 != nil && date2 != nil else { return nil }\n\t\treturn date1!.laterDate(date2!)\n\t}\n\n}\n"
  },
  {
    "path": "Sources/SwiftDate/TimePeriod/Groups/TimePeriodGroup.swift",
    "content": "//\n//  SwiftDate\n//  Parse, validate, manipulate, and display dates, time and timezones in Swift\n//\n//  Created by Daniele Margutti\n//   - Web: https://www.danielemargutti.com\n//   - Twitter: https://twitter.com/danielemargutti\n//   - Mail: hello@danielemargutti.com\n//\n//  Copyright © 2019 Daniele Margutti. Licensed under MIT License.\n//\n\nimport Foundation\n\n/// Time period groups are the final abstraction of date and time in DateTools.\n/// Here, time periods are gathered and organized into something useful.\n/// There are two main types of time period groups, `TimePeriodCollection` and `TimePeriodChain`.\nopen class TimePeriodGroup: Sequence, Equatable {\n\n\t/// Array of periods that define the group.\n\tinternal var periods: [TimePeriodProtocol] = []\n\n\t/// The earliest beginning date of a `TimePeriod` in the group.\n\t/// `nil` if any `TimePeriod` in group has a nil beginning date (indefinite).\n\tpublic internal(set) var start: DateInRegion?\n\n\t/// The latest end date of a `TimePeriod` in the group.\n\t/// `nil` if any `TimePeriod` in group has a nil end date (indefinite).\n\tpublic internal(set) var end: DateInRegion?\n\n\t/// The total amount of time between the earliest and latest dates stored in the periods array.\n\t/// `nil` if any beginning or end date in any contained period is `nil`.\n\tpublic var duration: TimeInterval? {\n\t\tguard let start = start, let end = end else { return nil }\n\t\treturn end.timeIntervalSince(start)\n\t}\n\n\t/// The number of periods in the periods array.\n\tpublic var count: Int {\n\t\treturn periods.count\n\t}\n\n\t// MARK: - Equatable\n\n\tpublic static func == (lhs: TimePeriodGroup, rhs: TimePeriodGroup) -> Bool {\n\t\treturn TimePeriodGroup.hasSameElements(array1: lhs.periods, rhs.periods)\n\t}\n\n\t// MARK: - Initializers\n\n\tpublic init(_ periods: [TimePeriodProtocol]? = nil) {\n\t\tself.periods = (periods ?? [])\n\t}\n\n\t// MARK: - Sequence Protocol\n\n\tpublic func makeIterator() -> IndexingIterator<[TimePeriodProtocol]> {\n\t\treturn periods.makeIterator()\n\t}\n\n\tpublic func map<T>(_ transform: (TimePeriodProtocol) throws -> T) rethrows -> [T] {\n\t\treturn try periods.map(transform)\n\t}\n\n\tpublic func filter(_ isIncluded: (TimePeriodProtocol) throws -> Bool) rethrows -> [TimePeriodProtocol] {\n\t\treturn try periods.filter(isIncluded)\n\t}\n\n\tpublic func forEach(_ body: (TimePeriodProtocol) throws -> Void) rethrows {\n\t\treturn try periods.forEach(body)\n\t}\n\n\tpublic func split(maxSplits: Int, omittingEmptySubsequences: Bool, whereSeparator isSeparator: (TimePeriodProtocol) throws -> Bool) rethrows -> [AnySequence<TimePeriodProtocol>] {\n\t\treturn try periods.split(maxSplits: maxSplits, omittingEmptySubsequences: omittingEmptySubsequences, whereSeparator: isSeparator).map(AnySequence.init)\n\t}\n\n\tpublic subscript(index: Int) -> TimePeriodProtocol {\n\t\tget {\n\t\t\treturn periods[index]\n\t\t}\n\t}\n\n\tinternal func reduce<Result>(_ initialResult: Result, _ nextPartialResult: (Result, TimePeriodProtocol) throws -> Result) rethrows -> Result {\n\t\treturn try periods.reduce(initialResult, nextPartialResult)\n\t}\n\n\t// MARK: - Internal Helper Functions\n\n\tinternal static func hasSameElements(array1: [TimePeriodProtocol], _ array2: [TimePeriodProtocol]) -> Bool {\n\t\tguard array1.count == array2.count else {\n\t\t\treturn false // No need to sorting if they already have different counts\n\t\t}\n\n\t\tlet compArray1: [TimePeriodProtocol] = array1.sorted { (period1: TimePeriodProtocol, period2: TimePeriodProtocol) -> Bool in\n\t\t\tif period1.start == nil && period2.start == nil {\n\t\t\t\treturn false\n\t\t\t} else if period1.start == nil {\n\t\t\t\treturn true\n\t\t\t} else if period2.start == nil {\n\t\t\t\treturn false\n\t\t\t} else {\n\t\t\t\treturn period2.start! < period1.start!\n\t\t\t}\n\t\t}\n\t\tlet compArray2: [TimePeriodProtocol] = array2.sorted { (period1: TimePeriodProtocol, period2: TimePeriodProtocol) -> Bool in\n\t\t\tif period1.start == nil && period2.start == nil {\n\t\t\t\treturn false\n\t\t\t} else if period1.start == nil {\n\t\t\t\treturn true\n\t\t\t} else if period2.start == nil {\n\t\t\t\treturn false\n\t\t\t} else {\n\t\t\t\treturn period2.start! < period1.start!\n\t\t\t}\n\t\t}\n\t\tfor x in 0..<compArray1.count {\n\t\t\tif !compArray1[x].equals(compArray2[x]) {\n\t\t\t\treturn false\n\t\t\t}\n\t\t}\n\t\treturn true\n\t}\n}\n"
  },
  {
    "path": "Sources/SwiftDate/TimePeriod/TimePeriod+Support.swift",
    "content": "//\n//  SwiftDate\n//  Parse, validate, manipulate, and display dates, time and timezones in Swift\n//\n//  Created by Daniele Margutti\n//   - Web: https://www.danielemargutti.com\n//   - Twitter: https://twitter.com/danielemargutti\n//   - Mail: hello@danielemargutti.com\n//\n//  Copyright © 2019 Daniele Margutti. Licensed under MIT License.\n//\n\nimport Foundation\n\n/// There may come a need, say when you are making a scheduling app, when\n/// it might be good to know how two time periods relate to one another\n/// Are they the same? Is one inside of another?\n/// All these questions may be asked using the relationship method of TimePeriod.\npublic enum TimePeriodRelation {\n\tcase after\n\tcase startTouching\n\tcase startInside\n\tcase insideStartTouching\n\tcase enclosingStartTouching\n\tcase enclosing\n\tcase enclosingEndTouching\n\tcase exactMatch\n\tcase inside\n\tcase insideEndTouching\n\tcase endInside\n\tcase endTouching\n\tcase before\n\tcase none\n}\n\n/// Whether the time period is Open or Closed\n///\n/// - open: The boundary moment of time is included in calculations.\n/// - closed: The boundary moment of time represents a boundary value which is excluded in regard to calculations.\npublic enum IntervalType {\n\tcase open\n\tcase closed\n}\n\n/// When a time periods is lengthened or shortened, it does so anchoring one date\n/// of the time period and then changing the other one. There is also an option to\n/// anchor the centerpoint of the time period, changing both the start and end dates.\npublic enum TimePeriodAnchor {\n\tcase beginning\n\tcase center\n\tcase end\n}\n"
  },
  {
    "path": "Sources/SwiftDate/TimePeriod/TimePeriod.swift",
    "content": "//\n//  SwiftDate\n//  Parse, validate, manipulate, and display dates, time and timezones in Swift\n//\n//  Created by Daniele Margutti\n//   - Web: https://www.danielemargutti.com\n//   - Twitter: https://twitter.com/danielemargutti\n//   - Mail: hello@danielemargutti.com\n//\n//  Copyright © 2019 Daniele Margutti. Licensed under MIT License.\n//\n\nimport Foundation\n\n/// Time periods are represented by the TimePeriodProtocol protocol.\n/// Required variables and method impleementations are bound below.\n/// An inheritable implementation of the TimePeriodProtocol is available through the TimePeriod class.\nopen class TimePeriod: TimePeriodProtocol {\n\n\t/// The start date for a TimePeriod representing the starting boundary of the time period\n\tpublic var start: DateInRegion?\n\n\t/// The end date for a TimePeriod representing the ending boundary of the time period\n\tpublic var end: DateInRegion?\n\n\t// MARK: - Initializers\n\n\tpublic init() { }\n\n\t/// Create a new time period with given date range.\n\t///\n\t/// - Parameters:\n\t///   - start: start date\n\t///   - end: end date\n\tpublic init(start: DateInRegion?, end: DateInRegion?) {\n\t\tself.start = start\n\t\tself.end = end\n\t}\n\n\t/// Create a new time period with given start and a length specified in number of seconds.\n\t///\n\t/// - Parameters:\n\t///   - start: start of the period\n\t///   - duration: duration of the period expressed in seconds\n\tpublic init(start: DateInRegion, duration: TimeInterval) {\n\t\tself.start = start\n\t\tself.end = DateInRegion(start.date.addingTimeInterval(duration), region: start.region)\n\t}\n\n\t/// Create a new time period which ends at given date and start date is back on time by given interval.\n\t///\n\t/// - Parameters:\n\t///   - end: end date\n\t///   - duration: duration expressed in seconds (it will be subtracted from start date)\n\tpublic init(end: DateInRegion, duration: TimeInterval) {\n\t\tself.end = end\n\t\tself.start = end.addingTimeInterval(-duration)\n\t}\n\n\t/// Return a new instance of the TimePeriod that starts on the provided start date and is of the\n\t/// size provided.\n\t///\n\t/// - Parameters:\n\t///   - start: start of the period\n\t///   - duration: length of the period (ie. `2.days` or `14.hours`...)\n\tpublic init(start: DateInRegion, duration: DateComponents) {\n\t\tself.start = start\n\t\tself.end = (start + duration)\n\t}\n\n\t/// Return a new instance of the TimePeriod that starts at end time minus given duration.\n\t///\n\t/// - Parameters:\n\t///   - end: end date\n\t///   - duration: duration (it will be subtracted from end date in order to provide the start date)\n\tpublic init(end: DateInRegion, duration: DateComponents) {\n\t\tself.start = (end - duration)\n\t\tself.end = end\n\t}\n\n\t/// Returns a new instance of DTTimePeriod that represents the largest time period available.\n\t/// The start date is in the distant past and the end date is in the distant future.\n\t///\n\t/// - Returns: a new time period\n\tpublic static func infinity() -> TimePeriod {\n\t\treturn TimePeriod(start: DateInRegion.past(), end: DateInRegion.future())\n\t}\n\n\t// MARK: - Shifted\n\n\t/// Shift the `TimePeriod` by a `TimeInterval`\n\t///\n\t/// - Parameter timeInterval: The time interval to shift the period by\n\t/// - Returns: The new, shifted `TimePeriod`\n\tpublic func shifted(by timeInterval: TimeInterval) -> TimePeriod {\n\t\tlet timePeriod = TimePeriod()\n\t\ttimePeriod.start = start?.addingTimeInterval(timeInterval)\n\t\ttimePeriod.end = end?.addingTimeInterval(timeInterval)\n\t\treturn timePeriod\n\t}\n\n\t/// Shift the `TimePeriod` by the specified components value.\n\t/// ie. `let shifted = period.shifted(by: 3.days)`\n\t///\n\t/// - Parameter components: components to shift\n\t/// - Returns: new period\n\tpublic func shifted(by components: DateComponents) -> TimePeriod {\n\t\tlet timePeriod = TimePeriod()\n\t\ttimePeriod.start = (hasStart ? (start! + components) : nil)\n\t\ttimePeriod.end = (hasEnd ? (end! + components) : nil)\n\t\treturn timePeriod\n\t}\n\n\t// MARK: - Lengthen / Shorten\n\n\t/// Lengthen the `TimePeriod` by a `TimeInterval`\n\t///\n\t/// - Parameters:\n\t///   - timeInterval: The time interval to lengthen the period by\n\t///   - anchor: The anchor point from which to make the change\n\t/// - Returns: The new, lengthened `TimePeriod`\n\tpublic func lengthened(by timeInterval: TimeInterval, at anchor: TimePeriodAnchor) -> TimePeriod {\n\t\tlet timePeriod = TimePeriod()\n\t\tswitch anchor {\n\t\tcase .beginning:\n\t\t\ttimePeriod.start = start\n\t\t\ttimePeriod.end = end?.addingTimeInterval(timeInterval)\n\t\tcase .center:\n\t\t\ttimePeriod.start = start?.addingTimeInterval(-timeInterval)\n\t\t\ttimePeriod.end = end?.addingTimeInterval(timeInterval)\n\t\tcase .end:\n\t\t\ttimePeriod.start = start?.addingTimeInterval(-timeInterval)\n\t\t\ttimePeriod.end = end\n\t\t}\n\t\treturn timePeriod\n\t}\n\n\t/// Shorten the `TimePeriod` by a `TimeInterval`\n\t///\n\t/// - Parameters:\n\t///   - timeInterval:  The time interval to shorten the period by\n\t///   - anchor: The anchor point from which to make the change\n\t/// - Returns: The new, shortened `TimePeriod`\n\tpublic func shortened(by timeInterval: TimeInterval, at anchor: TimePeriodAnchor) -> TimePeriod {\n\t\tlet timePeriod = TimePeriod()\n\t\tswitch anchor {\n\t\tcase .beginning:\n\t\t\ttimePeriod.start = start\n\t\t\ttimePeriod.end = end?.addingTimeInterval(-timeInterval)\n\t\tcase .center:\n\t\t\ttimePeriod.start = start?.addingTimeInterval(-timeInterval / 2)\n\t\t\ttimePeriod.end = end?.addingTimeInterval(timeInterval / 2)\n\t\tcase .end:\n\t\t\ttimePeriod.start = start?.addingTimeInterval(timeInterval)\n\t\t\ttimePeriod.end = end\n\t\t}\n\t\treturn timePeriod\n\t}\n\n\t// MARK: - Operator Overloads\n\n\t/// Default anchor = beginning\n\t/// Operator overload for lengthening a `TimePeriod` by a `TimeInterval`\n\tpublic static func + (leftAddend: TimePeriod, rightAddend: TimeInterval) -> TimePeriod {\n\t\treturn leftAddend.lengthened(by: rightAddend, at: .beginning)\n\t}\n\n\t/// Default anchor = beginning\n\t/// Operator overload for shortening a `TimePeriod` by a `TimeInterval`\n\tpublic static func - (minuend: TimePeriod, subtrahend: TimeInterval) -> TimePeriod {\n\t\treturn minuend.shortened(by: subtrahend, at: .beginning)\n\t}\n\n\t/// Operator overload for checking if a `TimePeriod` is equal to a `TimePeriodProtocol`\n\tpublic static func == (left: TimePeriod, right: TimePeriodProtocol) -> Bool {\n\t\treturn left.equals(right)\n\t}\n\n}\n\npublic extension TimePeriod {\n\n    /// The start date of the time period\n    var startDate: Date? {\n        return start?.date\n    }\n\n    /// The end date of the time period\n    var endDate: Date? {\n        return end?.date\n    }\n\n    /// Create a new time period with the given start date, end date and region (default is UTC)\n    convenience init(startDate: Date, endDate: Date, region: Region = Region.UTC) {\n        let start = DateInRegion(startDate, region: region)\n        let end = DateInRegion(endDate, region: region)\n        self.init(start: start, end: end)\n    }\n}\n"
  },
  {
    "path": "Sources/SwiftDate/TimePeriod/TimePeriodProtocol.swift",
    "content": "//\n//  SwiftDate\n//  Parse, validate, manipulate, and display dates, time and timezones in Swift\n//\n//  Created by Daniele Margutti\n//   - Web: https://www.danielemargutti.com\n//   - Twitter: https://twitter.com/danielemargutti\n//   - Mail: hello@danielemargutti.com\n//\n//  Copyright © 2019 Daniele Margutti. Licensed under MIT License.\n//\n\nimport Foundation\n\npublic protocol TimePeriodProtocol {\n\n\t/// The start date for a TimePeriod representing the starting boundary of the time period\n\tvar start: DateInRegion? { get set }\n\n\t/// The end date for a TimePeriod representing the ending boundary of the time period\n\tvar end: DateInRegion? { get set }\n\n}\n\npublic extension TimePeriodProtocol {\n\n\t/// Return `true` if time period has both start and end dates\n\tvar hasFiniteRange: Bool {\n\t\tguard start != nil && end != nil else { return false }\n\t\treturn true\n\t}\n\n\t/// Return `true` if period has a start date\n\tvar hasStart: Bool {\n\t\treturn (start != nil)\n\t}\n\n\t/// Return `true` if period has a end date\n\tvar hasEnd: Bool {\n\t\treturn (end != nil)\n\t}\n\n\t/// Check if receiver is equal to given period (both start/end groups are equals)\n\t///\n\t/// - Parameter period: period to compare against to.\n\t/// - Returns: true if are equals\n\tfunc equals(_ period: TimePeriodProtocol) -> Bool {\n\t\treturn (start == period.start && end == period.end)\n\t}\n\n\t/// If the given `TimePeriod`'s beginning is before `beginning` and\n\t/// if the given 'TimePeriod`'s end is after `end`.\n\t///\n\t/// - Parameter period: The time period to compare to self\n\t/// - Returns: True if self is inside of the given `TimePeriod`\n\tfunc isInside(_ period: TimePeriodProtocol) -> Bool {\n\t\tguard hasFiniteRange, period.hasFiniteRange else { return false }\n\t\treturn (period.start! <= start! && period.end! >= end!)\n\t}\n\n\t/// If the given Date is after `beginning` and before `end`.\n\t///\n\t/// - Parameters:\n\t///   - date: The time period to compare to self\n\t///   - interval: Whether the edge of the date is included in the calculation\n\t/// - Returns: True if the given `TimePeriod` is inside of self\n\tfunc contains(date: DateInRegion, interval: IntervalType = .closed) -> Bool {\n\t\tguard hasFiniteRange else { return false }\n\t\tswitch interval {\n\t\tcase .closed:\treturn (start! <= date && end! >= date)\n\t\tcase .open:\t\treturn (start! < date && end! > date)\n\t\t}\n\t}\n\n\t/// If the given `TimePeriod`'s beginning is after `beginning` and\n\t/// if the given 'TimePeriod`'s after is after `end`.\n\t///\n\t/// - Parameter period: The time period to compare to self\n\t/// - Returns: True if the given `TimePeriod` is inside of self\n\tfunc contains(_ period: TimePeriodProtocol) -> Bool {\n\t\tguard hasFiniteRange, period.hasFiniteRange else { return false }\n\t\tif period.start! < start! && period.end! > start! {\n\t\t\treturn true // Outside -> Inside\n\t\t} else if period.start! >= start! && period.end! <= end! {\n\t\t\treturn true // Enclosing\n\t\t} else if period.start! < end! && period.end! > end! {\n\t\t\treturn true // Inside -> Out\n\t\t}\n\t\treturn false\n\t}\n\n\t/// If self and the given `TimePeriod` share any sub-`TimePeriod`.\n\t///\n\t/// - Parameter period: The time period to compare to self\n\t/// - Returns: True if there is a period of time that is shared by both `TimePeriod`s\n\tfunc overlaps(with period: TimePeriodProtocol) -> Bool {\n\t\tif period.start! < start! && period.end! > start! {\n\t\t\treturn true // Outside -> Inside\n\t\t} else if period.start! >= start! && period.end! <= end! {\n\t\t\treturn true // Enclosing\n\t\t} else if period.start! < end! && period.end! > end! {\n\t\t\treturn true // Inside -> Out\n\t\t}\n\t\treturn false\n\t}\n\n\t/// If self and the given `TimePeriod` overlap or the period's edges touch.\n\t///\n\t/// - Parameter period: The time period to compare to self\n\t/// - Returns: True if there is a period of time or moment that is shared by both `TimePeriod`s\n\tfunc intersects(with period: TimePeriodProtocol) -> Bool {\n\t\tlet relation = self.relation(to: period)\n\t\treturn (relation != .after && relation != .before)\n\t}\n\n\t/// If self is before the given `TimePeriod` chronologically. (A gap must exist between the two).\n\t///\n\t/// - Parameter period: The time period to compare to self\n\t/// - Returns: True if self is after the given `TimePeriod`\n\tfunc isBefore(_ period: TimePeriodProtocol) -> Bool {\n\t\treturn (relation(to: period) == .before)\n\t}\n\n\t/// If self is after the given `TimePeriod` chronologically. (A gap must exist between the two).\n\t///\n\t/// - Parameter period: The time period to compare to self\n\t/// - Returns: True if self is after the given `TimePeriod`\n\tfunc isAfter(_ period: TimePeriodProtocol) -> Bool {\n\t\treturn (relation(to: period) == .after)\n\t}\n\n\t/// The period of time between self and the given `TimePeriod` not contained by either.\n\t///\n\t/// - Parameter period: The time period to compare to self\n\t/// - Returns: The gap between the periods. Zero if there is no gap.\n\tfunc hasGap(between period: TimePeriodProtocol) -> Bool {\n\t\treturn (isBefore(period) || isAfter(period))\n\t}\n\n\t/// The period of time between self and the given `TimePeriod` not contained by either.\n\t///\n\t/// - Parameter period: The time period to compare to self\n\t/// - Returns: The gap between the periods. Zero if there is no gap.\n\tfunc gap(between period: TimePeriodProtocol) -> TimeInterval {\n\t\tguard hasFiniteRange, period.hasFiniteRange else { return TimeInterval.greatestFiniteMagnitude }\n\t\tif end! < period.start! {\n\t\t\treturn abs(end!.timeIntervalSince(period.start!))\n\t\t} else if period.end! < start! {\n\t\t\treturn abs(end!.timeIntervalSince(start!))\n\t\t}\n\t\treturn 0\n\t}\n\n\t/// In place, shift the `TimePeriod` by a `TimeInterval`\n\t///\n\t/// - Parameter timeInterval: The time interval to shift the period by\n\tmutating func shift(by timeInterval: TimeInterval) {\n\t\tstart?.addTimeInterval(timeInterval)\n\t\tend?.addTimeInterval(timeInterval)\n\t}\n\n\t/// In place, lengthen the `TimePeriod`, anchored at the beginning, end or center\n\t///\n\t/// - Parameters:\n\t///   - timeInterval: The time interval to lengthen the period by\n\t///   - anchor: The anchor point from which to make the change\n\tmutating func lengthen(by timeInterval: TimeInterval, at anchor: TimePeriodAnchor) {\n\t\tswitch anchor {\n\t\tcase .beginning:\n\t\t\tend?.addTimeInterval(timeInterval)\n\t\tcase .end:\n\t\t\tstart?.addTimeInterval(timeInterval)\n\t\tcase .center:\n\t\t\tstart = start?.addingTimeInterval(-timeInterval / 2.0)\n\t\t\tend = end?.addingTimeInterval(timeInterval / 2.0)\n\t\t}\n\t}\n\n\t/// In place, shorten the `TimePeriod`, anchored at the beginning, end or center\n\t///\n\t/// - Parameters:\n\t///   - timeInterval: The time interval to shorten the period by\n\t///   - anchor: The anchor point from which to make the change\n\tmutating func shorten(by timeInterval: TimeInterval, at anchor: TimePeriodAnchor) {\n\t\tswitch anchor {\n\t\tcase .beginning:\n\t\t\tend?.addTimeInterval(-timeInterval)\n\t\tcase .end:\n\t\t\tstart?.addTimeInterval(timeInterval)\n\t\tcase .center:\n\t\t\tstart?.addTimeInterval(timeInterval / 2.0)\n\t\t\tend?.addTimeInterval(-timeInterval / 2.0)\n\t\t}\n\t}\n\n\t/// The relationship of the self `TimePeriod` to the given `TimePeriod`.\n\t/// Relations are stored in Enums.swift. Formal defnitions available in the provided\n\t/// links:\n\t/// [GitHub](https://github.com/MatthewYork/DateTools#relationships),\n\t/// [CodeProject](http://www.codeproject.com/Articles/168662/Time-Period-Library-for-NET)\n\t///\n\t/// - Parameter period: The time period to compare to self\n\t/// - Returns: The relationship between self and the given time period\n\tfunc relation(to period: TimePeriodProtocol) -> TimePeriodRelation {\n\t\t//Make sure that all start and end points exist for comparison\n\t\tguard hasFiniteRange, period.hasFiniteRange else { return .none }\n\t\t//Make sure time periods are of positive durations\n\t\tguard start! < end! && period.start! < period.end! else { return .none }\n\t\t//Make comparisons\n\t\tif period.start! < start! {\n\t\t\treturn .after\n\t\t} else if period.end! == start! {\n\t\t\treturn .startTouching\n\t\t} else if period.start! < start! && period.end! < end! {\n\t\t\treturn .startInside\n\t\t} else if period.start! == start! && period.end! > end! {\n\t\t\treturn .insideStartTouching\n\t\t} else if period.start! == start! && period.end! < end! {\n\t\t\treturn .enclosingStartTouching\n\t\t} else if period.start! > start! && period.end! < end! {\n\t\t\treturn .enclosing\n\t\t} else if period.start! > start! && period.end! == end! {\n\t\t\treturn .enclosingEndTouching\n\t\t} else if period.start == start! && period.end! == end! {\n\t\t\treturn .exactMatch\n\t\t} else if period.start! < start! && period.end! > end! {\n\t\t\treturn .inside\n\t\t} else if period.start! < start! && period.end! == end! {\n\t\t\treturn .insideEndTouching\n\t\t} else if period.start! < end! && period.end! > end! {\n\t\t\treturn .endInside\n\t\t} else if period.start! == end! && period.end! > end! {\n\t\t\treturn .endTouching\n\t\t} else if period.start! > end! {\n\t\t\treturn .before\n\t\t}\n\t\treturn .none\n\t}\n\n\t/// Return `true` if period is zero-seconds long or less than specified precision.\n\t///\n\t/// - Parameter precision: precision in seconds; by default is 0.\n\t/// - Returns: true if start/end has the same value or less than specified precision\n\tfunc isMoment(precision: TimeInterval = 0) -> Bool {\n\t\tguard hasFiniteRange else { return false }\n\t\treturn (abs(start!.date.timeIntervalSince1970 - end!.date.timeIntervalSince1970) <= precision)\n\t}\n\n\t/// Returns the duration of the receiver expressed with given time unit.\n\t/// If time period has not a finite range it returns `nil`.\n\t///\n\t/// - Parameter unit: unit of the duration\n\t/// - Returns: duration, `nil` if period has not a finite range\n\tfunc durationIn(_ units: Set<Calendar.Component>) -> DateComponents? {\n\t\tguard hasFiniteRange else { return nil }\n\t\treturn start!.calendar.dateComponents(units, from: start!.date, to: end!.date)\n\t}\n\n\t/// Returns the duration of the receiver expressed with given time unit.\n\t/// If time period has not a finite range it returns `nil`.\n\t///\n\t/// - Parameter unit: unit of the duration\n\t/// - Returns: duration, `nil` if period has not a finite range\n\tfunc durationIn(_ unit: Calendar.Component) -> Int? {\n\t\tguard hasFiniteRange else { return nil }\n\t\treturn start!.calendar.dateComponents([unit], from: start!.date, to: end!.date).value(for: unit)\n\t}\n\n\t/// The duration of the `TimePeriod` in years.\n\t/// Returns the `Int.max` if beginning or end are `nil`.\n\tvar years: Int {\n\t\tguard let b = start, let e = end else { return Int.max }\n\t\treturn b.toUnit(.year, to: e)\n\t}\n\n\t/// The duration of the `TimePeriod` in months.\n\t/// Returns the `Int.max` if beginning or end are `nil`.\n\tvar months: Int {\n\t\tguard let b = start, let e = end else { return Int.max }\n\t\treturn b.toUnit(.month, to: e)\n\t}\n\n\t/// The duration of the `TimePeriod` in weeks.\n\t/// Returns the `Int.max` if beginning or end are `nil`.\n\tvar weeks: Int {\n\t\tguard let b = start, let e = end else { return Int.max }\n\t\treturn b.toUnit(.weekOfMonth, to: e)\n\t}\n\n\t/// The duration of the `TimePeriod` in days.\n\t/// Returns the `Int.max` if beginning or end are `nil`.\n\tvar days: Int {\n\t\tguard let b = start, let e = end else { return Int.max }\n\t\treturn b.toUnit(.day, to: e)\n\t}\n\n\t/// The duration of the `TimePeriod` in hours.\n\t/// Returns the `Int.max` if beginning or end are `nil`.\n\tvar hours: Int {\n\t\tguard let b = start, let e = end else { return Int.max }\n\t\treturn b.toUnit(.hour, to: e)\n\t}\n\n\t/// The duration of the `TimePeriod` in years.\n\t/// Returns the `Int.max` if beginning or end are `nil`.\n\tvar minutes: Int {\n\t\tguard let b = start, let e = end else { return Int.max }\n\t\treturn b.toUnit(.minute, to: e)\n\t}\n\n\t/// The duration of the `TimePeriod` in seconds.\n\t/// Returns the `Int.max` if beginning or end are `nil`.\n\tvar seconds: Int {\n\t\tguard let b = start, let e = end else { return Int.max }\n\t\treturn b.toUnit(.second, to: e)\n\t}\n\n\t/// The length of time between the beginning and end dates of the\n\t/// `TimePeriod` as a `TimeInterval`.\n\t/// If intervals are not nil returns `Double.greatestFiniteMagnitude`\n\tvar duration: TimeInterval {\n\t\tguard let b = start, let e = end else {\n\t\t\treturn TimeInterval(Double.greatestFiniteMagnitude)\n\t\t}\n\t\treturn abs(b.date.timeIntervalSince(e.date))\n\t}\n\n}\n"
  },
  {
    "path": "SwiftDate.podspec",
    "content": "Pod::Spec.new do |s|\n  s.name         = \"SwiftDate\"\n  s.version      = \"7.0.0\"\n  s.summary      = \"The best way to deal with Dates & Time Zones in Swift\"\n  s.homepage     = \"https://github.com/malcommac/SwiftDate.git\"\n  s.license      = { :type => \"MIT\", :file => \"LICENSE\" }\n  s.author             = { \"Daniele Margutti\" => \"hello@danielemargutti.com\" }\n  s.social_media_url   = \"https://twitter.com/danielemargutti\"\n  s.ios.deployment_target = \"13.0\"\n  s.osx.deployment_target = \"10.15\"\n  s.watchos.deployment_target = \"6.0\"\n  s.tvos.deployment_target = \"13.0\"\n  s.source       = { :git => \"https://github.com/malcommac/SwiftDate.git\", :tag => s.version.to_s }\n  s.source_files = 'Sources/**/*.swift'\n  s.frameworks  = \"Foundation\"\n  s.swift_versions = ['5.5']\nend\n"
  },
  {
    "path": "SwiftDate.xcodeproj/project.pbxproj",
    "content": "// !$*UTF8*$!\n{\n\tarchiveVersion = 1;\n\tclasses = {\n\t};\n\tobjectVersion = 47;\n\tobjects = {\n\n/* Begin PBXBuildFile section */\n\t\t52D6D9871BEFF229002C0205 /* SwiftDate.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 52D6D97C1BEFF229002C0205 /* SwiftDate.framework */; };\n\t\t6434DD6120C7FAF6007626EF /* DateInRegion.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6434DD6020C7FAF6007626EF /* DateInRegion.swift */; };\n\t\t6434DD6220C7FAF6007626EF /* DateInRegion.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6434DD6020C7FAF6007626EF /* DateInRegion.swift */; };\n\t\t6434DD6320C7FAF6007626EF /* DateInRegion.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6434DD6020C7FAF6007626EF /* DateInRegion.swift */; };\n\t\t6434DD6420C7FAF6007626EF /* DateInRegion.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6434DD6020C7FAF6007626EF /* DateInRegion.swift */; };\n\t\t6434DD6720C7FC6A007626EF /* Region.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6434DD6620C7FC6A007626EF /* Region.swift */; };\n\t\t6434DD6820C7FC6A007626EF /* Region.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6434DD6620C7FC6A007626EF /* Region.swift */; };\n\t\t6434DD6920C7FC6A007626EF /* Region.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6434DD6620C7FC6A007626EF /* Region.swift */; };\n\t\t6434DD6A20C7FC6A007626EF /* Region.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6434DD6620C7FC6A007626EF /* Region.swift */; };\n\t\t6434DD6D20C7FEED007626EF /* Zones.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6434DD6C20C7FEED007626EF /* Zones.swift */; };\n\t\t6434DD6E20C7FEED007626EF /* Zones.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6434DD6C20C7FEED007626EF /* Zones.swift */; };\n\t\t6434DD6F20C7FEED007626EF /* Zones.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6434DD6C20C7FEED007626EF /* Zones.swift */; };\n\t\t6434DD7020C7FEED007626EF /* Zones.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6434DD6C20C7FEED007626EF /* Zones.swift */; };\n\t\t6434DD7220C80126007626EF /* Calendars.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6434DD7120C80126007626EF /* Calendars.swift */; };\n\t\t6434DD7320C80126007626EF /* Calendars.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6434DD7120C80126007626EF /* Calendars.swift */; };\n\t\t6434DD7420C80126007626EF /* Calendars.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6434DD7120C80126007626EF /* Calendars.swift */; };\n\t\t6434DD7520C80126007626EF /* Calendars.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6434DD7120C80126007626EF /* Calendars.swift */; };\n\t\t6434DD7720C80263007626EF /* Locales.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6434DD7620C80263007626EF /* Locales.swift */; };\n\t\t6434DD7820C80263007626EF /* Locales.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6434DD7620C80263007626EF /* Locales.swift */; };\n\t\t6434DD7920C80263007626EF /* Locales.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6434DD7620C80263007626EF /* Locales.swift */; };\n\t\t6434DD7A20C80263007626EF /* Locales.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6434DD7620C80263007626EF /* Locales.swift */; };\n\t\t6434DD7C20C803EF007626EF /* SwiftDate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6434DD7B20C803EF007626EF /* SwiftDate.swift */; };\n\t\t6434DD7D20C803EF007626EF /* SwiftDate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6434DD7B20C803EF007626EF /* SwiftDate.swift */; };\n\t\t6434DD7E20C803EF007626EF /* SwiftDate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6434DD7B20C803EF007626EF /* SwiftDate.swift */; };\n\t\t6434DD7F20C803EF007626EF /* SwiftDate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6434DD7B20C803EF007626EF /* SwiftDate.swift */; };\n\t\t6434DD8F20C809B3007626EF /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6434DD8E20C809B3007626EF /* AppDelegate.swift */; };\n\t\t6434DD9120C809B3007626EF /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6434DD9020C809B3007626EF /* ViewController.swift */; };\n\t\t6434DD9420C809B3007626EF /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 6434DD9220C809B3007626EF /* Main.storyboard */; };\n\t\t6434DD9620C809B4007626EF /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 6434DD9520C809B4007626EF /* Assets.xcassets */; };\n\t\t6434DD9920C809B4007626EF /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 6434DD9720C809B4007626EF /* LaunchScreen.storyboard */; };\n\t\t6434DD9E20C809C2007626EF /* SwiftDate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6434DD7B20C803EF007626EF /* SwiftDate.swift */; };\n\t\t6434DD9F20C809C2007626EF /* Zones.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6434DD6C20C7FEED007626EF /* Zones.swift */; };\n\t\t6434DDA020C809C2007626EF /* Calendars.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6434DD7120C80126007626EF /* Calendars.swift */; };\n\t\t6434DDA120C809C2007626EF /* Locales.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6434DD7620C80263007626EF /* Locales.swift */; };\n\t\t6434DDA420C809C2007626EF /* DateInRegion.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6434DD6020C7FAF6007626EF /* DateInRegion.swift */; };\n\t\t6434DDA520C809C2007626EF /* Region.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6434DD6620C7FC6A007626EF /* Region.swift */; };\n\t\t6439231E20D90CB10098EC03 /* TestDateInRegion+Components.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6439231D20D90CB10098EC03 /* TestDateInRegion+Components.swift */; };\n\t\t6439231F20D90CB10098EC03 /* TestDateInRegion+Components.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6439231D20D90CB10098EC03 /* TestDateInRegion+Components.swift */; };\n\t\t6439232020D90CB10098EC03 /* TestDateInRegion+Components.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6439231D20D90CB10098EC03 /* TestDateInRegion+Components.swift */; };\n\t\t6439232220D912670098EC03 /* TestDateInRegion+Math.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6439232120D912670098EC03 /* TestDateInRegion+Math.swift */; };\n\t\t6439232320D912670098EC03 /* TestDateInRegion+Math.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6439232120D912670098EC03 /* TestDateInRegion+Math.swift */; };\n\t\t6439232420D912670098EC03 /* TestDateInRegion+Math.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6439232120D912670098EC03 /* TestDateInRegion+Math.swift */; };\n\t\t6439232620D91D170098EC03 /* TestFormatters.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6439232520D91D170098EC03 /* TestFormatters.swift */; };\n\t\t6439232720D91D170098EC03 /* TestFormatters.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6439232520D91D170098EC03 /* TestFormatters.swift */; };\n\t\t6439232820D91D170098EC03 /* TestFormatters.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6439232520D91D170098EC03 /* TestFormatters.swift */; };\n\t\t6470DD1420D27AF500BC2E74 /* String+Parser.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6470DD1320D27AF500BC2E74 /* String+Parser.swift */; };\n\t\t6470DD1520D27AF500BC2E74 /* String+Parser.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6470DD1320D27AF500BC2E74 /* String+Parser.swift */; };\n\t\t6470DD1620D27AF500BC2E74 /* String+Parser.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6470DD1320D27AF500BC2E74 /* String+Parser.swift */; };\n\t\t6470DD1720D27AF500BC2E74 /* String+Parser.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6470DD1320D27AF500BC2E74 /* String+Parser.swift */; };\n\t\t6470DD1820D27AF500BC2E74 /* String+Parser.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6470DD1320D27AF500BC2E74 /* String+Parser.swift */; };\n\t\t6470DD1A20D296EA00BC2E74 /* TimeInterval+Formatter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6470DD1920D296EA00BC2E74 /* TimeInterval+Formatter.swift */; };\n\t\t6470DD1B20D296EA00BC2E74 /* TimeInterval+Formatter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6470DD1920D296EA00BC2E74 /* TimeInterval+Formatter.swift */; };\n\t\t6470DD1C20D296EA00BC2E74 /* TimeInterval+Formatter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6470DD1920D296EA00BC2E74 /* TimeInterval+Formatter.swift */; };\n\t\t6470DD1D20D296EA00BC2E74 /* TimeInterval+Formatter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6470DD1920D296EA00BC2E74 /* TimeInterval+Formatter.swift */; };\n\t\t6470DD1E20D296EA00BC2E74 /* TimeInterval+Formatter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6470DD1920D296EA00BC2E74 /* TimeInterval+Formatter.swift */; };\n\t\t6470DD2120D2A55300BC2E74 /* TimePeriodProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6470DD2020D2A55300BC2E74 /* TimePeriodProtocol.swift */; };\n\t\t6470DD2220D2A55300BC2E74 /* TimePeriodProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6470DD2020D2A55300BC2E74 /* TimePeriodProtocol.swift */; };\n\t\t6470DD2320D2A55300BC2E74 /* TimePeriodProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6470DD2020D2A55300BC2E74 /* TimePeriodProtocol.swift */; };\n\t\t6470DD2420D2A55300BC2E74 /* TimePeriodProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6470DD2020D2A55300BC2E74 /* TimePeriodProtocol.swift */; };\n\t\t6470DD2520D2A55300BC2E74 /* TimePeriodProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6470DD2020D2A55300BC2E74 /* TimePeriodProtocol.swift */; };\n\t\t6470DD2E20D2B64200BC2E74 /* TimePeriod+Support.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6470DD2D20D2B64200BC2E74 /* TimePeriod+Support.swift */; };\n\t\t6470DD2F20D2B64200BC2E74 /* TimePeriod+Support.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6470DD2D20D2B64200BC2E74 /* TimePeriod+Support.swift */; };\n\t\t6470DD3020D2B64200BC2E74 /* TimePeriod+Support.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6470DD2D20D2B64200BC2E74 /* TimePeriod+Support.swift */; };\n\t\t6470DD3120D2B64200BC2E74 /* TimePeriod+Support.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6470DD2D20D2B64200BC2E74 /* TimePeriod+Support.swift */; };\n\t\t6470DD3220D2B64200BC2E74 /* TimePeriod+Support.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6470DD2D20D2B64200BC2E74 /* TimePeriod+Support.swift */; };\n\t\t647AD65621F4826100CF787E /* TimeStructures.swift in Sources */ = {isa = PBXBuildFile; fileRef = 647AD65521F4826100CF787E /* TimeStructures.swift */; };\n\t\t647AD65721F4826100CF787E /* TimeStructures.swift in Sources */ = {isa = PBXBuildFile; fileRef = 647AD65521F4826100CF787E /* TimeStructures.swift */; };\n\t\t647AD65821F4826100CF787E /* TimeStructures.swift in Sources */ = {isa = PBXBuildFile; fileRef = 647AD65521F4826100CF787E /* TimeStructures.swift */; };\n\t\t647AD65921F4826100CF787E /* TimeStructures.swift in Sources */ = {isa = PBXBuildFile; fileRef = 647AD65521F4826100CF787E /* TimeStructures.swift */; };\n\t\t647AD65A21F4826100CF787E /* TimeStructures.swift in Sources */ = {isa = PBXBuildFile; fileRef = 647AD65521F4826100CF787E /* TimeStructures.swift */; };\n\t\t647AD65C21F4851F00CF787E /* TestDataStructures.swift in Sources */ = {isa = PBXBuildFile; fileRef = 647AD65B21F4851F00CF787E /* TestDataStructures.swift */; };\n\t\t647AD65D21F4851F00CF787E /* TestDataStructures.swift in Sources */ = {isa = PBXBuildFile; fileRef = 647AD65B21F4851F00CF787E /* TestDataStructures.swift */; };\n\t\t647AD65E21F4851F00CF787E /* TestDataStructures.swift in Sources */ = {isa = PBXBuildFile; fileRef = 647AD65B21F4851F00CF787E /* TestDataStructures.swift */; };\n\t\t64990AF82286FC31006C427D /* langs in Resources */ = {isa = PBXBuildFile; fileRef = 64990AF72286FC31006C427D /* langs */; };\n\t\t64990AF92286FC31006C427D /* langs in Resources */ = {isa = PBXBuildFile; fileRef = 64990AF72286FC31006C427D /* langs */; };\n\t\t64990AFA2286FC31006C427D /* langs in Resources */ = {isa = PBXBuildFile; fileRef = 64990AF72286FC31006C427D /* langs */; };\n\t\t64990AFB2286FC31006C427D /* langs in Resources */ = {isa = PBXBuildFile; fileRef = 64990AF72286FC31006C427D /* langs */; };\n\t\t64990AFC2286FC31006C427D /* langs in Resources */ = {isa = PBXBuildFile; fileRef = 64990AF72286FC31006C427D /* langs */; };\n\t\t649D0E032287412C0056D42E /* RelativeFormatterLanguage.swift in Sources */ = {isa = PBXBuildFile; fileRef = 649D0E022287412C0056D42E /* RelativeFormatterLanguage.swift */; };\n\t\t649D0E042287412C0056D42E /* RelativeFormatterLanguage.swift in Sources */ = {isa = PBXBuildFile; fileRef = 649D0E022287412C0056D42E /* RelativeFormatterLanguage.swift */; };\n\t\t649D0E052287412C0056D42E /* RelativeFormatterLanguage.swift in Sources */ = {isa = PBXBuildFile; fileRef = 649D0E022287412C0056D42E /* RelativeFormatterLanguage.swift */; };\n\t\t649D0E062287412C0056D42E /* RelativeFormatterLanguage.swift in Sources */ = {isa = PBXBuildFile; fileRef = 649D0E022287412C0056D42E /* RelativeFormatterLanguage.swift */; };\n\t\t649D0E072287412C0056D42E /* RelativeFormatterLanguage.swift in Sources */ = {isa = PBXBuildFile; fileRef = 649D0E022287412C0056D42E /* RelativeFormatterLanguage.swift */; };\n\t\t649D473B20C81A2A00513A67 /* DateRepresentable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 649D473A20C81A2A00513A67 /* DateRepresentable.swift */; };\n\t\t649D473C20C81A2A00513A67 /* DateRepresentable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 649D473A20C81A2A00513A67 /* DateRepresentable.swift */; };\n\t\t649D473D20C81A2A00513A67 /* DateRepresentable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 649D473A20C81A2A00513A67 /* DateRepresentable.swift */; };\n\t\t649D473E20C81A2A00513A67 /* DateRepresentable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 649D473A20C81A2A00513A67 /* DateRepresentable.swift */; };\n\t\t649D473F20C81A2A00513A67 /* DateRepresentable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 649D473A20C81A2A00513A67 /* DateRepresentable.swift */; };\n\t\t649D474120C81A4200513A67 /* Date.swift in Sources */ = {isa = PBXBuildFile; fileRef = 649D474020C81A4200513A67 /* Date.swift */; };\n\t\t649D474220C81A4200513A67 /* Date.swift in Sources */ = {isa = PBXBuildFile; fileRef = 649D474020C81A4200513A67 /* Date.swift */; };\n\t\t649D474320C81A4200513A67 /* Date.swift in Sources */ = {isa = PBXBuildFile; fileRef = 649D474020C81A4200513A67 /* Date.swift */; };\n\t\t649D474420C81A4200513A67 /* Date.swift in Sources */ = {isa = PBXBuildFile; fileRef = 649D474020C81A4200513A67 /* Date.swift */; };\n\t\t649D474520C81A4200513A67 /* Date.swift in Sources */ = {isa = PBXBuildFile; fileRef = 649D474020C81A4200513A67 /* Date.swift */; };\n\t\t649D474820C8241C00513A67 /* Commons.swift in Sources */ = {isa = PBXBuildFile; fileRef = 649D474720C8241C00513A67 /* Commons.swift */; };\n\t\t649D474920C8241C00513A67 /* Commons.swift in Sources */ = {isa = PBXBuildFile; fileRef = 649D474720C8241C00513A67 /* Commons.swift */; };\n\t\t649D474A20C8241C00513A67 /* Commons.swift in Sources */ = {isa = PBXBuildFile; fileRef = 649D474720C8241C00513A67 /* Commons.swift */; };\n\t\t649D474B20C8241C00513A67 /* Commons.swift in Sources */ = {isa = PBXBuildFile; fileRef = 649D474720C8241C00513A67 /* Commons.swift */; };\n\t\t649D474C20C8241C00513A67 /* Commons.swift in Sources */ = {isa = PBXBuildFile; fileRef = 649D474720C8241C00513A67 /* Commons.swift */; };\n\t\t649D474E20C827C400513A67 /* AssociatedValues.swift in Sources */ = {isa = PBXBuildFile; fileRef = 649D474D20C827C400513A67 /* AssociatedValues.swift */; };\n\t\t649D474F20C827C400513A67 /* AssociatedValues.swift in Sources */ = {isa = PBXBuildFile; fileRef = 649D474D20C827C400513A67 /* AssociatedValues.swift */; };\n\t\t649D475020C827C400513A67 /* AssociatedValues.swift in Sources */ = {isa = PBXBuildFile; fileRef = 649D474D20C827C400513A67 /* AssociatedValues.swift */; };\n\t\t649D475120C827C400513A67 /* AssociatedValues.swift in Sources */ = {isa = PBXBuildFile; fileRef = 649D474D20C827C400513A67 /* AssociatedValues.swift */; };\n\t\t649D475220C827C400513A67 /* AssociatedValues.swift in Sources */ = {isa = PBXBuildFile; fileRef = 649D474D20C827C400513A67 /* AssociatedValues.swift */; };\n\t\t649D475A20C84FAC00513A67 /* ISOFormatter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 649D475920C84FAC00513A67 /* ISOFormatter.swift */; };\n\t\t649D475B20C84FAC00513A67 /* ISOFormatter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 649D475920C84FAC00513A67 /* ISOFormatter.swift */; };\n\t\t649D475C20C84FAC00513A67 /* ISOFormatter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 649D475920C84FAC00513A67 /* ISOFormatter.swift */; };\n\t\t649D475D20C84FAC00513A67 /* ISOFormatter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 649D475920C84FAC00513A67 /* ISOFormatter.swift */; };\n\t\t649D475E20C84FAC00513A67 /* ISOFormatter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 649D475920C84FAC00513A67 /* ISOFormatter.swift */; };\n\t\t649D476120C8529500513A67 /* Formatter+Protocols.swift in Sources */ = {isa = PBXBuildFile; fileRef = 649D476020C8529500513A67 /* Formatter+Protocols.swift */; };\n\t\t649D476220C8529500513A67 /* Formatter+Protocols.swift in Sources */ = {isa = PBXBuildFile; fileRef = 649D476020C8529500513A67 /* Formatter+Protocols.swift */; };\n\t\t649D476320C8529500513A67 /* Formatter+Protocols.swift in Sources */ = {isa = PBXBuildFile; fileRef = 649D476020C8529500513A67 /* Formatter+Protocols.swift */; };\n\t\t649D476420C8529500513A67 /* Formatter+Protocols.swift in Sources */ = {isa = PBXBuildFile; fileRef = 649D476020C8529500513A67 /* Formatter+Protocols.swift */; };\n\t\t649D476520C8529500513A67 /* Formatter+Protocols.swift in Sources */ = {isa = PBXBuildFile; fileRef = 649D476020C8529500513A67 /* Formatter+Protocols.swift */; };\n\t\t649D476D20C85C7100513A67 /* ISOParser.swift in Sources */ = {isa = PBXBuildFile; fileRef = 649D476C20C85C7100513A67 /* ISOParser.swift */; };\n\t\t649D476E20C85C7100513A67 /* ISOParser.swift in Sources */ = {isa = PBXBuildFile; fileRef = 649D476C20C85C7100513A67 /* ISOParser.swift */; };\n\t\t649D476F20C85C7100513A67 /* ISOParser.swift in Sources */ = {isa = PBXBuildFile; fileRef = 649D476C20C85C7100513A67 /* ISOParser.swift */; };\n\t\t649D477020C85C7100513A67 /* ISOParser.swift in Sources */ = {isa = PBXBuildFile; fileRef = 649D476C20C85C7100513A67 /* ISOParser.swift */; };\n\t\t649D477120C85C7100513A67 /* ISOParser.swift in Sources */ = {isa = PBXBuildFile; fileRef = 649D476C20C85C7100513A67 /* ISOParser.swift */; };\n\t\t649D477320C872DA00513A67 /* DotNetParserFormatter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 649D477220C872DA00513A67 /* DotNetParserFormatter.swift */; };\n\t\t649D477420C872DA00513A67 /* DotNetParserFormatter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 649D477220C872DA00513A67 /* DotNetParserFormatter.swift */; };\n\t\t649D477520C872DA00513A67 /* DotNetParserFormatter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 649D477220C872DA00513A67 /* DotNetParserFormatter.swift */; };\n\t\t649D477620C872DA00513A67 /* DotNetParserFormatter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 649D477220C872DA00513A67 /* DotNetParserFormatter.swift */; };\n\t\t649D477720C872DA00513A67 /* DotNetParserFormatter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 649D477220C872DA00513A67 /* DotNetParserFormatter.swift */; };\n\t\t649D477920C877C300513A67 /* DateInRegion+Create.swift in Sources */ = {isa = PBXBuildFile; fileRef = 649D477820C877C300513A67 /* DateInRegion+Create.swift */; };\n\t\t649D477A20C877C300513A67 /* DateInRegion+Create.swift in Sources */ = {isa = PBXBuildFile; fileRef = 649D477820C877C300513A67 /* DateInRegion+Create.swift */; };\n\t\t649D477B20C877C300513A67 /* DateInRegion+Create.swift in Sources */ = {isa = PBXBuildFile; fileRef = 649D477820C877C300513A67 /* DateInRegion+Create.swift */; };\n\t\t649D477C20C877C300513A67 /* DateInRegion+Create.swift in Sources */ = {isa = PBXBuildFile; fileRef = 649D477820C877C300513A67 /* DateInRegion+Create.swift */; };\n\t\t649D477D20C877C300513A67 /* DateInRegion+Create.swift in Sources */ = {isa = PBXBuildFile; fileRef = 649D477820C877C300513A67 /* DateInRegion+Create.swift */; };\n\t\t649D477F20C880DC00513A67 /* Date+Create.swift in Sources */ = {isa = PBXBuildFile; fileRef = 649D477E20C880DC00513A67 /* Date+Create.swift */; };\n\t\t649D478020C880DC00513A67 /* Date+Create.swift in Sources */ = {isa = PBXBuildFile; fileRef = 649D477E20C880DC00513A67 /* Date+Create.swift */; };\n\t\t649D478120C880DC00513A67 /* Date+Create.swift in Sources */ = {isa = PBXBuildFile; fileRef = 649D477E20C880DC00513A67 /* Date+Create.swift */; };\n\t\t649D478220C880DC00513A67 /* Date+Create.swift in Sources */ = {isa = PBXBuildFile; fileRef = 649D477E20C880DC00513A67 /* Date+Create.swift */; };\n\t\t649D478320C880DC00513A67 /* Date+Create.swift in Sources */ = {isa = PBXBuildFile; fileRef = 649D477E20C880DC00513A67 /* Date+Create.swift */; };\n\t\t649D478520C8861200513A67 /* DateInRegion+Components.swift in Sources */ = {isa = PBXBuildFile; fileRef = 649D478420C8861200513A67 /* DateInRegion+Components.swift */; };\n\t\t649D478620C8861200513A67 /* DateInRegion+Components.swift in Sources */ = {isa = PBXBuildFile; fileRef = 649D478420C8861200513A67 /* DateInRegion+Components.swift */; };\n\t\t649D478720C8861200513A67 /* DateInRegion+Components.swift in Sources */ = {isa = PBXBuildFile; fileRef = 649D478420C8861200513A67 /* DateInRegion+Components.swift */; };\n\t\t649D478820C8861200513A67 /* DateInRegion+Components.swift in Sources */ = {isa = PBXBuildFile; fileRef = 649D478420C8861200513A67 /* DateInRegion+Components.swift */; };\n\t\t649D478920C8861200513A67 /* DateInRegion+Components.swift in Sources */ = {isa = PBXBuildFile; fileRef = 649D478420C8861200513A67 /* DateInRegion+Components.swift */; };\n\t\t649D479220C913E200513A67 /* Date+Components.swift in Sources */ = {isa = PBXBuildFile; fileRef = 649D479120C913E200513A67 /* Date+Components.swift */; };\n\t\t649D479320C913E200513A67 /* Date+Components.swift in Sources */ = {isa = PBXBuildFile; fileRef = 649D479120C913E200513A67 /* Date+Components.swift */; };\n\t\t649D479420C913E200513A67 /* Date+Components.swift in Sources */ = {isa = PBXBuildFile; fileRef = 649D479120C913E200513A67 /* Date+Components.swift */; };\n\t\t649D479520C913E200513A67 /* Date+Components.swift in Sources */ = {isa = PBXBuildFile; fileRef = 649D479120C913E200513A67 /* Date+Components.swift */; };\n\t\t649D479620C913E200513A67 /* Date+Components.swift in Sources */ = {isa = PBXBuildFile; fileRef = 649D479120C913E200513A67 /* Date+Components.swift */; };\n\t\t649D47A420C91BEA00513A67 /* DateInRegion+Compare.swift in Sources */ = {isa = PBXBuildFile; fileRef = 649D47A320C91BEA00513A67 /* DateInRegion+Compare.swift */; };\n\t\t649D47A520C91BEA00513A67 /* DateInRegion+Compare.swift in Sources */ = {isa = PBXBuildFile; fileRef = 649D47A320C91BEA00513A67 /* DateInRegion+Compare.swift */; };\n\t\t649D47A620C91BEA00513A67 /* DateInRegion+Compare.swift in Sources */ = {isa = PBXBuildFile; fileRef = 649D47A320C91BEA00513A67 /* DateInRegion+Compare.swift */; };\n\t\t649D47A720C91BEA00513A67 /* DateInRegion+Compare.swift in Sources */ = {isa = PBXBuildFile; fileRef = 649D47A320C91BEA00513A67 /* DateInRegion+Compare.swift */; };\n\t\t649D47A820C91BEA00513A67 /* DateInRegion+Compare.swift in Sources */ = {isa = PBXBuildFile; fileRef = 649D47A320C91BEA00513A67 /* DateInRegion+Compare.swift */; };\n\t\t649D47AA20C91C0B00513A67 /* Date+Compare.swift in Sources */ = {isa = PBXBuildFile; fileRef = 649D47A920C91C0B00513A67 /* Date+Compare.swift */; };\n\t\t649D47AB20C91C0B00513A67 /* Date+Compare.swift in Sources */ = {isa = PBXBuildFile; fileRef = 649D47A920C91C0B00513A67 /* Date+Compare.swift */; };\n\t\t649D47AC20C91C0B00513A67 /* Date+Compare.swift in Sources */ = {isa = PBXBuildFile; fileRef = 649D47A920C91C0B00513A67 /* Date+Compare.swift */; };\n\t\t649D47AD20C91C0B00513A67 /* Date+Compare.swift in Sources */ = {isa = PBXBuildFile; fileRef = 649D47A920C91C0B00513A67 /* Date+Compare.swift */; };\n\t\t649D47AE20C91C0B00513A67 /* Date+Compare.swift in Sources */ = {isa = PBXBuildFile; fileRef = 649D47A920C91C0B00513A67 /* Date+Compare.swift */; };\n\t\t649D47B020C9276400513A67 /* DateComponents+Extras.swift in Sources */ = {isa = PBXBuildFile; fileRef = 649D47AF20C9276400513A67 /* DateComponents+Extras.swift */; };\n\t\t649D47B120C9276400513A67 /* DateComponents+Extras.swift in Sources */ = {isa = PBXBuildFile; fileRef = 649D47AF20C9276400513A67 /* DateComponents+Extras.swift */; };\n\t\t649D47B220C9276400513A67 /* DateComponents+Extras.swift in Sources */ = {isa = PBXBuildFile; fileRef = 649D47AF20C9276400513A67 /* DateComponents+Extras.swift */; };\n\t\t649D47B320C9276400513A67 /* DateComponents+Extras.swift in Sources */ = {isa = PBXBuildFile; fileRef = 649D47AF20C9276400513A67 /* DateComponents+Extras.swift */; };\n\t\t649D47B420C9276400513A67 /* DateComponents+Extras.swift in Sources */ = {isa = PBXBuildFile; fileRef = 649D47AF20C9276400513A67 /* DateComponents+Extras.swift */; };\n\t\t649D47B620C9586500513A67 /* DateInRegion+Math.swift in Sources */ = {isa = PBXBuildFile; fileRef = 649D47B520C9586500513A67 /* DateInRegion+Math.swift */; };\n\t\t649D47B720C9586500513A67 /* DateInRegion+Math.swift in Sources */ = {isa = PBXBuildFile; fileRef = 649D47B520C9586500513A67 /* DateInRegion+Math.swift */; };\n\t\t649D47B820C9586500513A67 /* DateInRegion+Math.swift in Sources */ = {isa = PBXBuildFile; fileRef = 649D47B520C9586500513A67 /* DateInRegion+Math.swift */; };\n\t\t649D47B920C9586500513A67 /* DateInRegion+Math.swift in Sources */ = {isa = PBXBuildFile; fileRef = 649D47B520C9586500513A67 /* DateInRegion+Math.swift */; };\n\t\t649D47BA20C9586500513A67 /* DateInRegion+Math.swift in Sources */ = {isa = PBXBuildFile; fileRef = 649D47B520C9586500513A67 /* DateInRegion+Math.swift */; };\n\t\t649D47BC20C959F500513A67 /* Date+Math.swift in Sources */ = {isa = PBXBuildFile; fileRef = 649D47BB20C959F500513A67 /* Date+Math.swift */; };\n\t\t649D47BD20C959F500513A67 /* Date+Math.swift in Sources */ = {isa = PBXBuildFile; fileRef = 649D47BB20C959F500513A67 /* Date+Math.swift */; };\n\t\t649D47BE20C959F500513A67 /* Date+Math.swift in Sources */ = {isa = PBXBuildFile; fileRef = 649D47BB20C959F500513A67 /* Date+Math.swift */; };\n\t\t649D47BF20C959F500513A67 /* Date+Math.swift in Sources */ = {isa = PBXBuildFile; fileRef = 649D47BB20C959F500513A67 /* Date+Math.swift */; };\n\t\t649D47C020C959F500513A67 /* Date+Math.swift in Sources */ = {isa = PBXBuildFile; fileRef = 649D47BB20C959F500513A67 /* Date+Math.swift */; };\n\t\t649D47C220C964E000513A67 /* Int+DateComponents.swift in Sources */ = {isa = PBXBuildFile; fileRef = 649D47C120C964E000513A67 /* Int+DateComponents.swift */; };\n\t\t649D47C320C964E000513A67 /* Int+DateComponents.swift in Sources */ = {isa = PBXBuildFile; fileRef = 649D47C120C964E000513A67 /* Int+DateComponents.swift */; };\n\t\t649D47C420C964E000513A67 /* Int+DateComponents.swift in Sources */ = {isa = PBXBuildFile; fileRef = 649D47C120C964E000513A67 /* Int+DateComponents.swift */; };\n\t\t649D47C520C964E000513A67 /* Int+DateComponents.swift in Sources */ = {isa = PBXBuildFile; fileRef = 649D47C120C964E000513A67 /* Int+DateComponents.swift */; };\n\t\t649D47C620C964E000513A67 /* Int+DateComponents.swift in Sources */ = {isa = PBXBuildFile; fileRef = 649D47C120C964E000513A67 /* Int+DateComponents.swift */; };\n\t\t649D47E120CAAB7400513A67 /* RelativeFormatter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 649D47E020CAAB7400513A67 /* RelativeFormatter.swift */; };\n\t\t649D47E220CAAB7400513A67 /* RelativeFormatter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 649D47E020CAAB7400513A67 /* RelativeFormatter.swift */; };\n\t\t649D47E320CAAB7400513A67 /* RelativeFormatter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 649D47E020CAAB7400513A67 /* RelativeFormatter.swift */; };\n\t\t649D47E420CAAB7400513A67 /* RelativeFormatter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 649D47E020CAAB7400513A67 /* RelativeFormatter.swift */; };\n\t\t649D47E520CAAB7400513A67 /* RelativeFormatter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 649D47E020CAAB7400513A67 /* RelativeFormatter.swift */; };\n\t\t649D47EE20CAB96D00513A67 /* RelativeFormatter+Style.swift in Sources */ = {isa = PBXBuildFile; fileRef = 649D47ED20CAB96D00513A67 /* RelativeFormatter+Style.swift */; };\n\t\t649D47EF20CAB96D00513A67 /* RelativeFormatter+Style.swift in Sources */ = {isa = PBXBuildFile; fileRef = 649D47ED20CAB96D00513A67 /* RelativeFormatter+Style.swift */; };\n\t\t649D47F020CAB96D00513A67 /* RelativeFormatter+Style.swift in Sources */ = {isa = PBXBuildFile; fileRef = 649D47ED20CAB96D00513A67 /* RelativeFormatter+Style.swift */; };\n\t\t649D47F120CAB96D00513A67 /* RelativeFormatter+Style.swift in Sources */ = {isa = PBXBuildFile; fileRef = 649D47ED20CAB96D00513A67 /* RelativeFormatter+Style.swift */; };\n\t\t649D47F220CAB96D00513A67 /* RelativeFormatter+Style.swift in Sources */ = {isa = PBXBuildFile; fileRef = 649D47ED20CAB96D00513A67 /* RelativeFormatter+Style.swift */; };\n\t\t64B5E25320D306220067EDC1 /* TimePeriod.swift in Sources */ = {isa = PBXBuildFile; fileRef = 64B5E25220D306220067EDC1 /* TimePeriod.swift */; };\n\t\t64B5E25420D306220067EDC1 /* TimePeriod.swift in Sources */ = {isa = PBXBuildFile; fileRef = 64B5E25220D306220067EDC1 /* TimePeriod.swift */; };\n\t\t64B5E25520D306220067EDC1 /* TimePeriod.swift in Sources */ = {isa = PBXBuildFile; fileRef = 64B5E25220D306220067EDC1 /* TimePeriod.swift */; };\n\t\t64B5E25620D306220067EDC1 /* TimePeriod.swift in Sources */ = {isa = PBXBuildFile; fileRef = 64B5E25220D306220067EDC1 /* TimePeriod.swift */; };\n\t\t64B5E25720D306220067EDC1 /* TimePeriod.swift in Sources */ = {isa = PBXBuildFile; fileRef = 64B5E25220D306220067EDC1 /* TimePeriod.swift */; };\n\t\t64B5E25920D3090A0067EDC1 /* TimePeriodGroup.swift in Sources */ = {isa = PBXBuildFile; fileRef = 64B5E25820D3090A0067EDC1 /* TimePeriodGroup.swift */; };\n\t\t64B5E25A20D3090A0067EDC1 /* TimePeriodGroup.swift in Sources */ = {isa = PBXBuildFile; fileRef = 64B5E25820D3090A0067EDC1 /* TimePeriodGroup.swift */; };\n\t\t64B5E25B20D3090A0067EDC1 /* TimePeriodGroup.swift in Sources */ = {isa = PBXBuildFile; fileRef = 64B5E25820D3090A0067EDC1 /* TimePeriodGroup.swift */; };\n\t\t64B5E25C20D3090A0067EDC1 /* TimePeriodGroup.swift in Sources */ = {isa = PBXBuildFile; fileRef = 64B5E25820D3090A0067EDC1 /* TimePeriodGroup.swift */; };\n\t\t64B5E25D20D3090A0067EDC1 /* TimePeriodGroup.swift in Sources */ = {isa = PBXBuildFile; fileRef = 64B5E25820D3090A0067EDC1 /* TimePeriodGroup.swift */; };\n\t\t64B5E26020D30AE40067EDC1 /* TimePeriodCollection.swift in Sources */ = {isa = PBXBuildFile; fileRef = 64B5E25F20D30AE40067EDC1 /* TimePeriodCollection.swift */; };\n\t\t64B5E26120D30AE40067EDC1 /* TimePeriodCollection.swift in Sources */ = {isa = PBXBuildFile; fileRef = 64B5E25F20D30AE40067EDC1 /* TimePeriodCollection.swift */; };\n\t\t64B5E26220D30AE40067EDC1 /* TimePeriodCollection.swift in Sources */ = {isa = PBXBuildFile; fileRef = 64B5E25F20D30AE40067EDC1 /* TimePeriodCollection.swift */; };\n\t\t64B5E26320D30AE40067EDC1 /* TimePeriodCollection.swift in Sources */ = {isa = PBXBuildFile; fileRef = 64B5E25F20D30AE40067EDC1 /* TimePeriodCollection.swift */; };\n\t\t64B5E26420D30AE40067EDC1 /* TimePeriodCollection.swift in Sources */ = {isa = PBXBuildFile; fileRef = 64B5E25F20D30AE40067EDC1 /* TimePeriodCollection.swift */; };\n\t\t64B5E26620D30E620067EDC1 /* TimePeriodChain.swift in Sources */ = {isa = PBXBuildFile; fileRef = 64B5E26520D30E620067EDC1 /* TimePeriodChain.swift */; };\n\t\t64B5E26720D30E620067EDC1 /* TimePeriodChain.swift in Sources */ = {isa = PBXBuildFile; fileRef = 64B5E26520D30E620067EDC1 /* TimePeriodChain.swift */; };\n\t\t64B5E26820D30E620067EDC1 /* TimePeriodChain.swift in Sources */ = {isa = PBXBuildFile; fileRef = 64B5E26520D30E620067EDC1 /* TimePeriodChain.swift */; };\n\t\t64B5E26920D30E620067EDC1 /* TimePeriodChain.swift in Sources */ = {isa = PBXBuildFile; fileRef = 64B5E26520D30E620067EDC1 /* TimePeriodChain.swift */; };\n\t\t64B5E26A20D30E620067EDC1 /* TimePeriodChain.swift in Sources */ = {isa = PBXBuildFile; fileRef = 64B5E26520D30E620067EDC1 /* TimePeriodChain.swift */; };\n\t\t64BAB12420E63A3A00FEED79 /* TestDateInRegion+Langs.swift in Sources */ = {isa = PBXBuildFile; fileRef = 64BAB12320E63A3A00FEED79 /* TestDateInRegion+Langs.swift */; };\n\t\t64BAB12520E63A3A00FEED79 /* TestDateInRegion+Langs.swift in Sources */ = {isa = PBXBuildFile; fileRef = 64BAB12320E63A3A00FEED79 /* TestDateInRegion+Langs.swift */; };\n\t\t64BAB12620E63A3A00FEED79 /* TestDateInRegion+Langs.swift in Sources */ = {isa = PBXBuildFile; fileRef = 64BAB12320E63A3A00FEED79 /* TestDateInRegion+Langs.swift */; };\n\t\t64BAB12820E6411100FEED79 /* TestSwiftDate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 64BAB12720E6411100FEED79 /* TestSwiftDate.swift */; };\n\t\t64BAB12920E6411100FEED79 /* TestSwiftDate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 64BAB12720E6411100FEED79 /* TestSwiftDate.swift */; };\n\t\t64BAB12A20E6411100FEED79 /* TestSwiftDate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 64BAB12720E6411100FEED79 /* TestSwiftDate.swift */; };\n\t\t64EF3E0320D5518D002793C6 /* TestRegion.swift in Sources */ = {isa = PBXBuildFile; fileRef = 64EF3E0220D5518D002793C6 /* TestRegion.swift */; };\n\t\t64EF3E0420D551E4002793C6 /* TestRegion.swift in Sources */ = {isa = PBXBuildFile; fileRef = 64EF3E0220D5518D002793C6 /* TestRegion.swift */; };\n\t\t64EF3E0520D551E5002793C6 /* TestRegion.swift in Sources */ = {isa = PBXBuildFile; fileRef = 64EF3E0220D5518D002793C6 /* TestRegion.swift */; };\n\t\t64EF3E0720D56038002793C6 /* TestDateInRegion.swift in Sources */ = {isa = PBXBuildFile; fileRef = 64EF3E0620D56038002793C6 /* TestDateInRegion.swift */; };\n\t\t64EF3E0820D5622D002793C6 /* TestDateInRegion.swift in Sources */ = {isa = PBXBuildFile; fileRef = 64EF3E0620D56038002793C6 /* TestDateInRegion.swift */; };\n\t\t64EF3E0920D5622D002793C6 /* TestDateInRegion.swift in Sources */ = {isa = PBXBuildFile; fileRef = 64EF3E0620D56038002793C6 /* TestDateInRegion.swift */; };\n\t\t64EF3E0B20D65329002793C6 /* TestDateInRegion+Create.swift in Sources */ = {isa = PBXBuildFile; fileRef = 64EF3E0A20D65329002793C6 /* TestDateInRegion+Create.swift */; };\n\t\t64EF3E0C20D65329002793C6 /* TestDateInRegion+Create.swift in Sources */ = {isa = PBXBuildFile; fileRef = 64EF3E0A20D65329002793C6 /* TestDateInRegion+Create.swift */; };\n\t\t64EF3E0D20D65329002793C6 /* TestDateInRegion+Create.swift in Sources */ = {isa = PBXBuildFile; fileRef = 64EF3E0A20D65329002793C6 /* TestDateInRegion+Create.swift */; };\n\t\t64EF3E0F20D65478002793C6 /* TestDateInRegion+Compare.swift in Sources */ = {isa = PBXBuildFile; fileRef = 64EF3E0E20D65478002793C6 /* TestDateInRegion+Compare.swift */; };\n\t\t64EF3E1020D65478002793C6 /* TestDateInRegion+Compare.swift in Sources */ = {isa = PBXBuildFile; fileRef = 64EF3E0E20D65478002793C6 /* TestDateInRegion+Compare.swift */; };\n\t\t64EF3E1120D65478002793C6 /* TestDateInRegion+Compare.swift in Sources */ = {isa = PBXBuildFile; fileRef = 64EF3E0E20D65478002793C6 /* TestDateInRegion+Compare.swift */; };\n\t\tA89F3FAF22A00019002D1BD0 /* TestDate.swift in Sources */ = {isa = PBXBuildFile; fileRef = A89F3FAE22A00019002D1BD0 /* TestDate.swift */; };\n\t\tDD7502881C68FEDE006590AF /* SwiftDate.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 52D6DA0F1BF000BD002C0205 /* SwiftDate.framework */; };\n\t\tDD7502921C690C7A006590AF /* SwiftDate.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 52D6D9F01BEFFFBE002C0205 /* SwiftDate.framework */; };\n/* End PBXBuildFile section */\n\n/* Begin PBXContainerItemProxy section */\n\t\t52D6D9881BEFF229002C0205 /* PBXContainerItemProxy */ = {\n\t\t\tisa = PBXContainerItemProxy;\n\t\t\tcontainerPortal = 52D6D9731BEFF229002C0205 /* Project object */;\n\t\t\tproxyType = 1;\n\t\t\tremoteGlobalIDString = 52D6D97B1BEFF229002C0205;\n\t\t\tremoteInfo = SwiftDate;\n\t\t};\n\t\tDD7502801C68FCFC006590AF /* PBXContainerItemProxy */ = {\n\t\t\tisa = PBXContainerItemProxy;\n\t\t\tcontainerPortal = 52D6D9731BEFF229002C0205 /* Project object */;\n\t\t\tproxyType = 1;\n\t\t\tremoteGlobalIDString = 52D6DA0E1BF000BD002C0205;\n\t\t\tremoteInfo = \"SwiftDate-macOS\";\n\t\t};\n\t\tDD7502931C690C7A006590AF /* PBXContainerItemProxy */ = {\n\t\t\tisa = PBXContainerItemProxy;\n\t\t\tcontainerPortal = 52D6D9731BEFF229002C0205 /* Project object */;\n\t\t\tproxyType = 1;\n\t\t\tremoteGlobalIDString = 52D6D9EF1BEFFFBE002C0205;\n\t\t\tremoteInfo = \"SwiftDate-tvOS\";\n\t\t};\n/* End PBXContainerItemProxy section */\n\n/* Begin PBXFileReference section */\n\t\t52D6D97C1BEFF229002C0205 /* SwiftDate.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = SwiftDate.framework; sourceTree = BUILT_PRODUCTS_DIR; };\n\t\t52D6D9861BEFF229002C0205 /* SwiftDate-iOS Tests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = \"SwiftDate-iOS Tests.xctest\"; sourceTree = BUILT_PRODUCTS_DIR; };\n\t\t52D6D9E21BEFFF6E002C0205 /* SwiftDate.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = SwiftDate.framework; sourceTree = BUILT_PRODUCTS_DIR; };\n\t\t52D6D9F01BEFFFBE002C0205 /* SwiftDate.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = SwiftDate.framework; sourceTree = BUILT_PRODUCTS_DIR; };\n\t\t52D6DA0F1BF000BD002C0205 /* SwiftDate.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = SwiftDate.framework; sourceTree = BUILT_PRODUCTS_DIR; };\n\t\t6434DD5820C7D1F6007626EF /* .swiftlint.yml */ = {isa = PBXFileReference; lastKnownFileType = text; path = .swiftlint.yml; sourceTree = \"<group>\"; };\n\t\t6434DD5F20C7F729007626EF /* SwiftDate.playground */ = {isa = PBXFileReference; lastKnownFileType = file.playground; name = SwiftDate.playground; path = Playgrounds/SwiftDate.playground; sourceTree = \"<group>\"; xcLanguageSpecificationIdentifier = xcode.lang.swift; };\n\t\t6434DD6020C7FAF6007626EF /* DateInRegion.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DateInRegion.swift; sourceTree = \"<group>\"; };\n\t\t6434DD6620C7FC6A007626EF /* Region.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Region.swift; sourceTree = \"<group>\"; };\n\t\t6434DD6C20C7FEED007626EF /* Zones.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Zones.swift; sourceTree = \"<group>\"; };\n\t\t6434DD7120C80126007626EF /* Calendars.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Calendars.swift; sourceTree = \"<group>\"; };\n\t\t6434DD7620C80263007626EF /* Locales.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Locales.swift; sourceTree = \"<group>\"; };\n\t\t6434DD7B20C803EF007626EF /* SwiftDate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = SwiftDate.swift; path = SwiftDate/SwiftDate.swift; sourceTree = \"<group>\"; };\n\t\t6434DD8C20C809B2007626EF /* TestApplication.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = TestApplication.app; sourceTree = BUILT_PRODUCTS_DIR; };\n\t\t6434DD8E20C809B3007626EF /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = \"<group>\"; };\n\t\t6434DD9020C809B3007626EF /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = \"<group>\"; };\n\t\t6434DD9320C809B3007626EF /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = \"<group>\"; };\n\t\t6434DD9520C809B4007626EF /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = \"<group>\"; };\n\t\t6434DD9820C809B4007626EF /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = \"<group>\"; };\n\t\t6434DD9A20C809B4007626EF /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = \"<group>\"; };\n\t\t6439231D20D90CB10098EC03 /* TestDateInRegion+Components.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = \"TestDateInRegion+Components.swift\"; sourceTree = \"<group>\"; };\n\t\t6439232120D912670098EC03 /* TestDateInRegion+Math.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = \"TestDateInRegion+Math.swift\"; sourceTree = \"<group>\"; };\n\t\t6439232520D91D170098EC03 /* TestFormatters.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TestFormatters.swift; sourceTree = \"<group>\"; };\n\t\t6470DD1320D27AF500BC2E74 /* String+Parser.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = \"String+Parser.swift\"; sourceTree = \"<group>\"; };\n\t\t6470DD1920D296EA00BC2E74 /* TimeInterval+Formatter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = \"TimeInterval+Formatter.swift\"; sourceTree = \"<group>\"; };\n\t\t6470DD2020D2A55300BC2E74 /* TimePeriodProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TimePeriodProtocol.swift; sourceTree = \"<group>\"; };\n\t\t6470DD2D20D2B64200BC2E74 /* TimePeriod+Support.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = \"TimePeriod+Support.swift\"; sourceTree = \"<group>\"; };\n\t\t647AD65521F4826100CF787E /* TimeStructures.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TimeStructures.swift; sourceTree = \"<group>\"; };\n\t\t647AD65B21F4851F00CF787E /* TestDataStructures.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TestDataStructures.swift; sourceTree = \"<group>\"; };\n\t\t647DA61A20D3FAB800E20E8C /* Documentation */ = {isa = PBXFileReference; lastKnownFileType = folder; path = Documentation; sourceTree = \"<group>\"; };\n\t\t64990AF72286FC31006C427D /* langs */ = {isa = PBXFileReference; lastKnownFileType = folder; path = langs; sourceTree = \"<group>\"; };\n\t\t649D0E022287412C0056D42E /* RelativeFormatterLanguage.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RelativeFormatterLanguage.swift; sourceTree = \"<group>\"; };\n\t\t649D473A20C81A2A00513A67 /* DateRepresentable.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = DateRepresentable.swift; path = SwiftDate/DateRepresentable.swift; sourceTree = \"<group>\"; };\n\t\t649D474020C81A4200513A67 /* Date.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Date.swift; sourceTree = \"<group>\"; };\n\t\t649D474720C8241C00513A67 /* Commons.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Commons.swift; sourceTree = \"<group>\"; };\n\t\t649D474D20C827C400513A67 /* AssociatedValues.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AssociatedValues.swift; sourceTree = \"<group>\"; };\n\t\t649D475920C84FAC00513A67 /* ISOFormatter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ISOFormatter.swift; sourceTree = \"<group>\"; };\n\t\t649D476020C8529500513A67 /* Formatter+Protocols.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = \"Formatter+Protocols.swift\"; sourceTree = \"<group>\"; };\n\t\t649D476C20C85C7100513A67 /* ISOParser.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ISOParser.swift; sourceTree = \"<group>\"; };\n\t\t649D477220C872DA00513A67 /* DotNetParserFormatter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DotNetParserFormatter.swift; sourceTree = \"<group>\"; };\n\t\t649D477820C877C300513A67 /* DateInRegion+Create.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = \"DateInRegion+Create.swift\"; sourceTree = \"<group>\"; };\n\t\t649D477E20C880DC00513A67 /* Date+Create.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = \"Date+Create.swift\"; sourceTree = \"<group>\"; };\n\t\t649D478420C8861200513A67 /* DateInRegion+Components.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = \"DateInRegion+Components.swift\"; sourceTree = \"<group>\"; };\n\t\t649D479120C913E200513A67 /* Date+Components.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = \"Date+Components.swift\"; sourceTree = \"<group>\"; };\n\t\t649D47A320C91BEA00513A67 /* DateInRegion+Compare.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = \"DateInRegion+Compare.swift\"; sourceTree = \"<group>\"; };\n\t\t649D47A920C91C0B00513A67 /* Date+Compare.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = \"Date+Compare.swift\"; sourceTree = \"<group>\"; };\n\t\t649D47AF20C9276400513A67 /* DateComponents+Extras.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = \"DateComponents+Extras.swift\"; sourceTree = \"<group>\"; };\n\t\t649D47B520C9586500513A67 /* DateInRegion+Math.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = \"DateInRegion+Math.swift\"; sourceTree = \"<group>\"; };\n\t\t649D47BB20C959F500513A67 /* Date+Math.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = \"Date+Math.swift\"; sourceTree = \"<group>\"; };\n\t\t649D47C120C964E000513A67 /* Int+DateComponents.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = \"Int+DateComponents.swift\"; sourceTree = \"<group>\"; };\n\t\t649D47E020CAAB7400513A67 /* RelativeFormatter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RelativeFormatter.swift; sourceTree = \"<group>\"; };\n\t\t649D47ED20CAB96D00513A67 /* RelativeFormatter+Style.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = \"RelativeFormatter+Style.swift\"; sourceTree = \"<group>\"; };\n\t\t64B5E25220D306220067EDC1 /* TimePeriod.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TimePeriod.swift; sourceTree = \"<group>\"; };\n\t\t64B5E25820D3090A0067EDC1 /* TimePeriodGroup.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TimePeriodGroup.swift; sourceTree = \"<group>\"; };\n\t\t64B5E25F20D30AE40067EDC1 /* TimePeriodCollection.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TimePeriodCollection.swift; sourceTree = \"<group>\"; };\n\t\t64B5E26520D30E620067EDC1 /* TimePeriodChain.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TimePeriodChain.swift; sourceTree = \"<group>\"; };\n\t\t64BAB12320E63A3A00FEED79 /* TestDateInRegion+Langs.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = \"TestDateInRegion+Langs.swift\"; sourceTree = \"<group>\"; };\n\t\t64BAB12720E6411100FEED79 /* TestSwiftDate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TestSwiftDate.swift; sourceTree = \"<group>\"; };\n\t\t64EF3E0220D5518D002793C6 /* TestRegion.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TestRegion.swift; sourceTree = \"<group>\"; };\n\t\t64EF3E0620D56038002793C6 /* TestDateInRegion.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TestDateInRegion.swift; sourceTree = \"<group>\"; };\n\t\t64EF3E0A20D65329002793C6 /* TestDateInRegion+Create.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = \"TestDateInRegion+Create.swift\"; sourceTree = \"<group>\"; };\n\t\t64EF3E0E20D65478002793C6 /* TestDateInRegion+Compare.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = \"TestDateInRegion+Compare.swift\"; sourceTree = \"<group>\"; };\n\t\tA89F3FAE22A00019002D1BD0 /* TestDate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TestDate.swift; sourceTree = \"<group>\"; };\n\t\tAD2FAA261CD0B6D800659CF4 /* SwiftDate.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = SwiftDate.plist; sourceTree = \"<group>\"; };\n\t\tAD2FAA281CD0B6E100659CF4 /* SwiftDateTests.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = SwiftDateTests.plist; sourceTree = \"<group>\"; };\n\t\tDD75027A1C68FCFC006590AF /* SwiftDate-macOS Tests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = \"SwiftDate-macOS Tests.xctest\"; sourceTree = BUILT_PRODUCTS_DIR; };\n\t\tDD75028D1C690C7A006590AF /* SwiftDate-tvOS Tests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = \"SwiftDate-tvOS Tests.xctest\"; sourceTree = BUILT_PRODUCTS_DIR; };\n/* End PBXFileReference section */\n\n/* Begin PBXFrameworksBuildPhase section */\n\t\t52D6D9781BEFF229002C0205 /* Frameworks */ = {\n\t\t\tisa = PBXFrameworksBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n\t\t52D6D9831BEFF229002C0205 /* Frameworks */ = {\n\t\t\tisa = PBXFrameworksBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\t52D6D9871BEFF229002C0205 /* SwiftDate.framework in Frameworks */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n\t\t52D6D9DE1BEFFF6E002C0205 /* Frameworks */ = {\n\t\t\tisa = PBXFrameworksBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n\t\t52D6D9EC1BEFFFBE002C0205 /* Frameworks */ = {\n\t\t\tisa = PBXFrameworksBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n\t\t52D6DA0B1BF000BD002C0205 /* Frameworks */ = {\n\t\t\tisa = PBXFrameworksBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n\t\t6434DD8920C809B2007626EF /* Frameworks */ = {\n\t\t\tisa = PBXFrameworksBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n\t\tDD7502771C68FCFC006590AF /* Frameworks */ = {\n\t\t\tisa = PBXFrameworksBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\tDD7502881C68FEDE006590AF /* SwiftDate.framework in Frameworks */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n\t\tDD75028A1C690C7A006590AF /* Frameworks */ = {\n\t\t\tisa = PBXFrameworksBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\tDD7502921C690C7A006590AF /* SwiftDate.framework in Frameworks */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXFrameworksBuildPhase section */\n\n/* Begin PBXGroup section */\n\t\t52D6D9721BEFF229002C0205 = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t6434DD5820C7D1F6007626EF /* .swiftlint.yml */,\n\t\t\t\t6434DD5F20C7F729007626EF /* SwiftDate.playground */,\n\t\t\t\t647DA61A20D3FAB800E20E8C /* Documentation */,\n\t\t\t\t8933C7811EB5B7E0000D00A4 /* Sources */,\n\t\t\t\t8933C7831EB5B7EB000D00A4 /* Tests */,\n\t\t\t\t52D6D99C1BEFF38C002C0205 /* Configs */,\n\t\t\t\t6434DD8D20C809B3007626EF /* TestApplication */,\n\t\t\t\t52D6D97D1BEFF229002C0205 /* Products */,\n\t\t\t);\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t52D6D97D1BEFF229002C0205 /* Products */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t52D6D97C1BEFF229002C0205 /* SwiftDate.framework */,\n\t\t\t\t52D6D9861BEFF229002C0205 /* SwiftDate-iOS Tests.xctest */,\n\t\t\t\t52D6D9E21BEFFF6E002C0205 /* SwiftDate.framework */,\n\t\t\t\t52D6D9F01BEFFFBE002C0205 /* SwiftDate.framework */,\n\t\t\t\t52D6DA0F1BF000BD002C0205 /* SwiftDate.framework */,\n\t\t\t\tDD75027A1C68FCFC006590AF /* SwiftDate-macOS Tests.xctest */,\n\t\t\t\tDD75028D1C690C7A006590AF /* SwiftDate-tvOS Tests.xctest */,\n\t\t\t\t6434DD8C20C809B2007626EF /* TestApplication.app */,\n\t\t\t);\n\t\t\tname = Products;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t52D6D99C1BEFF38C002C0205 /* Configs */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\tDD7502721C68FC1B006590AF /* Frameworks */,\n\t\t\t\tDD7502731C68FC20006590AF /* Tests */,\n\t\t\t);\n\t\t\tpath = Configs;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t6434DD6520C7FAFB007626EF /* DateInRegion */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t6434DD6020C7FAF6007626EF /* DateInRegion.swift */,\n\t\t\t\t649D477820C877C300513A67 /* DateInRegion+Create.swift */,\n\t\t\t\t649D47A320C91BEA00513A67 /* DateInRegion+Compare.swift */,\n\t\t\t\t649D478420C8861200513A67 /* DateInRegion+Components.swift */,\n\t\t\t\t649D47B520C9586500513A67 /* DateInRegion+Math.swift */,\n\t\t\t\t6434DD6620C7FC6A007626EF /* Region.swift */,\n\t\t\t);\n\t\t\tname = DateInRegion;\n\t\t\tpath = SwiftDate/DateInRegion;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t6434DD6B20C7FEDB007626EF /* Supports */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t6434DD6C20C7FEED007626EF /* Zones.swift */,\n\t\t\t\t6434DD7120C80126007626EF /* Calendars.swift */,\n\t\t\t\t6434DD7620C80263007626EF /* Locales.swift */,\n\t\t\t\t649D474720C8241C00513A67 /* Commons.swift */,\n\t\t\t\t647AD65521F4826100CF787E /* TimeStructures.swift */,\n\t\t\t\t649D474D20C827C400513A67 /* AssociatedValues.swift */,\n\t\t\t);\n\t\t\tname = Supports;\n\t\t\tpath = SwiftDate/Supports;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t6434DD8D20C809B3007626EF /* TestApplication */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t6434DD8E20C809B3007626EF /* AppDelegate.swift */,\n\t\t\t\t6434DD9020C809B3007626EF /* ViewController.swift */,\n\t\t\t\t6434DD9220C809B3007626EF /* Main.storyboard */,\n\t\t\t\t6434DD9520C809B4007626EF /* Assets.xcassets */,\n\t\t\t\t6434DD9720C809B4007626EF /* LaunchScreen.storyboard */,\n\t\t\t\t6434DD9A20C809B4007626EF /* Info.plist */,\n\t\t\t);\n\t\t\tpath = TestApplication;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t6470DD1F20D2A32600BC2E74 /* TimePeriod */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t6470DD2D20D2B64200BC2E74 /* TimePeriod+Support.swift */,\n\t\t\t\t6470DD2020D2A55300BC2E74 /* TimePeriodProtocol.swift */,\n\t\t\t\t64B5E25220D306220067EDC1 /* TimePeriod.swift */,\n\t\t\t\t64B5E25E20D309210067EDC1 /* Groups */,\n\t\t\t);\n\t\t\tname = TimePeriod;\n\t\t\tpath = SwiftDate/TimePeriod;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t6470DD2620D2A5EF00BC2E74 /* Foundation+Extras */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t6470DD1320D27AF500BC2E74 /* String+Parser.swift */,\n\t\t\t\t6470DD1920D296EA00BC2E74 /* TimeInterval+Formatter.swift */,\n\t\t\t\t649D47AF20C9276400513A67 /* DateComponents+Extras.swift */,\n\t\t\t\t649D47C120C964E000513A67 /* Int+DateComponents.swift */,\n\t\t\t);\n\t\t\tname = \"Foundation+Extras\";\n\t\t\tpath = \"SwiftDate/Foundation+Extras\";\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t649D474620C81A4800513A67 /* Date */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t649D474020C81A4200513A67 /* Date.swift */,\n\t\t\t\t649D477E20C880DC00513A67 /* Date+Create.swift */,\n\t\t\t\t649D47A920C91C0B00513A67 /* Date+Compare.swift */,\n\t\t\t\t649D479120C913E200513A67 /* Date+Components.swift */,\n\t\t\t\t649D47BB20C959F500513A67 /* Date+Math.swift */,\n\t\t\t);\n\t\t\tname = Date;\n\t\t\tpath = SwiftDate/Date;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t649D475F20C84FB000513A67 /* Formatters */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t649D476020C8529500513A67 /* Formatter+Protocols.swift */,\n\t\t\t\t649D475920C84FAC00513A67 /* ISOFormatter.swift */,\n\t\t\t\t649D476C20C85C7100513A67 /* ISOParser.swift */,\n\t\t\t\t649D477220C872DA00513A67 /* DotNetParserFormatter.swift */,\n\t\t\t\t649D47E620CAB46400513A67 /* RelativeFormatter */,\n\t\t\t);\n\t\t\tname = Formatters;\n\t\t\tpath = SwiftDate/Formatters;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t649D47E620CAB46400513A67 /* RelativeFormatter */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t649D47E020CAAB7400513A67 /* RelativeFormatter.swift */,\n\t\t\t\t649D47ED20CAB96D00513A67 /* RelativeFormatter+Style.swift */,\n\t\t\t\t649D0E022287412C0056D42E /* RelativeFormatterLanguage.swift */,\n\t\t\t\t64990AF72286FC31006C427D /* langs */,\n\t\t\t);\n\t\t\tpath = RelativeFormatter;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t64B5E25E20D309210067EDC1 /* Groups */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t64B5E25820D3090A0067EDC1 /* TimePeriodGroup.swift */,\n\t\t\t\t64B5E25F20D30AE40067EDC1 /* TimePeriodCollection.swift */,\n\t\t\t\t64B5E26520D30E620067EDC1 /* TimePeriodChain.swift */,\n\t\t\t);\n\t\t\tpath = Groups;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t8933C7811EB5B7E0000D00A4 /* Sources */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t6434DD7B20C803EF007626EF /* SwiftDate.swift */,\n\t\t\t\t649D473A20C81A2A00513A67 /* DateRepresentable.swift */,\n\t\t\t\t6470DD2620D2A5EF00BC2E74 /* Foundation+Extras */,\n\t\t\t\t6434DD6B20C7FEDB007626EF /* Supports */,\n\t\t\t\t6470DD1F20D2A32600BC2E74 /* TimePeriod */,\n\t\t\t\t6434DD6520C7FAFB007626EF /* DateInRegion */,\n\t\t\t\t649D474620C81A4800513A67 /* Date */,\n\t\t\t\t649D475F20C84FB000513A67 /* Formatters */,\n\t\t\t);\n\t\t\tpath = Sources;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t8933C7831EB5B7EB000D00A4 /* Tests */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t64EF3E0220D5518D002793C6 /* TestRegion.swift */,\n\t\t\t\t64EF3E0620D56038002793C6 /* TestDateInRegion.swift */,\n\t\t\t\t64EF3E0A20D65329002793C6 /* TestDateInRegion+Create.swift */,\n\t\t\t\t64EF3E0E20D65478002793C6 /* TestDateInRegion+Compare.swift */,\n\t\t\t\t6439231D20D90CB10098EC03 /* TestDateInRegion+Components.swift */,\n\t\t\t\t6439232120D912670098EC03 /* TestDateInRegion+Math.swift */,\n\t\t\t\t64BAB12320E63A3A00FEED79 /* TestDateInRegion+Langs.swift */,\n\t\t\t\t6439232520D91D170098EC03 /* TestFormatters.swift */,\n\t\t\t\t64BAB12720E6411100FEED79 /* TestSwiftDate.swift */,\n\t\t\t\t647AD65B21F4851F00CF787E /* TestDataStructures.swift */,\n\t\t\t\tA89F3FAE22A00019002D1BD0 /* TestDate.swift */,\n\t\t\t);\n\t\t\tname = Tests;\n\t\t\tpath = Tests/SwiftDateTests;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\tDD7502721C68FC1B006590AF /* Frameworks */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\tAD2FAA261CD0B6D800659CF4 /* SwiftDate.plist */,\n\t\t\t);\n\t\t\tname = Frameworks;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\tDD7502731C68FC20006590AF /* Tests */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\tAD2FAA281CD0B6E100659CF4 /* SwiftDateTests.plist */,\n\t\t\t);\n\t\t\tname = Tests;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n/* End PBXGroup section */\n\n/* Begin PBXHeadersBuildPhase section */\n\t\t52D6D9791BEFF229002C0205 /* Headers */ = {\n\t\t\tisa = PBXHeadersBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n\t\t52D6D9DF1BEFFF6E002C0205 /* Headers */ = {\n\t\t\tisa = PBXHeadersBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n\t\t52D6D9ED1BEFFFBE002C0205 /* Headers */ = {\n\t\t\tisa = PBXHeadersBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n\t\t52D6DA0C1BF000BD002C0205 /* Headers */ = {\n\t\t\tisa = PBXHeadersBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXHeadersBuildPhase section */\n\n/* Begin PBXNativeTarget section */\n\t\t52D6D97B1BEFF229002C0205 /* SwiftDate-iOS */ = {\n\t\t\tisa = PBXNativeTarget;\n\t\t\tbuildConfigurationList = 52D6D9901BEFF229002C0205 /* Build configuration list for PBXNativeTarget \"SwiftDate-iOS\" */;\n\t\t\tbuildPhases = (\n\t\t\t\t52D6D9771BEFF229002C0205 /* Sources */,\n\t\t\t\t52D6D9781BEFF229002C0205 /* Frameworks */,\n\t\t\t\t52D6D9791BEFF229002C0205 /* Headers */,\n\t\t\t\t52D6D97A1BEFF229002C0205 /* Resources */,\n\t\t\t\t6434DD5720C7D1E5007626EF /* SwiftLint */,\n\t\t\t);\n\t\t\tbuildRules = (\n\t\t\t);\n\t\t\tdependencies = (\n\t\t\t);\n\t\t\tname = \"SwiftDate-iOS\";\n\t\t\tproductName = SwiftDate;\n\t\t\tproductReference = 52D6D97C1BEFF229002C0205 /* SwiftDate.framework */;\n\t\t\tproductType = \"com.apple.product-type.framework\";\n\t\t};\n\t\t52D6D9851BEFF229002C0205 /* SwiftDate-iOS Tests */ = {\n\t\t\tisa = PBXNativeTarget;\n\t\t\tbuildConfigurationList = 52D6D9931BEFF229002C0205 /* Build configuration list for PBXNativeTarget \"SwiftDate-iOS Tests\" */;\n\t\t\tbuildPhases = (\n\t\t\t\t52D6D9821BEFF229002C0205 /* Sources */,\n\t\t\t\t52D6D9831BEFF229002C0205 /* Frameworks */,\n\t\t\t\t52D6D9841BEFF229002C0205 /* Resources */,\n\t\t\t);\n\t\t\tbuildRules = (\n\t\t\t);\n\t\t\tdependencies = (\n\t\t\t\t52D6D9891BEFF229002C0205 /* PBXTargetDependency */,\n\t\t\t);\n\t\t\tname = \"SwiftDate-iOS Tests\";\n\t\t\tproductName = SwiftDateTests;\n\t\t\tproductReference = 52D6D9861BEFF229002C0205 /* SwiftDate-iOS Tests.xctest */;\n\t\t\tproductType = \"com.apple.product-type.bundle.unit-test\";\n\t\t};\n\t\t52D6D9E11BEFFF6E002C0205 /* SwiftDate-watchOS */ = {\n\t\t\tisa = PBXNativeTarget;\n\t\t\tbuildConfigurationList = 52D6D9E71BEFFF6E002C0205 /* Build configuration list for PBXNativeTarget \"SwiftDate-watchOS\" */;\n\t\t\tbuildPhases = (\n\t\t\t\t52D6D9DD1BEFFF6E002C0205 /* Sources */,\n\t\t\t\t52D6D9DE1BEFFF6E002C0205 /* Frameworks */,\n\t\t\t\t52D6D9DF1BEFFF6E002C0205 /* Headers */,\n\t\t\t\t52D6D9E01BEFFF6E002C0205 /* Resources */,\n\t\t\t);\n\t\t\tbuildRules = (\n\t\t\t);\n\t\t\tdependencies = (\n\t\t\t);\n\t\t\tname = \"SwiftDate-watchOS\";\n\t\t\tproductName = \"SwiftDate-watchOS\";\n\t\t\tproductReference = 52D6D9E21BEFFF6E002C0205 /* SwiftDate.framework */;\n\t\t\tproductType = \"com.apple.product-type.framework\";\n\t\t};\n\t\t52D6D9EF1BEFFFBE002C0205 /* SwiftDate-tvOS */ = {\n\t\t\tisa = PBXNativeTarget;\n\t\t\tbuildConfigurationList = 52D6DA011BEFFFBE002C0205 /* Build configuration list for PBXNativeTarget \"SwiftDate-tvOS\" */;\n\t\t\tbuildPhases = (\n\t\t\t\t52D6D9EB1BEFFFBE002C0205 /* Sources */,\n\t\t\t\t52D6D9EC1BEFFFBE002C0205 /* Frameworks */,\n\t\t\t\t52D6D9ED1BEFFFBE002C0205 /* Headers */,\n\t\t\t\t52D6D9EE1BEFFFBE002C0205 /* Resources */,\n\t\t\t);\n\t\t\tbuildRules = (\n\t\t\t);\n\t\t\tdependencies = (\n\t\t\t);\n\t\t\tname = \"SwiftDate-tvOS\";\n\t\t\tproductName = \"SwiftDate-tvOS\";\n\t\t\tproductReference = 52D6D9F01BEFFFBE002C0205 /* SwiftDate.framework */;\n\t\t\tproductType = \"com.apple.product-type.framework\";\n\t\t};\n\t\t52D6DA0E1BF000BD002C0205 /* SwiftDate-macOS */ = {\n\t\t\tisa = PBXNativeTarget;\n\t\t\tbuildConfigurationList = 52D6DA201BF000BD002C0205 /* Build configuration list for PBXNativeTarget \"SwiftDate-macOS\" */;\n\t\t\tbuildPhases = (\n\t\t\t\t52D6DA0A1BF000BD002C0205 /* Sources */,\n\t\t\t\t52D6DA0B1BF000BD002C0205 /* Frameworks */,\n\t\t\t\t52D6DA0C1BF000BD002C0205 /* Headers */,\n\t\t\t\t52D6DA0D1BF000BD002C0205 /* Resources */,\n\t\t\t);\n\t\t\tbuildRules = (\n\t\t\t);\n\t\t\tdependencies = (\n\t\t\t);\n\t\t\tname = \"SwiftDate-macOS\";\n\t\t\tproductName = \"SwiftDate-macOS\";\n\t\t\tproductReference = 52D6DA0F1BF000BD002C0205 /* SwiftDate.framework */;\n\t\t\tproductType = \"com.apple.product-type.framework\";\n\t\t};\n\t\t6434DD8B20C809B2007626EF /* TestApplication */ = {\n\t\t\tisa = PBXNativeTarget;\n\t\t\tbuildConfigurationList = 6434DD9B20C809B4007626EF /* Build configuration list for PBXNativeTarget \"TestApplication\" */;\n\t\t\tbuildPhases = (\n\t\t\t\t6434DD8820C809B2007626EF /* Sources */,\n\t\t\t\t6434DD8920C809B2007626EF /* Frameworks */,\n\t\t\t\t6434DD8A20C809B2007626EF /* Resources */,\n\t\t\t);\n\t\t\tbuildRules = (\n\t\t\t);\n\t\t\tdependencies = (\n\t\t\t);\n\t\t\tname = TestApplication;\n\t\t\tproductName = TestApplication;\n\t\t\tproductReference = 6434DD8C20C809B2007626EF /* TestApplication.app */;\n\t\t\tproductType = \"com.apple.product-type.application\";\n\t\t};\n\t\tDD7502791C68FCFC006590AF /* SwiftDate-macOS Tests */ = {\n\t\t\tisa = PBXNativeTarget;\n\t\t\tbuildConfigurationList = DD7502821C68FCFC006590AF /* Build configuration list for PBXNativeTarget \"SwiftDate-macOS Tests\" */;\n\t\t\tbuildPhases = (\n\t\t\t\tDD7502761C68FCFC006590AF /* Sources */,\n\t\t\t\tDD7502771C68FCFC006590AF /* Frameworks */,\n\t\t\t\tDD7502781C68FCFC006590AF /* Resources */,\n\t\t\t);\n\t\t\tbuildRules = (\n\t\t\t);\n\t\t\tdependencies = (\n\t\t\t\tDD7502811C68FCFC006590AF /* PBXTargetDependency */,\n\t\t\t);\n\t\t\tname = \"SwiftDate-macOS Tests\";\n\t\t\tproductName = \"SwiftDate-OS Tests\";\n\t\t\tproductReference = DD75027A1C68FCFC006590AF /* SwiftDate-macOS Tests.xctest */;\n\t\t\tproductType = \"com.apple.product-type.bundle.unit-test\";\n\t\t};\n\t\tDD75028C1C690C7A006590AF /* SwiftDate-tvOS Tests */ = {\n\t\t\tisa = PBXNativeTarget;\n\t\t\tbuildConfigurationList = DD7502951C690C7A006590AF /* Build configuration list for PBXNativeTarget \"SwiftDate-tvOS Tests\" */;\n\t\t\tbuildPhases = (\n\t\t\t\tDD7502891C690C7A006590AF /* Sources */,\n\t\t\t\tDD75028A1C690C7A006590AF /* Frameworks */,\n\t\t\t\tDD75028B1C690C7A006590AF /* Resources */,\n\t\t\t);\n\t\t\tbuildRules = (\n\t\t\t);\n\t\t\tdependencies = (\n\t\t\t\tDD7502941C690C7A006590AF /* PBXTargetDependency */,\n\t\t\t);\n\t\t\tname = \"SwiftDate-tvOS Tests\";\n\t\t\tproductName = \"SwiftDate-tvOS Tests\";\n\t\t\tproductReference = DD75028D1C690C7A006590AF /* SwiftDate-tvOS Tests.xctest */;\n\t\t\tproductType = \"com.apple.product-type.bundle.unit-test\";\n\t\t};\n/* End PBXNativeTarget section */\n\n/* Begin PBXProject section */\n\t\t52D6D9731BEFF229002C0205 /* Project object */ = {\n\t\t\tisa = PBXProject;\n\t\t\tattributes = {\n\t\t\t\tLastSwiftUpdateCheck = 0940;\n\t\t\t\tLastUpgradeCheck = 1220;\n\t\t\t\tORGANIZATIONNAME = SwiftDate;\n\t\t\t\tTargetAttributes = {\n\t\t\t\t\t52D6D97B1BEFF229002C0205 = {\n\t\t\t\t\t\tCreatedOnToolsVersion = 7.1;\n\t\t\t\t\t\tLastSwiftMigration = 1020;\n\t\t\t\t\t};\n\t\t\t\t\t52D6D9851BEFF229002C0205 = {\n\t\t\t\t\t\tCreatedOnToolsVersion = 7.1;\n\t\t\t\t\t\tLastSwiftMigration = 1020;\n\t\t\t\t\t};\n\t\t\t\t\t52D6D9E11BEFFF6E002C0205 = {\n\t\t\t\t\t\tCreatedOnToolsVersion = 7.1;\n\t\t\t\t\t\tLastSwiftMigration = 0940;\n\t\t\t\t\t};\n\t\t\t\t\t52D6D9EF1BEFFFBE002C0205 = {\n\t\t\t\t\t\tCreatedOnToolsVersion = 7.1;\n\t\t\t\t\t\tLastSwiftMigration = 0940;\n\t\t\t\t\t};\n\t\t\t\t\t52D6DA0E1BF000BD002C0205 = {\n\t\t\t\t\t\tCreatedOnToolsVersion = 7.1;\n\t\t\t\t\t\tLastSwiftMigration = 0940;\n\t\t\t\t\t};\n\t\t\t\t\t6434DD8B20C809B2007626EF = {\n\t\t\t\t\t\tCreatedOnToolsVersion = 9.4;\n\t\t\t\t\t\tDevelopmentTeam = E5DU3FA699;\n\t\t\t\t\t\tLastSwiftMigration = 1020;\n\t\t\t\t\t\tProvisioningStyle = Automatic;\n\t\t\t\t\t};\n\t\t\t\t\tDD7502791C68FCFC006590AF = {\n\t\t\t\t\t\tCreatedOnToolsVersion = 7.2.1;\n\t\t\t\t\t\tLastSwiftMigration = 0800;\n\t\t\t\t\t};\n\t\t\t\t\tDD75028C1C690C7A006590AF = {\n\t\t\t\t\t\tCreatedOnToolsVersion = 7.2.1;\n\t\t\t\t\t\tLastSwiftMigration = 0800;\n\t\t\t\t\t};\n\t\t\t\t};\n\t\t\t};\n\t\t\tbuildConfigurationList = 52D6D9761BEFF229002C0205 /* Build configuration list for PBXProject \"SwiftDate\" */;\n\t\t\tcompatibilityVersion = \"Xcode 6.3\";\n\t\t\tdevelopmentRegion = en;\n\t\t\thasScannedForEncodings = 0;\n\t\t\tknownRegions = (\n\t\t\t\ten,\n\t\t\t\tBase,\n\t\t\t);\n\t\t\tmainGroup = 52D6D9721BEFF229002C0205;\n\t\t\tproductRefGroup = 52D6D97D1BEFF229002C0205 /* Products */;\n\t\t\tprojectDirPath = \"\";\n\t\t\tprojectRoot = \"\";\n\t\t\ttargets = (\n\t\t\t\t52D6D97B1BEFF229002C0205 /* SwiftDate-iOS */,\n\t\t\t\t52D6DA0E1BF000BD002C0205 /* SwiftDate-macOS */,\n\t\t\t\t52D6D9E11BEFFF6E002C0205 /* SwiftDate-watchOS */,\n\t\t\t\t52D6D9EF1BEFFFBE002C0205 /* SwiftDate-tvOS */,\n\t\t\t\t52D6D9851BEFF229002C0205 /* SwiftDate-iOS Tests */,\n\t\t\t\tDD7502791C68FCFC006590AF /* SwiftDate-macOS Tests */,\n\t\t\t\tDD75028C1C690C7A006590AF /* SwiftDate-tvOS Tests */,\n\t\t\t\t6434DD8B20C809B2007626EF /* TestApplication */,\n\t\t\t);\n\t\t};\n/* End PBXProject section */\n\n/* Begin PBXResourcesBuildPhase section */\n\t\t52D6D97A1BEFF229002C0205 /* Resources */ = {\n\t\t\tisa = PBXResourcesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\t64990AF82286FC31006C427D /* langs in Resources */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n\t\t52D6D9841BEFF229002C0205 /* Resources */ = {\n\t\t\tisa = PBXResourcesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n\t\t52D6D9E01BEFFF6E002C0205 /* Resources */ = {\n\t\t\tisa = PBXResourcesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\t64990AFA2286FC31006C427D /* langs in Resources */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n\t\t52D6D9EE1BEFFFBE002C0205 /* Resources */ = {\n\t\t\tisa = PBXResourcesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\t64990AFB2286FC31006C427D /* langs in Resources */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n\t\t52D6DA0D1BF000BD002C0205 /* Resources */ = {\n\t\t\tisa = PBXResourcesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\t64990AF92286FC31006C427D /* langs in Resources */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n\t\t6434DD8A20C809B2007626EF /* Resources */ = {\n\t\t\tisa = PBXResourcesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\t6434DD9920C809B4007626EF /* LaunchScreen.storyboard in Resources */,\n\t\t\t\t6434DD9620C809B4007626EF /* Assets.xcassets in Resources */,\n\t\t\t\t64990AFC2286FC31006C427D /* langs in Resources */,\n\t\t\t\t6434DD9420C809B3007626EF /* Main.storyboard in Resources */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n\t\tDD7502781C68FCFC006590AF /* Resources */ = {\n\t\t\tisa = PBXResourcesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n\t\tDD75028B1C690C7A006590AF /* Resources */ = {\n\t\t\tisa = PBXResourcesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXResourcesBuildPhase section */\n\n/* Begin PBXShellScriptBuildPhase section */\n\t\t6434DD5720C7D1E5007626EF /* SwiftLint */ = {\n\t\t\tisa = PBXShellScriptBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t);\n\t\t\tinputPaths = (\n\t\t\t);\n\t\t\tname = SwiftLint;\n\t\t\toutputPaths = (\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t\tshellPath = /bin/sh;\n\t\t\tshellScript = \"swiftlint autocorrect\\nif which swiftlint >/dev/null; then\\nswiftlint\\nelse\\necho \\\"warning: SwiftLint not installed, download from https://github.com/realm/SwiftLint\\\"\\nfi\\n\";\n\t\t};\n/* End PBXShellScriptBuildPhase section */\n\n/* Begin PBXSourcesBuildPhase section */\n\t\t52D6D9771BEFF229002C0205 /* Sources */ = {\n\t\t\tisa = PBXSourcesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\t64B5E26020D30AE40067EDC1 /* TimePeriodCollection.swift in Sources */,\n\t\t\t\t649D473B20C81A2A00513A67 /* DateRepresentable.swift in Sources */,\n\t\t\t\t6470DD1420D27AF500BC2E74 /* String+Parser.swift in Sources */,\n\t\t\t\t649D47E120CAAB7400513A67 /* RelativeFormatter.swift in Sources */,\n\t\t\t\t6470DD2E20D2B64200BC2E74 /* TimePeriod+Support.swift in Sources */,\n\t\t\t\t64B5E26620D30E620067EDC1 /* TimePeriodChain.swift in Sources */,\n\t\t\t\t649D474120C81A4200513A67 /* Date.swift in Sources */,\n\t\t\t\t649D476D20C85C7100513A67 /* ISOParser.swift in Sources */,\n\t\t\t\t6434DD7C20C803EF007626EF /* SwiftDate.swift in Sources */,\n\t\t\t\t649D0E032287412C0056D42E /* RelativeFormatterLanguage.swift in Sources */,\n\t\t\t\t649D47BC20C959F500513A67 /* Date+Math.swift in Sources */,\n\t\t\t\t649D47AA20C91C0B00513A67 /* Date+Compare.swift in Sources */,\n\t\t\t\t6434DD7220C80126007626EF /* Calendars.swift in Sources */,\n\t\t\t\t649D478520C8861200513A67 /* DateInRegion+Components.swift in Sources */,\n\t\t\t\t649D477920C877C300513A67 /* DateInRegion+Create.swift in Sources */,\n\t\t\t\t647AD65621F4826100CF787E /* TimeStructures.swift in Sources */,\n\t\t\t\t64B5E25320D306220067EDC1 /* TimePeriod.swift in Sources */,\n\t\t\t\t649D477F20C880DC00513A67 /* Date+Create.swift in Sources */,\n\t\t\t\t6470DD2120D2A55300BC2E74 /* TimePeriodProtocol.swift in Sources */,\n\t\t\t\t649D474E20C827C400513A67 /* AssociatedValues.swift in Sources */,\n\t\t\t\t649D476120C8529500513A67 /* Formatter+Protocols.swift in Sources */,\n\t\t\t\t649D474820C8241C00513A67 /* Commons.swift in Sources */,\n\t\t\t\t6434DD7720C80263007626EF /* Locales.swift in Sources */,\n\t\t\t\t64B5E25920D3090A0067EDC1 /* TimePeriodGroup.swift in Sources */,\n\t\t\t\t649D477320C872DA00513A67 /* DotNetParserFormatter.swift in Sources */,\n\t\t\t\t6434DD6120C7FAF6007626EF /* DateInRegion.swift in Sources */,\n\t\t\t\t649D47B620C9586500513A67 /* DateInRegion+Math.swift in Sources */,\n\t\t\t\t649D479220C913E200513A67 /* Date+Components.swift in Sources */,\n\t\t\t\t649D47EE20CAB96D00513A67 /* RelativeFormatter+Style.swift in Sources */,\n\t\t\t\t6470DD1A20D296EA00BC2E74 /* TimeInterval+Formatter.swift in Sources */,\n\t\t\t\t6434DD6720C7FC6A007626EF /* Region.swift in Sources */,\n\t\t\t\t649D47A420C91BEA00513A67 /* DateInRegion+Compare.swift in Sources */,\n\t\t\t\t649D47C220C964E000513A67 /* Int+DateComponents.swift in Sources */,\n\t\t\t\t649D47B020C9276400513A67 /* DateComponents+Extras.swift in Sources */,\n\t\t\t\t649D475A20C84FAC00513A67 /* ISOFormatter.swift in Sources */,\n\t\t\t\t6434DD6D20C7FEED007626EF /* Zones.swift in Sources */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n\t\t52D6D9821BEFF229002C0205 /* Sources */ = {\n\t\t\tisa = PBXSourcesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\t64BAB12420E63A3A00FEED79 /* TestDateInRegion+Langs.swift in Sources */,\n\t\t\t\t647AD65C21F4851F00CF787E /* TestDataStructures.swift in Sources */,\n\t\t\t\t6439232220D912670098EC03 /* TestDateInRegion+Math.swift in Sources */,\n\t\t\t\t64EF3E0F20D65478002793C6 /* TestDateInRegion+Compare.swift in Sources */,\n\t\t\t\t6439232620D91D170098EC03 /* TestFormatters.swift in Sources */,\n\t\t\t\t64EF3E0B20D65329002793C6 /* TestDateInRegion+Create.swift in Sources */,\n\t\t\t\t64EF3E0720D56038002793C6 /* TestDateInRegion.swift in Sources */,\n\t\t\t\t6439231E20D90CB10098EC03 /* TestDateInRegion+Components.swift in Sources */,\n\t\t\t\t64EF3E0320D5518D002793C6 /* TestRegion.swift in Sources */,\n\t\t\t\t64BAB12820E6411100FEED79 /* TestSwiftDate.swift in Sources */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n\t\t52D6D9DD1BEFFF6E002C0205 /* Sources */ = {\n\t\t\tisa = PBXSourcesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\t64B5E26220D30AE40067EDC1 /* TimePeriodCollection.swift in Sources */,\n\t\t\t\t649D473D20C81A2A00513A67 /* DateRepresentable.swift in Sources */,\n\t\t\t\t6470DD1620D27AF500BC2E74 /* String+Parser.swift in Sources */,\n\t\t\t\t649D47E320CAAB7400513A67 /* RelativeFormatter.swift in Sources */,\n\t\t\t\t6470DD3020D2B64200BC2E74 /* TimePeriod+Support.swift in Sources */,\n\t\t\t\t64B5E26820D30E620067EDC1 /* TimePeriodChain.swift in Sources */,\n\t\t\t\t649D474320C81A4200513A67 /* Date.swift in Sources */,\n\t\t\t\t649D476F20C85C7100513A67 /* ISOParser.swift in Sources */,\n\t\t\t\t6434DD7E20C803EF007626EF /* SwiftDate.swift in Sources */,\n\t\t\t\t649D0E052287412C0056D42E /* RelativeFormatterLanguage.swift in Sources */,\n\t\t\t\t649D47BE20C959F500513A67 /* Date+Math.swift in Sources */,\n\t\t\t\t649D47AC20C91C0B00513A67 /* Date+Compare.swift in Sources */,\n\t\t\t\t6434DD7420C80126007626EF /* Calendars.swift in Sources */,\n\t\t\t\t649D478720C8861200513A67 /* DateInRegion+Components.swift in Sources */,\n\t\t\t\t649D477B20C877C300513A67 /* DateInRegion+Create.swift in Sources */,\n\t\t\t\t647AD65821F4826100CF787E /* TimeStructures.swift in Sources */,\n\t\t\t\t64B5E25520D306220067EDC1 /* TimePeriod.swift in Sources */,\n\t\t\t\t649D478120C880DC00513A67 /* Date+Create.swift in Sources */,\n\t\t\t\t6470DD2320D2A55300BC2E74 /* TimePeriodProtocol.swift in Sources */,\n\t\t\t\t649D475020C827C400513A67 /* AssociatedValues.swift in Sources */,\n\t\t\t\t649D476320C8529500513A67 /* Formatter+Protocols.swift in Sources */,\n\t\t\t\t649D474A20C8241C00513A67 /* Commons.swift in Sources */,\n\t\t\t\t6434DD7920C80263007626EF /* Locales.swift in Sources */,\n\t\t\t\t64B5E25B20D3090A0067EDC1 /* TimePeriodGroup.swift in Sources */,\n\t\t\t\t649D477520C872DA00513A67 /* DotNetParserFormatter.swift in Sources */,\n\t\t\t\t6434DD6320C7FAF6007626EF /* DateInRegion.swift in Sources */,\n\t\t\t\t649D47B820C9586500513A67 /* DateInRegion+Math.swift in Sources */,\n\t\t\t\t649D479420C913E200513A67 /* Date+Components.swift in Sources */,\n\t\t\t\t649D47F020CAB96D00513A67 /* RelativeFormatter+Style.swift in Sources */,\n\t\t\t\t6470DD1C20D296EA00BC2E74 /* TimeInterval+Formatter.swift in Sources */,\n\t\t\t\t6434DD6920C7FC6A007626EF /* Region.swift in Sources */,\n\t\t\t\t649D47A620C91BEA00513A67 /* DateInRegion+Compare.swift in Sources */,\n\t\t\t\t649D47C420C964E000513A67 /* Int+DateComponents.swift in Sources */,\n\t\t\t\t649D47B220C9276400513A67 /* DateComponents+Extras.swift in Sources */,\n\t\t\t\t649D475C20C84FAC00513A67 /* ISOFormatter.swift in Sources */,\n\t\t\t\t6434DD6F20C7FEED007626EF /* Zones.swift in Sources */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n\t\t52D6D9EB1BEFFFBE002C0205 /* Sources */ = {\n\t\t\tisa = PBXSourcesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\t64B5E26320D30AE40067EDC1 /* TimePeriodCollection.swift in Sources */,\n\t\t\t\t649D473E20C81A2A00513A67 /* DateRepresentable.swift in Sources */,\n\t\t\t\t6470DD1720D27AF500BC2E74 /* String+Parser.swift in Sources */,\n\t\t\t\t649D47E420CAAB7400513A67 /* RelativeFormatter.swift in Sources */,\n\t\t\t\t6470DD3120D2B64200BC2E74 /* TimePeriod+Support.swift in Sources */,\n\t\t\t\t64B5E26920D30E620067EDC1 /* TimePeriodChain.swift in Sources */,\n\t\t\t\t649D474420C81A4200513A67 /* Date.swift in Sources */,\n\t\t\t\t649D477020C85C7100513A67 /* ISOParser.swift in Sources */,\n\t\t\t\t6434DD7F20C803EF007626EF /* SwiftDate.swift in Sources */,\n\t\t\t\t649D0E062287412C0056D42E /* RelativeFormatterLanguage.swift in Sources */,\n\t\t\t\t649D47BF20C959F500513A67 /* Date+Math.swift in Sources */,\n\t\t\t\t649D47AD20C91C0B00513A67 /* Date+Compare.swift in Sources */,\n\t\t\t\t6434DD7520C80126007626EF /* Calendars.swift in Sources */,\n\t\t\t\t649D478820C8861200513A67 /* DateInRegion+Components.swift in Sources */,\n\t\t\t\t649D477C20C877C300513A67 /* DateInRegion+Create.swift in Sources */,\n\t\t\t\t647AD65921F4826100CF787E /* TimeStructures.swift in Sources */,\n\t\t\t\t64B5E25620D306220067EDC1 /* TimePeriod.swift in Sources */,\n\t\t\t\t649D478220C880DC00513A67 /* Date+Create.swift in Sources */,\n\t\t\t\t6470DD2420D2A55300BC2E74 /* TimePeriodProtocol.swift in Sources */,\n\t\t\t\t649D475120C827C400513A67 /* AssociatedValues.swift in Sources */,\n\t\t\t\t649D476420C8529500513A67 /* Formatter+Protocols.swift in Sources */,\n\t\t\t\t649D474B20C8241C00513A67 /* Commons.swift in Sources */,\n\t\t\t\t6434DD7A20C80263007626EF /* Locales.swift in Sources */,\n\t\t\t\t64B5E25C20D3090A0067EDC1 /* TimePeriodGroup.swift in Sources */,\n\t\t\t\t649D477620C872DA00513A67 /* DotNetParserFormatter.swift in Sources */,\n\t\t\t\t6434DD6420C7FAF6007626EF /* DateInRegion.swift in Sources */,\n\t\t\t\t649D47B920C9586500513A67 /* DateInRegion+Math.swift in Sources */,\n\t\t\t\t649D479520C913E200513A67 /* Date+Components.swift in Sources */,\n\t\t\t\t649D47F120CAB96D00513A67 /* RelativeFormatter+Style.swift in Sources */,\n\t\t\t\t6470DD1D20D296EA00BC2E74 /* TimeInterval+Formatter.swift in Sources */,\n\t\t\t\t6434DD6A20C7FC6A007626EF /* Region.swift in Sources */,\n\t\t\t\t649D47A720C91BEA00513A67 /* DateInRegion+Compare.swift in Sources */,\n\t\t\t\t649D47C520C964E000513A67 /* Int+DateComponents.swift in Sources */,\n\t\t\t\t649D47B320C9276400513A67 /* DateComponents+Extras.swift in Sources */,\n\t\t\t\t649D475D20C84FAC00513A67 /* ISOFormatter.swift in Sources */,\n\t\t\t\t6434DD7020C7FEED007626EF /* Zones.swift in Sources */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n\t\t52D6DA0A1BF000BD002C0205 /* Sources */ = {\n\t\t\tisa = PBXSourcesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\t64B5E26120D30AE40067EDC1 /* TimePeriodCollection.swift in Sources */,\n\t\t\t\t649D473C20C81A2A00513A67 /* DateRepresentable.swift in Sources */,\n\t\t\t\t6470DD1520D27AF500BC2E74 /* String+Parser.swift in Sources */,\n\t\t\t\t649D47E220CAAB7400513A67 /* RelativeFormatter.swift in Sources */,\n\t\t\t\t6470DD2F20D2B64200BC2E74 /* TimePeriod+Support.swift in Sources */,\n\t\t\t\t64B5E26720D30E620067EDC1 /* TimePeriodChain.swift in Sources */,\n\t\t\t\t649D474220C81A4200513A67 /* Date.swift in Sources */,\n\t\t\t\t649D476E20C85C7100513A67 /* ISOParser.swift in Sources */,\n\t\t\t\t6434DD7D20C803EF007626EF /* SwiftDate.swift in Sources */,\n\t\t\t\t649D0E042287412C0056D42E /* RelativeFormatterLanguage.swift in Sources */,\n\t\t\t\t649D47BD20C959F500513A67 /* Date+Math.swift in Sources */,\n\t\t\t\t649D47AB20C91C0B00513A67 /* Date+Compare.swift in Sources */,\n\t\t\t\t6434DD7320C80126007626EF /* Calendars.swift in Sources */,\n\t\t\t\t649D478620C8861200513A67 /* DateInRegion+Components.swift in Sources */,\n\t\t\t\t649D477A20C877C300513A67 /* DateInRegion+Create.swift in Sources */,\n\t\t\t\t647AD65721F4826100CF787E /* TimeStructures.swift in Sources */,\n\t\t\t\t64B5E25420D306220067EDC1 /* TimePeriod.swift in Sources */,\n\t\t\t\t649D478020C880DC00513A67 /* Date+Create.swift in Sources */,\n\t\t\t\t6470DD2220D2A55300BC2E74 /* TimePeriodProtocol.swift in Sources */,\n\t\t\t\t649D474F20C827C400513A67 /* AssociatedValues.swift in Sources */,\n\t\t\t\t649D476220C8529500513A67 /* Formatter+Protocols.swift in Sources */,\n\t\t\t\t649D474920C8241C00513A67 /* Commons.swift in Sources */,\n\t\t\t\t6434DD7820C80263007626EF /* Locales.swift in Sources */,\n\t\t\t\t64B5E25A20D3090A0067EDC1 /* TimePeriodGroup.swift in Sources */,\n\t\t\t\t649D477420C872DA00513A67 /* DotNetParserFormatter.swift in Sources */,\n\t\t\t\t6434DD6220C7FAF6007626EF /* DateInRegion.swift in Sources */,\n\t\t\t\t649D47B720C9586500513A67 /* DateInRegion+Math.swift in Sources */,\n\t\t\t\t649D479320C913E200513A67 /* Date+Components.swift in Sources */,\n\t\t\t\t649D47EF20CAB96D00513A67 /* RelativeFormatter+Style.swift in Sources */,\n\t\t\t\t6470DD1B20D296EA00BC2E74 /* TimeInterval+Formatter.swift in Sources */,\n\t\t\t\t6434DD6820C7FC6A007626EF /* Region.swift in Sources */,\n\t\t\t\t649D47A520C91BEA00513A67 /* DateInRegion+Compare.swift in Sources */,\n\t\t\t\t649D47C320C964E000513A67 /* Int+DateComponents.swift in Sources */,\n\t\t\t\t649D47B120C9276400513A67 /* DateComponents+Extras.swift in Sources */,\n\t\t\t\t649D475B20C84FAC00513A67 /* ISOFormatter.swift in Sources */,\n\t\t\t\t6434DD6E20C7FEED007626EF /* Zones.swift in Sources */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n\t\t6434DD8820C809B2007626EF /* Sources */ = {\n\t\t\tisa = PBXSourcesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\t649D0E072287412C0056D42E /* RelativeFormatterLanguage.swift in Sources */,\n\t\t\t\t649D475E20C84FAC00513A67 /* ISOFormatter.swift in Sources */,\n\t\t\t\t64B5E26A20D30E620067EDC1 /* TimePeriodChain.swift in Sources */,\n\t\t\t\t6434DDA020C809C2007626EF /* Calendars.swift in Sources */,\n\t\t\t\t649D47E520CAAB7400513A67 /* RelativeFormatter.swift in Sources */,\n\t\t\t\t6470DD1820D27AF500BC2E74 /* String+Parser.swift in Sources */,\n\t\t\t\t649D475220C827C400513A67 /* AssociatedValues.swift in Sources */,\n\t\t\t\t6434DDA120C809C2007626EF /* Locales.swift in Sources */,\n\t\t\t\t649D476520C8529500513A67 /* Formatter+Protocols.swift in Sources */,\n\t\t\t\t6470DD2520D2A55300BC2E74 /* TimePeriodProtocol.swift in Sources */,\n\t\t\t\t647AD65A21F4826100CF787E /* TimeStructures.swift in Sources */,\n\t\t\t\t6434DD9F20C809C2007626EF /* Zones.swift in Sources */,\n\t\t\t\t6434DDA520C809C2007626EF /* Region.swift in Sources */,\n\t\t\t\t649D474C20C8241C00513A67 /* Commons.swift in Sources */,\n\t\t\t\t6470DD3220D2B64200BC2E74 /* TimePeriod+Support.swift in Sources */,\n\t\t\t\t649D47BA20C9586500513A67 /* DateInRegion+Math.swift in Sources */,\n\t\t\t\t649D479620C913E200513A67 /* Date+Components.swift in Sources */,\n\t\t\t\t649D477D20C877C300513A67 /* DateInRegion+Create.swift in Sources */,\n\t\t\t\t649D47B420C9276400513A67 /* DateComponents+Extras.swift in Sources */,\n\t\t\t\t649D47C020C959F500513A67 /* Date+Math.swift in Sources */,\n\t\t\t\t649D47AE20C91C0B00513A67 /* Date+Compare.swift in Sources */,\n\t\t\t\t649D477720C872DA00513A67 /* DotNetParserFormatter.swift in Sources */,\n\t\t\t\t649D477120C85C7100513A67 /* ISOParser.swift in Sources */,\n\t\t\t\t649D47C620C964E000513A67 /* Int+DateComponents.swift in Sources */,\n\t\t\t\t6434DDA420C809C2007626EF /* DateInRegion.swift in Sources */,\n\t\t\t\t6434DD9120C809B3007626EF /* ViewController.swift in Sources */,\n\t\t\t\t649D47A820C91BEA00513A67 /* DateInRegion+Compare.swift in Sources */,\n\t\t\t\t649D474520C81A4200513A67 /* Date.swift in Sources */,\n\t\t\t\t64B5E26420D30AE40067EDC1 /* TimePeriodCollection.swift in Sources */,\n\t\t\t\t649D473F20C81A2A00513A67 /* DateRepresentable.swift in Sources */,\n\t\t\t\t649D478320C880DC00513A67 /* Date+Create.swift in Sources */,\n\t\t\t\t64B5E25720D306220067EDC1 /* TimePeriod.swift in Sources */,\n\t\t\t\t6470DD1E20D296EA00BC2E74 /* TimeInterval+Formatter.swift in Sources */,\n\t\t\t\t6434DD8F20C809B3007626EF /* AppDelegate.swift in Sources */,\n\t\t\t\t649D478920C8861200513A67 /* DateInRegion+Components.swift in Sources */,\n\t\t\t\t649D47F220CAB96D00513A67 /* RelativeFormatter+Style.swift in Sources */,\n\t\t\t\t6434DD9E20C809C2007626EF /* SwiftDate.swift in Sources */,\n\t\t\t\t64B5E25D20D3090A0067EDC1 /* TimePeriodGroup.swift in Sources */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n\t\tDD7502761C68FCFC006590AF /* Sources */ = {\n\t\t\tisa = PBXSourcesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\t64BAB12520E63A3A00FEED79 /* TestDateInRegion+Langs.swift in Sources */,\n\t\t\t\t647AD65D21F4851F00CF787E /* TestDataStructures.swift in Sources */,\n\t\t\t\tA89F3FAF22A00019002D1BD0 /* TestDate.swift in Sources */,\n\t\t\t\t6439232320D912670098EC03 /* TestDateInRegion+Math.swift in Sources */,\n\t\t\t\t64EF3E1020D65478002793C6 /* TestDateInRegion+Compare.swift in Sources */,\n\t\t\t\t6439232720D91D170098EC03 /* TestFormatters.swift in Sources */,\n\t\t\t\t64EF3E0C20D65329002793C6 /* TestDateInRegion+Create.swift in Sources */,\n\t\t\t\t64EF3E0820D5622D002793C6 /* TestDateInRegion.swift in Sources */,\n\t\t\t\t6439231F20D90CB10098EC03 /* TestDateInRegion+Components.swift in Sources */,\n\t\t\t\t64EF3E0420D551E4002793C6 /* TestRegion.swift in Sources */,\n\t\t\t\t64BAB12920E6411100FEED79 /* TestSwiftDate.swift in Sources */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n\t\tDD7502891C690C7A006590AF /* Sources */ = {\n\t\t\tisa = PBXSourcesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\t64BAB12620E63A3A00FEED79 /* TestDateInRegion+Langs.swift in Sources */,\n\t\t\t\t647AD65E21F4851F00CF787E /* TestDataStructures.swift in Sources */,\n\t\t\t\t6439232420D912670098EC03 /* TestDateInRegion+Math.swift in Sources */,\n\t\t\t\t64EF3E1120D65478002793C6 /* TestDateInRegion+Compare.swift in Sources */,\n\t\t\t\t6439232820D91D170098EC03 /* TestFormatters.swift in Sources */,\n\t\t\t\t64EF3E0D20D65329002793C6 /* TestDateInRegion+Create.swift in Sources */,\n\t\t\t\t64EF3E0920D5622D002793C6 /* TestDateInRegion.swift in Sources */,\n\t\t\t\t6439232020D90CB10098EC03 /* TestDateInRegion+Components.swift in Sources */,\n\t\t\t\t64EF3E0520D551E5002793C6 /* TestRegion.swift in Sources */,\n\t\t\t\t64BAB12A20E6411100FEED79 /* TestSwiftDate.swift in Sources */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXSourcesBuildPhase section */\n\n/* Begin PBXTargetDependency section */\n\t\t52D6D9891BEFF229002C0205 /* PBXTargetDependency */ = {\n\t\t\tisa = PBXTargetDependency;\n\t\t\ttarget = 52D6D97B1BEFF229002C0205 /* SwiftDate-iOS */;\n\t\t\ttargetProxy = 52D6D9881BEFF229002C0205 /* PBXContainerItemProxy */;\n\t\t};\n\t\tDD7502811C68FCFC006590AF /* PBXTargetDependency */ = {\n\t\t\tisa = PBXTargetDependency;\n\t\t\ttarget = 52D6DA0E1BF000BD002C0205 /* SwiftDate-macOS */;\n\t\t\ttargetProxy = DD7502801C68FCFC006590AF /* PBXContainerItemProxy */;\n\t\t};\n\t\tDD7502941C690C7A006590AF /* PBXTargetDependency */ = {\n\t\t\tisa = PBXTargetDependency;\n\t\t\ttarget = 52D6D9EF1BEFFFBE002C0205 /* SwiftDate-tvOS */;\n\t\t\ttargetProxy = DD7502931C690C7A006590AF /* PBXContainerItemProxy */;\n\t\t};\n/* End PBXTargetDependency section */\n\n/* Begin PBXVariantGroup section */\n\t\t6434DD9220C809B3007626EF /* Main.storyboard */ = {\n\t\t\tisa = PBXVariantGroup;\n\t\t\tchildren = (\n\t\t\t\t6434DD9320C809B3007626EF /* Base */,\n\t\t\t);\n\t\t\tname = Main.storyboard;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t6434DD9720C809B4007626EF /* LaunchScreen.storyboard */ = {\n\t\t\tisa = PBXVariantGroup;\n\t\t\tchildren = (\n\t\t\t\t6434DD9820C809B4007626EF /* Base */,\n\t\t\t);\n\t\t\tname = LaunchScreen.storyboard;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n/* End PBXVariantGroup section */\n\n/* Begin XCBuildConfiguration section */\n\t\t52D6D98E1BEFF229002C0205 /* Debug */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tALWAYS_SEARCH_USER_PATHS = NO;\n\t\t\t\tCLANG_CXX_LANGUAGE_STANDARD = \"gnu++0x\";\n\t\t\t\tCLANG_CXX_LIBRARY = \"libc++\";\n\t\t\t\tCLANG_ENABLE_MODULES = YES;\n\t\t\t\tCLANG_ENABLE_OBJC_ARC = YES;\n\t\t\t\tCLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;\n\t\t\t\tCLANG_WARN_BOOL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_COMMA = YES;\n\t\t\t\tCLANG_WARN_CONSTANT_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;\n\t\t\t\tCLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;\n\t\t\t\tCLANG_WARN_EMPTY_BODY = YES;\n\t\t\t\tCLANG_WARN_ENUM_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_INFINITE_RECURSION = YES;\n\t\t\t\tCLANG_WARN_INT_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;\n\t\t\t\tCLANG_WARN_OBJC_LITERAL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;\n\t\t\t\tCLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;\n\t\t\t\tCLANG_WARN_RANGE_LOOP_ANALYSIS = YES;\n\t\t\t\tCLANG_WARN_STRICT_PROTOTYPES = YES;\n\t\t\t\tCLANG_WARN_SUSPICIOUS_MOVE = YES;\n\t\t\t\tCLANG_WARN_UNREACHABLE_CODE = YES;\n\t\t\t\tCLANG_WARN__DUPLICATE_METHOD_MATCH = YES;\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=iphoneos*]\" = \"iPhone Developer\";\n\t\t\t\tCOPY_PHASE_STRIP = NO;\n\t\t\t\tCURRENT_PROJECT_VERSION = 1;\n\t\t\t\tDEBUG_INFORMATION_FORMAT = dwarf;\n\t\t\t\tENABLE_STRICT_OBJC_MSGSEND = YES;\n\t\t\t\tENABLE_TESTABILITY = YES;\n\t\t\t\tGCC_C_LANGUAGE_STANDARD = gnu99;\n\t\t\t\tGCC_DYNAMIC_NO_PIC = NO;\n\t\t\t\tGCC_NO_COMMON_BLOCKS = YES;\n\t\t\t\tGCC_OPTIMIZATION_LEVEL = 0;\n\t\t\t\tGCC_PREPROCESSOR_DEFINITIONS = (\n\t\t\t\t\t\"DEBUG=1\",\n\t\t\t\t\t\"$(inherited)\",\n\t\t\t\t);\n\t\t\t\tGCC_WARN_64_TO_32_BIT_CONVERSION = YES;\n\t\t\t\tGCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;\n\t\t\t\tGCC_WARN_UNDECLARED_SELECTOR = YES;\n\t\t\t\tGCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;\n\t\t\t\tGCC_WARN_UNUSED_FUNCTION = YES;\n\t\t\t\tGCC_WARN_UNUSED_VARIABLE = YES;\n\t\t\t\tIPHONEOS_DEPLOYMENT_TARGET = 12.0;\n\t\t\t\tMTL_ENABLE_DEBUG_INFO = YES;\n\t\t\t\tONLY_ACTIVE_ARCH = YES;\n\t\t\t\tSDKROOT = iphoneos;\n\t\t\t\tSWIFT_OPTIMIZATION_LEVEL = \"-Onone\";\n\t\t\t\tSWIFT_VERSION = 5.0;\n\t\t\t\tTARGETED_DEVICE_FAMILY = \"1,2\";\n\t\t\t\tVERSIONING_SYSTEM = \"apple-generic\";\n\t\t\t\tVERSION_INFO_PREFIX = \"\";\n\t\t\t};\n\t\t\tname = Debug;\n\t\t};\n\t\t52D6D98F1BEFF229002C0205 /* Release */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tALWAYS_SEARCH_USER_PATHS = NO;\n\t\t\t\tCLANG_CXX_LANGUAGE_STANDARD = \"gnu++0x\";\n\t\t\t\tCLANG_CXX_LIBRARY = \"libc++\";\n\t\t\t\tCLANG_ENABLE_MODULES = YES;\n\t\t\t\tCLANG_ENABLE_OBJC_ARC = YES;\n\t\t\t\tCLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;\n\t\t\t\tCLANG_WARN_BOOL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_COMMA = YES;\n\t\t\t\tCLANG_WARN_CONSTANT_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;\n\t\t\t\tCLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;\n\t\t\t\tCLANG_WARN_EMPTY_BODY = YES;\n\t\t\t\tCLANG_WARN_ENUM_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_INFINITE_RECURSION = YES;\n\t\t\t\tCLANG_WARN_INT_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;\n\t\t\t\tCLANG_WARN_OBJC_LITERAL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;\n\t\t\t\tCLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;\n\t\t\t\tCLANG_WARN_RANGE_LOOP_ANALYSIS = YES;\n\t\t\t\tCLANG_WARN_STRICT_PROTOTYPES = YES;\n\t\t\t\tCLANG_WARN_SUSPICIOUS_MOVE = YES;\n\t\t\t\tCLANG_WARN_UNREACHABLE_CODE = YES;\n\t\t\t\tCLANG_WARN__DUPLICATE_METHOD_MATCH = YES;\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=iphoneos*]\" = \"iPhone Developer\";\n\t\t\t\tCOPY_PHASE_STRIP = NO;\n\t\t\t\tCURRENT_PROJECT_VERSION = 1;\n\t\t\t\tDEBUG_INFORMATION_FORMAT = \"dwarf-with-dsym\";\n\t\t\t\tENABLE_NS_ASSERTIONS = NO;\n\t\t\t\tENABLE_STRICT_OBJC_MSGSEND = YES;\n\t\t\t\tGCC_C_LANGUAGE_STANDARD = gnu99;\n\t\t\t\tGCC_NO_COMMON_BLOCKS = YES;\n\t\t\t\tGCC_WARN_64_TO_32_BIT_CONVERSION = YES;\n\t\t\t\tGCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;\n\t\t\t\tGCC_WARN_UNDECLARED_SELECTOR = YES;\n\t\t\t\tGCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;\n\t\t\t\tGCC_WARN_UNUSED_FUNCTION = YES;\n\t\t\t\tGCC_WARN_UNUSED_VARIABLE = YES;\n\t\t\t\tIPHONEOS_DEPLOYMENT_TARGET = 12.0;\n\t\t\t\tMTL_ENABLE_DEBUG_INFO = NO;\n\t\t\t\tSDKROOT = iphoneos;\n\t\t\t\tSWIFT_VERSION = 5.0;\n\t\t\t\tTARGETED_DEVICE_FAMILY = \"1,2\";\n\t\t\t\tVALIDATE_PRODUCT = YES;\n\t\t\t\tVERSIONING_SYSTEM = \"apple-generic\";\n\t\t\t\tVERSION_INFO_PREFIX = \"\";\n\t\t\t};\n\t\t\tname = Release;\n\t\t};\n\t\t52D6D9911BEFF229002C0205 /* Debug */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tAPPLICATION_EXTENSION_API_ONLY = YES;\n\t\t\t\tCLANG_ENABLE_MODULES = YES;\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=iphoneos*]\" = \"\";\n\t\t\t\tCURRENT_PROJECT_VERSION = 0;\n\t\t\t\tDEFINES_MODULE = YES;\n\t\t\t\tDYLIB_COMPATIBILITY_VERSION = 1;\n\t\t\t\tDYLIB_CURRENT_VERSION = 1;\n\t\t\t\tDYLIB_INSTALL_NAME_BASE = \"@rpath\";\n\t\t\t\tINFOPLIST_FILE = Configs/SwiftDate.plist;\n\t\t\t\tINSTALL_PATH = \"$(LOCAL_LIBRARY_DIR)/Frameworks\";\n\t\t\t\tIPHONEOS_DEPLOYMENT_TARGET = 9.0;\n\t\t\t\tLD_RUNPATH_SEARCH_PATHS = \"$(inherited) @executable_path/Frameworks @loader_path/Frameworks\";\n\t\t\t\tMARKETING_VERSION = 6.3.1;\n\t\t\t\tONLY_ACTIVE_ARCH = NO;\n\t\t\t\tPRODUCT_BUNDLE_IDENTIFIER = \"com.SwiftDate.SwiftDate-iOS\";\n\t\t\t\tPRODUCT_NAME = SwiftDate;\n\t\t\t\tSKIP_INSTALL = YES;\n\t\t\t\tSWIFT_OPTIMIZATION_LEVEL = \"-Onone\";\n\t\t\t};\n\t\t\tname = Debug;\n\t\t};\n\t\t52D6D9921BEFF229002C0205 /* Release */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tAPPLICATION_EXTENSION_API_ONLY = YES;\n\t\t\t\tCLANG_ENABLE_MODULES = YES;\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=iphoneos*]\" = \"\";\n\t\t\t\tCURRENT_PROJECT_VERSION = 0;\n\t\t\t\tDEFINES_MODULE = YES;\n\t\t\t\tDYLIB_COMPATIBILITY_VERSION = 1;\n\t\t\t\tDYLIB_CURRENT_VERSION = 1;\n\t\t\t\tDYLIB_INSTALL_NAME_BASE = \"@rpath\";\n\t\t\t\tINFOPLIST_FILE = Configs/SwiftDate.plist;\n\t\t\t\tINSTALL_PATH = \"$(LOCAL_LIBRARY_DIR)/Frameworks\";\n\t\t\t\tIPHONEOS_DEPLOYMENT_TARGET = 9.0;\n\t\t\t\tLD_RUNPATH_SEARCH_PATHS = \"$(inherited) @executable_path/Frameworks @loader_path/Frameworks\";\n\t\t\t\tMARKETING_VERSION = 6.3.1;\n\t\t\t\tPRODUCT_BUNDLE_IDENTIFIER = \"com.SwiftDate.SwiftDate-iOS\";\n\t\t\t\tPRODUCT_NAME = SwiftDate;\n\t\t\t\tSKIP_INSTALL = YES;\n\t\t\t\tSWIFT_OPTIMIZATION_LEVEL = \"-Owholemodule\";\n\t\t\t};\n\t\t\tname = Release;\n\t\t};\n\t\t52D6D9941BEFF229002C0205 /* Debug */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;\n\t\t\t\tCLANG_ENABLE_MODULES = YES;\n\t\t\t\tINFOPLIST_FILE = Configs/SwiftDateTests.plist;\n\t\t\t\tLD_RUNPATH_SEARCH_PATHS = \"$(inherited) @executable_path/Frameworks @loader_path/Frameworks\";\n\t\t\t\tPRODUCT_BUNDLE_IDENTIFIER = \"com.SwiftDate.SwiftDate-iOS-Tests\";\n\t\t\t\tPRODUCT_NAME = \"$(TARGET_NAME)\";\n\t\t\t\tSWIFT_OPTIMIZATION_LEVEL = \"-Onone\";\n\t\t\t};\n\t\t\tname = Debug;\n\t\t};\n\t\t52D6D9951BEFF229002C0205 /* Release */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;\n\t\t\t\tCLANG_ENABLE_MODULES = YES;\n\t\t\t\tINFOPLIST_FILE = Configs/SwiftDateTests.plist;\n\t\t\t\tLD_RUNPATH_SEARCH_PATHS = \"$(inherited) @executable_path/Frameworks @loader_path/Frameworks\";\n\t\t\t\tPRODUCT_BUNDLE_IDENTIFIER = \"com.SwiftDate.SwiftDate-iOS-Tests\";\n\t\t\t\tPRODUCT_NAME = \"$(TARGET_NAME)\";\n\t\t\t\tSWIFT_OPTIMIZATION_LEVEL = \"-Owholemodule\";\n\t\t\t};\n\t\t\tname = Release;\n\t\t};\n\t\t52D6D9E81BEFFF6E002C0205 /* Debug */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tAPPLICATION_EXTENSION_API_ONLY = YES;\n\t\t\t\tCLANG_ENABLE_MODULES = YES;\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=watchos*]\" = \"\";\n\t\t\t\tCURRENT_PROJECT_VERSION = 0;\n\t\t\t\tDEFINES_MODULE = YES;\n\t\t\t\tDYLIB_COMPATIBILITY_VERSION = 1;\n\t\t\t\tDYLIB_CURRENT_VERSION = 1;\n\t\t\t\tDYLIB_INSTALL_NAME_BASE = \"@rpath\";\n\t\t\t\tINFOPLIST_FILE = Configs/SwiftDate.plist;\n\t\t\t\tINSTALL_PATH = \"$(LOCAL_LIBRARY_DIR)/Frameworks\";\n\t\t\t\tLD_RUNPATH_SEARCH_PATHS = \"$(inherited) @executable_path/Frameworks @loader_path/Frameworks\";\n\t\t\t\tMARKETING_VERSION = 6.3.1;\n\t\t\t\tPRODUCT_BUNDLE_IDENTIFIER = \"com.SwiftDate.SwiftDate-watchOS\";\n\t\t\t\tPRODUCT_NAME = SwiftDate;\n\t\t\t\tSDKROOT = watchos;\n\t\t\t\tSKIP_INSTALL = YES;\n\t\t\t\tSWIFT_OPTIMIZATION_LEVEL = \"-Onone\";\n\t\t\t\tTARGETED_DEVICE_FAMILY = 4;\n\t\t\t\tWATCHOS_DEPLOYMENT_TARGET = 2.0;\n\t\t\t};\n\t\t\tname = Debug;\n\t\t};\n\t\t52D6D9E91BEFFF6E002C0205 /* Release */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tAPPLICATION_EXTENSION_API_ONLY = YES;\n\t\t\t\tCLANG_ENABLE_MODULES = YES;\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=watchos*]\" = \"\";\n\t\t\t\tCURRENT_PROJECT_VERSION = 0;\n\t\t\t\tDEFINES_MODULE = YES;\n\t\t\t\tDYLIB_COMPATIBILITY_VERSION = 1;\n\t\t\t\tDYLIB_CURRENT_VERSION = 1;\n\t\t\t\tDYLIB_INSTALL_NAME_BASE = \"@rpath\";\n\t\t\t\tINFOPLIST_FILE = Configs/SwiftDate.plist;\n\t\t\t\tINSTALL_PATH = \"$(LOCAL_LIBRARY_DIR)/Frameworks\";\n\t\t\t\tLD_RUNPATH_SEARCH_PATHS = \"$(inherited) @executable_path/Frameworks @loader_path/Frameworks\";\n\t\t\t\tMARKETING_VERSION = 6.3.1;\n\t\t\t\tPRODUCT_BUNDLE_IDENTIFIER = \"com.SwiftDate.SwiftDate-watchOS\";\n\t\t\t\tPRODUCT_NAME = SwiftDate;\n\t\t\t\tSDKROOT = watchos;\n\t\t\t\tSKIP_INSTALL = YES;\n\t\t\t\tSWIFT_OPTIMIZATION_LEVEL = \"-Owholemodule\";\n\t\t\t\tTARGETED_DEVICE_FAMILY = 4;\n\t\t\t\tWATCHOS_DEPLOYMENT_TARGET = 2.0;\n\t\t\t};\n\t\t\tname = Release;\n\t\t};\n\t\t52D6DA021BEFFFBE002C0205 /* Debug */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tAPPLICATION_EXTENSION_API_ONLY = YES;\n\t\t\t\tCLANG_ENABLE_MODULES = YES;\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=appletvos*]\" = \"\";\n\t\t\t\tCURRENT_PROJECT_VERSION = 0;\n\t\t\t\tDEFINES_MODULE = YES;\n\t\t\t\tDYLIB_COMPATIBILITY_VERSION = 1;\n\t\t\t\tDYLIB_CURRENT_VERSION = 1;\n\t\t\t\tDYLIB_INSTALL_NAME_BASE = \"@rpath\";\n\t\t\t\tINFOPLIST_FILE = Configs/SwiftDate.plist;\n\t\t\t\tINSTALL_PATH = \"$(LOCAL_LIBRARY_DIR)/Frameworks\";\n\t\t\t\tLD_RUNPATH_SEARCH_PATHS = \"$(inherited) @executable_path/Frameworks @loader_path/Frameworks\";\n\t\t\t\tMARKETING_VERSION = 6.3.1;\n\t\t\t\tPRODUCT_BUNDLE_IDENTIFIER = \"com.SwiftDate.SwiftDate-tvOS\";\n\t\t\t\tPRODUCT_NAME = SwiftDate;\n\t\t\t\tSDKROOT = appletvos;\n\t\t\t\tSKIP_INSTALL = YES;\n\t\t\t\tSWIFT_OPTIMIZATION_LEVEL = \"-Onone\";\n\t\t\t\tTARGETED_DEVICE_FAMILY = 3;\n\t\t\t\tTVOS_DEPLOYMENT_TARGET = 9.0;\n\t\t\t};\n\t\t\tname = Debug;\n\t\t};\n\t\t52D6DA031BEFFFBE002C0205 /* Release */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tAPPLICATION_EXTENSION_API_ONLY = YES;\n\t\t\t\tCLANG_ENABLE_MODULES = YES;\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=appletvos*]\" = \"\";\n\t\t\t\tCURRENT_PROJECT_VERSION = 0;\n\t\t\t\tDEFINES_MODULE = YES;\n\t\t\t\tDYLIB_COMPATIBILITY_VERSION = 1;\n\t\t\t\tDYLIB_CURRENT_VERSION = 1;\n\t\t\t\tDYLIB_INSTALL_NAME_BASE = \"@rpath\";\n\t\t\t\tINFOPLIST_FILE = Configs/SwiftDate.plist;\n\t\t\t\tINSTALL_PATH = \"$(LOCAL_LIBRARY_DIR)/Frameworks\";\n\t\t\t\tLD_RUNPATH_SEARCH_PATHS = \"$(inherited) @executable_path/Frameworks @loader_path/Frameworks\";\n\t\t\t\tMARKETING_VERSION = 6.3.1;\n\t\t\t\tPRODUCT_BUNDLE_IDENTIFIER = \"com.SwiftDate.SwiftDate-tvOS\";\n\t\t\t\tPRODUCT_NAME = SwiftDate;\n\t\t\t\tSDKROOT = appletvos;\n\t\t\t\tSKIP_INSTALL = YES;\n\t\t\t\tSWIFT_OPTIMIZATION_LEVEL = \"-Owholemodule\";\n\t\t\t\tTARGETED_DEVICE_FAMILY = 3;\n\t\t\t\tTVOS_DEPLOYMENT_TARGET = 9.0;\n\t\t\t};\n\t\t\tname = Release;\n\t\t};\n\t\t52D6DA211BF000BD002C0205 /* Debug */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tAPPLICATION_EXTENSION_API_ONLY = YES;\n\t\t\t\tCLANG_ENABLE_MODULES = YES;\n\t\t\t\tCODE_SIGN_IDENTITY = \"-\";\n\t\t\t\tCOMBINE_HIDPI_IMAGES = YES;\n\t\t\t\tCURRENT_PROJECT_VERSION = 0;\n\t\t\t\tDEFINES_MODULE = YES;\n\t\t\t\tDYLIB_COMPATIBILITY_VERSION = 1;\n\t\t\t\tDYLIB_CURRENT_VERSION = 1;\n\t\t\t\tDYLIB_INSTALL_NAME_BASE = \"@rpath\";\n\t\t\t\tFRAMEWORK_VERSION = A;\n\t\t\t\tINFOPLIST_FILE = Configs/SwiftDate.plist;\n\t\t\t\tINSTALL_PATH = \"$(LOCAL_LIBRARY_DIR)/Frameworks\";\n\t\t\t\tLD_RUNPATH_SEARCH_PATHS = \"$(inherited) @executable_path/../Frameworks @loader_path/Frameworks\";\n\t\t\t\tMACOSX_DEPLOYMENT_TARGET = 10.10;\n\t\t\t\tMARKETING_VERSION = 6.3.1;\n\t\t\t\tPRODUCT_BUNDLE_IDENTIFIER = \"com.SwiftDate.SwiftDate-macOS\";\n\t\t\t\tPRODUCT_NAME = SwiftDate;\n\t\t\t\tSDKROOT = macosx;\n\t\t\t\tSKIP_INSTALL = YES;\n\t\t\t\tSWIFT_OPTIMIZATION_LEVEL = \"-Onone\";\n\t\t\t};\n\t\t\tname = Debug;\n\t\t};\n\t\t52D6DA221BF000BD002C0205 /* Release */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tAPPLICATION_EXTENSION_API_ONLY = YES;\n\t\t\t\tCLANG_ENABLE_MODULES = YES;\n\t\t\t\tCODE_SIGN_IDENTITY = \"-\";\n\t\t\t\tCOMBINE_HIDPI_IMAGES = YES;\n\t\t\t\tCURRENT_PROJECT_VERSION = 0;\n\t\t\t\tDEFINES_MODULE = YES;\n\t\t\t\tDYLIB_COMPATIBILITY_VERSION = 1;\n\t\t\t\tDYLIB_CURRENT_VERSION = 1;\n\t\t\t\tDYLIB_INSTALL_NAME_BASE = \"@rpath\";\n\t\t\t\tFRAMEWORK_VERSION = A;\n\t\t\t\tINFOPLIST_FILE = Configs/SwiftDate.plist;\n\t\t\t\tINSTALL_PATH = \"$(LOCAL_LIBRARY_DIR)/Frameworks\";\n\t\t\t\tLD_RUNPATH_SEARCH_PATHS = \"$(inherited) @executable_path/../Frameworks @loader_path/Frameworks\";\n\t\t\t\tMACOSX_DEPLOYMENT_TARGET = 10.10;\n\t\t\t\tMARKETING_VERSION = 6.3.1;\n\t\t\t\tPRODUCT_BUNDLE_IDENTIFIER = \"com.SwiftDate.SwiftDate-macOS\";\n\t\t\t\tPRODUCT_NAME = SwiftDate;\n\t\t\t\tSDKROOT = macosx;\n\t\t\t\tSKIP_INSTALL = YES;\n\t\t\t\tSWIFT_OPTIMIZATION_LEVEL = \"-Owholemodule\";\n\t\t\t};\n\t\t\tname = Release;\n\t\t};\n\t\t6434DD9C20C809B4007626EF /* Debug */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;\n\t\t\t\tCLANG_ANALYZER_NONNULL = YES;\n\t\t\t\tCLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;\n\t\t\t\tCLANG_CXX_LANGUAGE_STANDARD = \"gnu++14\";\n\t\t\t\tCLANG_ENABLE_OBJC_WEAK = YES;\n\t\t\t\tCLANG_WARN_DOCUMENTATION_COMMENTS = YES;\n\t\t\t\tCLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;\n\t\t\t\tCODE_SIGN_IDENTITY = \"iPhone Developer\";\n\t\t\t\tCODE_SIGN_STYLE = Automatic;\n\t\t\t\tDEVELOPMENT_TEAM = E5DU3FA699;\n\t\t\t\tGCC_C_LANGUAGE_STANDARD = gnu11;\n\t\t\t\tINFOPLIST_FILE = TestApplication/Info.plist;\n\t\t\t\tIPHONEOS_DEPLOYMENT_TARGET = 12.0;\n\t\t\t\tLD_RUNPATH_SEARCH_PATHS = \"$(inherited) @executable_path/Frameworks\";\n\t\t\t\tPRODUCT_BUNDLE_IDENTIFIER = com.breakfastcode.TestApplication;\n\t\t\t\tPRODUCT_NAME = \"$(TARGET_NAME)\";\n\t\t\t\tSWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;\n\t\t\t\tTARGETED_DEVICE_FAMILY = \"1,2\";\n\t\t\t};\n\t\t\tname = Debug;\n\t\t};\n\t\t6434DD9D20C809B4007626EF /* Release */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;\n\t\t\t\tCLANG_ANALYZER_NONNULL = YES;\n\t\t\t\tCLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;\n\t\t\t\tCLANG_CXX_LANGUAGE_STANDARD = \"gnu++14\";\n\t\t\t\tCLANG_ENABLE_OBJC_WEAK = YES;\n\t\t\t\tCLANG_WARN_DOCUMENTATION_COMMENTS = YES;\n\t\t\t\tCLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;\n\t\t\t\tCODE_SIGN_IDENTITY = \"iPhone Developer\";\n\t\t\t\tCODE_SIGN_STYLE = Automatic;\n\t\t\t\tDEVELOPMENT_TEAM = E5DU3FA699;\n\t\t\t\tGCC_C_LANGUAGE_STANDARD = gnu11;\n\t\t\t\tINFOPLIST_FILE = TestApplication/Info.plist;\n\t\t\t\tIPHONEOS_DEPLOYMENT_TARGET = 12.0;\n\t\t\t\tLD_RUNPATH_SEARCH_PATHS = \"$(inherited) @executable_path/Frameworks\";\n\t\t\t\tPRODUCT_BUNDLE_IDENTIFIER = com.breakfastcode.TestApplication;\n\t\t\t\tPRODUCT_NAME = \"$(TARGET_NAME)\";\n\t\t\t\tSWIFT_OPTIMIZATION_LEVEL = \"-Owholemodule\";\n\t\t\t\tTARGETED_DEVICE_FAMILY = \"1,2\";\n\t\t\t};\n\t\t\tname = Release;\n\t\t};\n\t\tDD7502831C68FCFC006590AF /* Debug */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;\n\t\t\t\tCODE_SIGN_IDENTITY = \"-\";\n\t\t\t\tCOMBINE_HIDPI_IMAGES = YES;\n\t\t\t\tINFOPLIST_FILE = Configs/SwiftDateTests.plist;\n\t\t\t\tLD_RUNPATH_SEARCH_PATHS = \"$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks\";\n\t\t\t\tMACOSX_DEPLOYMENT_TARGET = 10.11;\n\t\t\t\tPRODUCT_BUNDLE_IDENTIFIER = \"com.SwiftDate.SwiftDate-macOS-Tests\";\n\t\t\t\tPRODUCT_NAME = \"$(TARGET_NAME)\";\n\t\t\t\tSDKROOT = macosx;\n\t\t\t};\n\t\t\tname = Debug;\n\t\t};\n\t\tDD7502841C68FCFC006590AF /* Release */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;\n\t\t\t\tCODE_SIGN_IDENTITY = \"-\";\n\t\t\t\tCOMBINE_HIDPI_IMAGES = YES;\n\t\t\t\tINFOPLIST_FILE = Configs/SwiftDateTests.plist;\n\t\t\t\tLD_RUNPATH_SEARCH_PATHS = \"$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks\";\n\t\t\t\tMACOSX_DEPLOYMENT_TARGET = 10.11;\n\t\t\t\tPRODUCT_BUNDLE_IDENTIFIER = \"com.SwiftDate.SwiftDate-macOS-Tests\";\n\t\t\t\tPRODUCT_NAME = \"$(TARGET_NAME)\";\n\t\t\t\tSDKROOT = macosx;\n\t\t\t\tSWIFT_OPTIMIZATION_LEVEL = \"-Owholemodule\";\n\t\t\t};\n\t\t\tname = Release;\n\t\t};\n\t\tDD7502961C690C7A006590AF /* Debug */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;\n\t\t\t\tINFOPLIST_FILE = Configs/SwiftDateTests.plist;\n\t\t\t\tLD_RUNPATH_SEARCH_PATHS = \"$(inherited) @executable_path/Frameworks @loader_path/Frameworks\";\n\t\t\t\tPRODUCT_BUNDLE_IDENTIFIER = \"com.SwiftDate.SwiftDate-tvOS-Tests\";\n\t\t\t\tPRODUCT_NAME = \"$(TARGET_NAME)\";\n\t\t\t\tSDKROOT = appletvos;\n\t\t\t\tTVOS_DEPLOYMENT_TARGET = 12.0;\n\t\t\t};\n\t\t\tname = Debug;\n\t\t};\n\t\tDD7502971C690C7A006590AF /* Release */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;\n\t\t\t\tINFOPLIST_FILE = Configs/SwiftDateTests.plist;\n\t\t\t\tLD_RUNPATH_SEARCH_PATHS = \"$(inherited) @executable_path/Frameworks @loader_path/Frameworks\";\n\t\t\t\tPRODUCT_BUNDLE_IDENTIFIER = \"com.SwiftDate.SwiftDate-tvOS-Tests\";\n\t\t\t\tPRODUCT_NAME = \"$(TARGET_NAME)\";\n\t\t\t\tSDKROOT = appletvos;\n\t\t\t\tSWIFT_OPTIMIZATION_LEVEL = \"-Owholemodule\";\n\t\t\t\tTVOS_DEPLOYMENT_TARGET = 12.0;\n\t\t\t};\n\t\t\tname = Release;\n\t\t};\n/* End XCBuildConfiguration section */\n\n/* Begin XCConfigurationList section */\n\t\t52D6D9761BEFF229002C0205 /* Build configuration list for PBXProject \"SwiftDate\" */ = {\n\t\t\tisa = XCConfigurationList;\n\t\t\tbuildConfigurations = (\n\t\t\t\t52D6D98E1BEFF229002C0205 /* Debug */,\n\t\t\t\t52D6D98F1BEFF229002C0205 /* Release */,\n\t\t\t);\n\t\t\tdefaultConfigurationIsVisible = 0;\n\t\t\tdefaultConfigurationName = Release;\n\t\t};\n\t\t52D6D9901BEFF229002C0205 /* Build configuration list for PBXNativeTarget \"SwiftDate-iOS\" */ = {\n\t\t\tisa = XCConfigurationList;\n\t\t\tbuildConfigurations = (\n\t\t\t\t52D6D9911BEFF229002C0205 /* Debug */,\n\t\t\t\t52D6D9921BEFF229002C0205 /* Release */,\n\t\t\t);\n\t\t\tdefaultConfigurationIsVisible = 0;\n\t\t\tdefaultConfigurationName = Release;\n\t\t};\n\t\t52D6D9931BEFF229002C0205 /* Build configuration list for PBXNativeTarget \"SwiftDate-iOS Tests\" */ = {\n\t\t\tisa = XCConfigurationList;\n\t\t\tbuildConfigurations = (\n\t\t\t\t52D6D9941BEFF229002C0205 /* Debug */,\n\t\t\t\t52D6D9951BEFF229002C0205 /* Release */,\n\t\t\t);\n\t\t\tdefaultConfigurationIsVisible = 0;\n\t\t\tdefaultConfigurationName = Release;\n\t\t};\n\t\t52D6D9E71BEFFF6E002C0205 /* Build configuration list for PBXNativeTarget \"SwiftDate-watchOS\" */ = {\n\t\t\tisa = XCConfigurationList;\n\t\t\tbuildConfigurations = (\n\t\t\t\t52D6D9E81BEFFF6E002C0205 /* Debug */,\n\t\t\t\t52D6D9E91BEFFF6E002C0205 /* Release */,\n\t\t\t);\n\t\t\tdefaultConfigurationIsVisible = 0;\n\t\t\tdefaultConfigurationName = Release;\n\t\t};\n\t\t52D6DA011BEFFFBE002C0205 /* Build configuration list for PBXNativeTarget \"SwiftDate-tvOS\" */ = {\n\t\t\tisa = XCConfigurationList;\n\t\t\tbuildConfigurations = (\n\t\t\t\t52D6DA021BEFFFBE002C0205 /* Debug */,\n\t\t\t\t52D6DA031BEFFFBE002C0205 /* Release */,\n\t\t\t);\n\t\t\tdefaultConfigurationIsVisible = 0;\n\t\t\tdefaultConfigurationName = Release;\n\t\t};\n\t\t52D6DA201BF000BD002C0205 /* Build configuration list for PBXNativeTarget \"SwiftDate-macOS\" */ = {\n\t\t\tisa = XCConfigurationList;\n\t\t\tbuildConfigurations = (\n\t\t\t\t52D6DA211BF000BD002C0205 /* Debug */,\n\t\t\t\t52D6DA221BF000BD002C0205 /* Release */,\n\t\t\t);\n\t\t\tdefaultConfigurationIsVisible = 0;\n\t\t\tdefaultConfigurationName = Release;\n\t\t};\n\t\t6434DD9B20C809B4007626EF /* Build configuration list for PBXNativeTarget \"TestApplication\" */ = {\n\t\t\tisa = XCConfigurationList;\n\t\t\tbuildConfigurations = (\n\t\t\t\t6434DD9C20C809B4007626EF /* Debug */,\n\t\t\t\t6434DD9D20C809B4007626EF /* Release */,\n\t\t\t);\n\t\t\tdefaultConfigurationIsVisible = 0;\n\t\t\tdefaultConfigurationName = Release;\n\t\t};\n\t\tDD7502821C68FCFC006590AF /* Build configuration list for PBXNativeTarget \"SwiftDate-macOS Tests\" */ = {\n\t\t\tisa = XCConfigurationList;\n\t\t\tbuildConfigurations = (\n\t\t\t\tDD7502831C68FCFC006590AF /* Debug */,\n\t\t\t\tDD7502841C68FCFC006590AF /* Release */,\n\t\t\t);\n\t\t\tdefaultConfigurationIsVisible = 0;\n\t\t\tdefaultConfigurationName = Release;\n\t\t};\n\t\tDD7502951C690C7A006590AF /* Build configuration list for PBXNativeTarget \"SwiftDate-tvOS Tests\" */ = {\n\t\t\tisa = XCConfigurationList;\n\t\t\tbuildConfigurations = (\n\t\t\t\tDD7502961C690C7A006590AF /* Debug */,\n\t\t\t\tDD7502971C690C7A006590AF /* Release */,\n\t\t\t);\n\t\t\tdefaultConfigurationIsVisible = 0;\n\t\t\tdefaultConfigurationName = Release;\n\t\t};\n/* End XCConfigurationList section */\n\t};\n\trootObject = 52D6D9731BEFF229002C0205 /* Project object */;\n}\n"
  },
  {
    "path": "SwiftDate.xcodeproj/project.xcworkspace/contents.xcworkspacedata",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<Workspace\n   version = \"1.0\">\n   <FileRef\n      location = \"self:\">\n   </FileRef>\n</Workspace>\n"
  },
  {
    "path": "SwiftDate.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n<plist version=\"1.0\">\n<dict>\n\t<key>IDEDidComputeMac32BitWarning</key>\n\t<true/>\n</dict>\n</plist>\n"
  },
  {
    "path": "SwiftDate.xcodeproj/xcshareddata/xcschemes/SwiftDate-iOS Tests.xcscheme",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<Scheme\n   LastUpgradeVersion = \"1220\"\n   version = \"1.3\">\n   <BuildAction\n      parallelizeBuildables = \"YES\"\n      buildImplicitDependencies = \"YES\">\n   </BuildAction>\n   <TestAction\n      buildConfiguration = \"Debug\"\n      selectedDebuggerIdentifier = \"Xcode.DebuggerFoundation.Debugger.LLDB\"\n      selectedLauncherIdentifier = \"Xcode.DebuggerFoundation.Launcher.LLDB\"\n      shouldUseLaunchSchemeArgsEnv = \"YES\">\n      <Testables>\n         <TestableReference\n            skipped = \"NO\">\n            <BuildableReference\n               BuildableIdentifier = \"primary\"\n               BlueprintIdentifier = \"52D6D9851BEFF229002C0205\"\n               BuildableName = \"SwiftDate-iOS Tests.xctest\"\n               BlueprintName = \"SwiftDate-iOS Tests\"\n               ReferencedContainer = \"container:SwiftDate.xcodeproj\">\n            </BuildableReference>\n         </TestableReference>\n      </Testables>\n   </TestAction>\n   <LaunchAction\n      buildConfiguration = \"Debug\"\n      selectedDebuggerIdentifier = \"Xcode.DebuggerFoundation.Debugger.LLDB\"\n      selectedLauncherIdentifier = \"Xcode.DebuggerFoundation.Launcher.LLDB\"\n      launchStyle = \"0\"\n      useCustomWorkingDirectory = \"NO\"\n      ignoresPersistentStateOnLaunch = \"NO\"\n      debugDocumentVersioning = \"YES\"\n      debugServiceExtension = \"internal\"\n      allowLocationSimulation = \"YES\">\n   </LaunchAction>\n   <ProfileAction\n      buildConfiguration = \"Release\"\n      shouldUseLaunchSchemeArgsEnv = \"YES\"\n      savedToolIdentifier = \"\"\n      useCustomWorkingDirectory = \"NO\"\n      debugDocumentVersioning = \"YES\">\n   </ProfileAction>\n   <AnalyzeAction\n      buildConfiguration = \"Debug\">\n   </AnalyzeAction>\n   <ArchiveAction\n      buildConfiguration = \"Release\"\n      revealArchiveInOrganizer = \"YES\">\n   </ArchiveAction>\n</Scheme>\n"
  },
  {
    "path": "SwiftDate.xcodeproj/xcshareddata/xcschemes/SwiftDate-iOS.xcscheme",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<Scheme\n   LastUpgradeVersion = \"1220\"\n   version = \"1.3\">\n   <BuildAction\n      parallelizeBuildables = \"YES\"\n      buildImplicitDependencies = \"YES\">\n      <BuildActionEntries>\n         <BuildActionEntry\n            buildForTesting = \"YES\"\n            buildForRunning = \"YES\"\n            buildForProfiling = \"YES\"\n            buildForArchiving = \"YES\"\n            buildForAnalyzing = \"YES\">\n            <BuildableReference\n               BuildableIdentifier = \"primary\"\n               BlueprintIdentifier = \"52D6D97B1BEFF229002C0205\"\n               BuildableName = \"SwiftDate.framework\"\n               BlueprintName = \"SwiftDate-iOS\"\n               ReferencedContainer = \"container:SwiftDate.xcodeproj\">\n            </BuildableReference>\n         </BuildActionEntry>\n      </BuildActionEntries>\n   </BuildAction>\n   <TestAction\n      buildConfiguration = \"Debug\"\n      selectedDebuggerIdentifier = \"Xcode.DebuggerFoundation.Debugger.LLDB\"\n      selectedLauncherIdentifier = \"Xcode.DebuggerFoundation.Launcher.LLDB\"\n      shouldUseLaunchSchemeArgsEnv = \"YES\"\n      codeCoverageEnabled = \"YES\">\n      <MacroExpansion>\n         <BuildableReference\n            BuildableIdentifier = \"primary\"\n            BlueprintIdentifier = \"52D6D97B1BEFF229002C0205\"\n            BuildableName = \"SwiftDate.framework\"\n            BlueprintName = \"SwiftDate-iOS\"\n            ReferencedContainer = \"container:SwiftDate.xcodeproj\">\n         </BuildableReference>\n      </MacroExpansion>\n      <Testables>\n         <TestableReference\n            skipped = \"NO\">\n            <BuildableReference\n               BuildableIdentifier = \"primary\"\n               BlueprintIdentifier = \"52D6D9851BEFF229002C0205\"\n               BuildableName = \"SwiftDate-iOS Tests.xctest\"\n               BlueprintName = \"SwiftDate-iOS Tests\"\n               ReferencedContainer = \"container:SwiftDate.xcodeproj\">\n            </BuildableReference>\n         </TestableReference>\n      </Testables>\n   </TestAction>\n   <LaunchAction\n      buildConfiguration = \"Debug\"\n      selectedDebuggerIdentifier = \"Xcode.DebuggerFoundation.Debugger.LLDB\"\n      selectedLauncherIdentifier = \"Xcode.DebuggerFoundation.Launcher.LLDB\"\n      launchStyle = \"0\"\n      useCustomWorkingDirectory = \"NO\"\n      ignoresPersistentStateOnLaunch = \"NO\"\n      debugDocumentVersioning = \"YES\"\n      debugServiceExtension = \"internal\"\n      allowLocationSimulation = \"YES\">\n      <MacroExpansion>\n         <BuildableReference\n            BuildableIdentifier = \"primary\"\n            BlueprintIdentifier = \"52D6D97B1BEFF229002C0205\"\n            BuildableName = \"SwiftDate.framework\"\n            BlueprintName = \"SwiftDate-iOS\"\n            ReferencedContainer = \"container:SwiftDate.xcodeproj\">\n         </BuildableReference>\n      </MacroExpansion>\n   </LaunchAction>\n   <ProfileAction\n      buildConfiguration = \"Release\"\n      shouldUseLaunchSchemeArgsEnv = \"YES\"\n      savedToolIdentifier = \"\"\n      useCustomWorkingDirectory = \"NO\"\n      debugDocumentVersioning = \"YES\">\n      <MacroExpansion>\n         <BuildableReference\n            BuildableIdentifier = \"primary\"\n            BlueprintIdentifier = \"52D6D97B1BEFF229002C0205\"\n            BuildableName = \"SwiftDate.framework\"\n            BlueprintName = \"SwiftDate-iOS\"\n            ReferencedContainer = \"container:SwiftDate.xcodeproj\">\n         </BuildableReference>\n      </MacroExpansion>\n   </ProfileAction>\n   <AnalyzeAction\n      buildConfiguration = \"Debug\">\n   </AnalyzeAction>\n   <ArchiveAction\n      buildConfiguration = \"Release\"\n      revealArchiveInOrganizer = \"YES\">\n   </ArchiveAction>\n</Scheme>\n"
  },
  {
    "path": "SwiftDate.xcodeproj/xcshareddata/xcschemes/SwiftDate-macOS.xcscheme",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<Scheme\n   LastUpgradeVersion = \"1220\"\n   version = \"1.3\">\n   <BuildAction\n      parallelizeBuildables = \"YES\"\n      buildImplicitDependencies = \"YES\">\n      <BuildActionEntries>\n         <BuildActionEntry\n            buildForTesting = \"YES\"\n            buildForRunning = \"YES\"\n            buildForProfiling = \"YES\"\n            buildForArchiving = \"YES\"\n            buildForAnalyzing = \"YES\">\n            <BuildableReference\n               BuildableIdentifier = \"primary\"\n               BlueprintIdentifier = \"52D6DA0E1BF000BD002C0205\"\n               BuildableName = \"SwiftDate.framework\"\n               BlueprintName = \"SwiftDate-macOS\"\n               ReferencedContainer = \"container:SwiftDate.xcodeproj\">\n            </BuildableReference>\n         </BuildActionEntry>\n      </BuildActionEntries>\n   </BuildAction>\n   <TestAction\n      buildConfiguration = \"Debug\"\n      selectedDebuggerIdentifier = \"Xcode.DebuggerFoundation.Debugger.LLDB\"\n      selectedLauncherIdentifier = \"Xcode.DebuggerFoundation.Launcher.LLDB\"\n      shouldUseLaunchSchemeArgsEnv = \"YES\"\n      codeCoverageEnabled = \"YES\">\n      <MacroExpansion>\n         <BuildableReference\n            BuildableIdentifier = \"primary\"\n            BlueprintIdentifier = \"52D6DA0E1BF000BD002C0205\"\n            BuildableName = \"SwiftDate.framework\"\n            BlueprintName = \"SwiftDate-macOS\"\n            ReferencedContainer = \"container:SwiftDate.xcodeproj\">\n         </BuildableReference>\n      </MacroExpansion>\n      <Testables>\n         <TestableReference\n            skipped = \"NO\">\n            <BuildableReference\n               BuildableIdentifier = \"primary\"\n               BlueprintIdentifier = \"DD7502791C68FCFC006590AF\"\n               BuildableName = \"SwiftDate-macOS Tests.xctest\"\n               BlueprintName = \"SwiftDate-macOS Tests\"\n               ReferencedContainer = \"container:SwiftDate.xcodeproj\">\n            </BuildableReference>\n         </TestableReference>\n      </Testables>\n   </TestAction>\n   <LaunchAction\n      buildConfiguration = \"Debug\"\n      selectedDebuggerIdentifier = \"Xcode.DebuggerFoundation.Debugger.LLDB\"\n      selectedLauncherIdentifier = \"Xcode.DebuggerFoundation.Launcher.LLDB\"\n      launchStyle = \"0\"\n      useCustomWorkingDirectory = \"NO\"\n      ignoresPersistentStateOnLaunch = \"NO\"\n      debugDocumentVersioning = \"YES\"\n      debugServiceExtension = \"internal\"\n      allowLocationSimulation = \"YES\">\n      <MacroExpansion>\n         <BuildableReference\n            BuildableIdentifier = \"primary\"\n            BlueprintIdentifier = \"52D6DA0E1BF000BD002C0205\"\n            BuildableName = \"SwiftDate.framework\"\n            BlueprintName = \"SwiftDate-macOS\"\n            ReferencedContainer = \"container:SwiftDate.xcodeproj\">\n         </BuildableReference>\n      </MacroExpansion>\n   </LaunchAction>\n   <ProfileAction\n      buildConfiguration = \"Release\"\n      shouldUseLaunchSchemeArgsEnv = \"YES\"\n      savedToolIdentifier = \"\"\n      useCustomWorkingDirectory = \"NO\"\n      debugDocumentVersioning = \"YES\">\n      <MacroExpansion>\n         <BuildableReference\n            BuildableIdentifier = \"primary\"\n            BlueprintIdentifier = \"52D6DA0E1BF000BD002C0205\"\n            BuildableName = \"SwiftDate.framework\"\n            BlueprintName = \"SwiftDate-macOS\"\n            ReferencedContainer = \"container:SwiftDate.xcodeproj\">\n         </BuildableReference>\n      </MacroExpansion>\n   </ProfileAction>\n   <AnalyzeAction\n      buildConfiguration = \"Debug\">\n   </AnalyzeAction>\n   <ArchiveAction\n      buildConfiguration = \"Release\"\n      revealArchiveInOrganizer = \"YES\">\n   </ArchiveAction>\n</Scheme>\n"
  },
  {
    "path": "SwiftDate.xcodeproj/xcshareddata/xcschemes/SwiftDate-tvOS.xcscheme",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<Scheme\n   LastUpgradeVersion = \"1220\"\n   version = \"1.3\">\n   <BuildAction\n      parallelizeBuildables = \"YES\"\n      buildImplicitDependencies = \"YES\">\n      <BuildActionEntries>\n         <BuildActionEntry\n            buildForTesting = \"YES\"\n            buildForRunning = \"YES\"\n            buildForProfiling = \"YES\"\n            buildForArchiving = \"YES\"\n            buildForAnalyzing = \"YES\">\n            <BuildableReference\n               BuildableIdentifier = \"primary\"\n               BlueprintIdentifier = \"52D6D9EF1BEFFFBE002C0205\"\n               BuildableName = \"SwiftDate.framework\"\n               BlueprintName = \"SwiftDate-tvOS\"\n               ReferencedContainer = \"container:SwiftDate.xcodeproj\">\n            </BuildableReference>\n         </BuildActionEntry>\n      </BuildActionEntries>\n   </BuildAction>\n   <TestAction\n      buildConfiguration = \"Debug\"\n      selectedDebuggerIdentifier = \"Xcode.DebuggerFoundation.Debugger.LLDB\"\n      selectedLauncherIdentifier = \"Xcode.DebuggerFoundation.Launcher.LLDB\"\n      shouldUseLaunchSchemeArgsEnv = \"YES\"\n      codeCoverageEnabled = \"YES\">\n      <MacroExpansion>\n         <BuildableReference\n            BuildableIdentifier = \"primary\"\n            BlueprintIdentifier = \"52D6D9EF1BEFFFBE002C0205\"\n            BuildableName = \"SwiftDate.framework\"\n            BlueprintName = \"SwiftDate-tvOS\"\n            ReferencedContainer = \"container:SwiftDate.xcodeproj\">\n         </BuildableReference>\n      </MacroExpansion>\n      <Testables>\n         <TestableReference\n            skipped = \"NO\">\n            <BuildableReference\n               BuildableIdentifier = \"primary\"\n               BlueprintIdentifier = \"DD75028C1C690C7A006590AF\"\n               BuildableName = \"SwiftDate-tvOS Tests.xctest\"\n               BlueprintName = \"SwiftDate-tvOS Tests\"\n               ReferencedContainer = \"container:SwiftDate.xcodeproj\">\n            </BuildableReference>\n         </TestableReference>\n      </Testables>\n   </TestAction>\n   <LaunchAction\n      buildConfiguration = \"Debug\"\n      selectedDebuggerIdentifier = \"Xcode.DebuggerFoundation.Debugger.LLDB\"\n      selectedLauncherIdentifier = \"Xcode.DebuggerFoundation.Launcher.LLDB\"\n      launchStyle = \"0\"\n      useCustomWorkingDirectory = \"NO\"\n      ignoresPersistentStateOnLaunch = \"NO\"\n      debugDocumentVersioning = \"YES\"\n      debugServiceExtension = \"internal\"\n      allowLocationSimulation = \"YES\">\n      <MacroExpansion>\n         <BuildableReference\n            BuildableIdentifier = \"primary\"\n            BlueprintIdentifier = \"52D6D9EF1BEFFFBE002C0205\"\n            BuildableName = \"SwiftDate.framework\"\n            BlueprintName = \"SwiftDate-tvOS\"\n            ReferencedContainer = \"container:SwiftDate.xcodeproj\">\n         </BuildableReference>\n      </MacroExpansion>\n   </LaunchAction>\n   <ProfileAction\n      buildConfiguration = \"Release\"\n      shouldUseLaunchSchemeArgsEnv = \"YES\"\n      savedToolIdentifier = \"\"\n      useCustomWorkingDirectory = \"NO\"\n      debugDocumentVersioning = \"YES\">\n      <MacroExpansion>\n         <BuildableReference\n            BuildableIdentifier = \"primary\"\n            BlueprintIdentifier = \"52D6D9EF1BEFFFBE002C0205\"\n            BuildableName = \"SwiftDate.framework\"\n            BlueprintName = \"SwiftDate-tvOS\"\n            ReferencedContainer = \"container:SwiftDate.xcodeproj\">\n         </BuildableReference>\n      </MacroExpansion>\n   </ProfileAction>\n   <AnalyzeAction\n      buildConfiguration = \"Debug\">\n   </AnalyzeAction>\n   <ArchiveAction\n      buildConfiguration = \"Release\"\n      revealArchiveInOrganizer = \"YES\">\n   </ArchiveAction>\n</Scheme>\n"
  },
  {
    "path": "SwiftDate.xcodeproj/xcshareddata/xcschemes/SwiftDate-watchOS.xcscheme",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<Scheme\n   LastUpgradeVersion = \"1220\"\n   version = \"1.3\">\n   <BuildAction\n      parallelizeBuildables = \"YES\"\n      buildImplicitDependencies = \"YES\">\n      <BuildActionEntries>\n         <BuildActionEntry\n            buildForTesting = \"YES\"\n            buildForRunning = \"YES\"\n            buildForProfiling = \"YES\"\n            buildForArchiving = \"YES\"\n            buildForAnalyzing = \"YES\">\n            <BuildableReference\n               BuildableIdentifier = \"primary\"\n               BlueprintIdentifier = \"52D6D9E11BEFFF6E002C0205\"\n               BuildableName = \"SwiftDate.framework\"\n               BlueprintName = \"SwiftDate-watchOS\"\n               ReferencedContainer = \"container:SwiftDate.xcodeproj\">\n            </BuildableReference>\n         </BuildActionEntry>\n      </BuildActionEntries>\n   </BuildAction>\n   <TestAction\n      buildConfiguration = \"Debug\"\n      selectedDebuggerIdentifier = \"Xcode.DebuggerFoundation.Debugger.LLDB\"\n      selectedLauncherIdentifier = \"Xcode.DebuggerFoundation.Launcher.LLDB\"\n      shouldUseLaunchSchemeArgsEnv = \"YES\"\n      codeCoverageEnabled = \"YES\">\n      <Testables>\n      </Testables>\n   </TestAction>\n   <LaunchAction\n      buildConfiguration = \"Debug\"\n      selectedDebuggerIdentifier = \"Xcode.DebuggerFoundation.Debugger.LLDB\"\n      selectedLauncherIdentifier = \"Xcode.DebuggerFoundation.Launcher.LLDB\"\n      launchStyle = \"0\"\n      useCustomWorkingDirectory = \"NO\"\n      ignoresPersistentStateOnLaunch = \"NO\"\n      debugDocumentVersioning = \"YES\"\n      debugServiceExtension = \"internal\"\n      allowLocationSimulation = \"YES\">\n      <MacroExpansion>\n         <BuildableReference\n            BuildableIdentifier = \"primary\"\n            BlueprintIdentifier = \"52D6D9E11BEFFF6E002C0205\"\n            BuildableName = \"SwiftDate.framework\"\n            BlueprintName = \"SwiftDate-watchOS\"\n            ReferencedContainer = \"container:SwiftDate.xcodeproj\">\n         </BuildableReference>\n      </MacroExpansion>\n   </LaunchAction>\n   <ProfileAction\n      buildConfiguration = \"Release\"\n      shouldUseLaunchSchemeArgsEnv = \"YES\"\n      savedToolIdentifier = \"\"\n      useCustomWorkingDirectory = \"NO\"\n      debugDocumentVersioning = \"YES\">\n      <MacroExpansion>\n         <BuildableReference\n            BuildableIdentifier = \"primary\"\n            BlueprintIdentifier = \"52D6D9E11BEFFF6E002C0205\"\n            BuildableName = \"SwiftDate.framework\"\n            BlueprintName = \"SwiftDate-watchOS\"\n            ReferencedContainer = \"container:SwiftDate.xcodeproj\">\n         </BuildableReference>\n      </MacroExpansion>\n   </ProfileAction>\n   <AnalyzeAction\n      buildConfiguration = \"Debug\">\n   </AnalyzeAction>\n   <ArchiveAction\n      buildConfiguration = \"Release\"\n      revealArchiveInOrganizer = \"YES\">\n   </ArchiveAction>\n</Scheme>\n"
  },
  {
    "path": "TestApplication/AppDelegate.swift",
    "content": "//\n//  AppDelegate.swift\n//  TestApplication\n//\n//  Created by Daniele Margutti on 06/06/2018.\n//  Copyright © 2018 SwiftDate. All rights reserved.\n//\n\nimport UIKit\n\n@UIApplicationMain\nclass AppDelegate: UIResponder, UIApplicationDelegate {\n\n\tvar window: UIWindow?\n\n\tfunc application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {\n\t\t// Override point for customization after application launch.\n\t\treturn true\n\t}\n\n\tfunc applicationWillResignActive(_ application: UIApplication) {\n\t\t// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.\n\t\t// Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game.\n\t}\n\n\tfunc applicationDidEnterBackground(_ application: UIApplication) {\n\t\t// Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.\n\t\t// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.\n\t}\n\n\tfunc applicationWillEnterForeground(_ application: UIApplication) {\n\t\t// Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background.\n\t}\n\n\tfunc applicationDidBecomeActive(_ application: UIApplication) {\n\t\t// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.\n\t}\n\n\tfunc applicationWillTerminate(_ application: UIApplication) {\n\t\t// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.\n\t}\n\n}\n"
  },
  {
    "path": "TestApplication/Assets.xcassets/AppIcon.appiconset/Contents.json",
    "content": "{\n  \"images\" : [\n    {\n      \"idiom\" : \"iphone\",\n      \"size\" : \"20x20\",\n      \"scale\" : \"2x\"\n    },\n    {\n      \"idiom\" : \"iphone\",\n      \"size\" : \"20x20\",\n      \"scale\" : \"3x\"\n    },\n    {\n      \"idiom\" : \"iphone\",\n      \"size\" : \"29x29\",\n      \"scale\" : \"2x\"\n    },\n    {\n      \"idiom\" : \"iphone\",\n      \"size\" : \"29x29\",\n      \"scale\" : \"3x\"\n    },\n    {\n      \"idiom\" : \"iphone\",\n      \"size\" : \"40x40\",\n      \"scale\" : \"2x\"\n    },\n    {\n      \"idiom\" : \"iphone\",\n      \"size\" : \"40x40\",\n      \"scale\" : \"3x\"\n    },\n    {\n      \"idiom\" : \"iphone\",\n      \"size\" : \"60x60\",\n      \"scale\" : \"2x\"\n    },\n    {\n      \"idiom\" : \"iphone\",\n      \"size\" : \"60x60\",\n      \"scale\" : \"3x\"\n    },\n    {\n      \"idiom\" : \"ipad\",\n      \"size\" : \"20x20\",\n      \"scale\" : \"1x\"\n    },\n    {\n      \"idiom\" : \"ipad\",\n      \"size\" : \"20x20\",\n      \"scale\" : \"2x\"\n    },\n    {\n      \"idiom\" : \"ipad\",\n      \"size\" : \"29x29\",\n      \"scale\" : \"1x\"\n    },\n    {\n      \"idiom\" : \"ipad\",\n      \"size\" : \"29x29\",\n      \"scale\" : \"2x\"\n    },\n    {\n      \"idiom\" : \"ipad\",\n      \"size\" : \"40x40\",\n      \"scale\" : \"1x\"\n    },\n    {\n      \"idiom\" : \"ipad\",\n      \"size\" : \"40x40\",\n      \"scale\" : \"2x\"\n    },\n    {\n      \"idiom\" : \"ipad\",\n      \"size\" : \"76x76\",\n      \"scale\" : \"1x\"\n    },\n    {\n      \"idiom\" : \"ipad\",\n      \"size\" : \"76x76\",\n      \"scale\" : \"2x\"\n    },\n    {\n      \"idiom\" : \"ipad\",\n      \"size\" : \"83.5x83.5\",\n      \"scale\" : \"2x\"\n    },\n    {\n      \"idiom\" : \"ios-marketing\",\n      \"size\" : \"1024x1024\",\n      \"scale\" : \"1x\"\n    }\n  ],\n  \"info\" : {\n    \"version\" : 1,\n    \"author\" : \"xcode\"\n  }\n}"
  },
  {
    "path": "TestApplication/Assets.xcassets/Contents.json",
    "content": "{\n  \"info\" : {\n    \"version\" : 1,\n    \"author\" : \"xcode\"\n  }\n}"
  },
  {
    "path": "TestApplication/Base.lproj/LaunchScreen.storyboard",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<document type=\"com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB\" version=\"3.0\" toolsVersion=\"14113\" targetRuntime=\"iOS.CocoaTouch\" propertyAccessControl=\"none\" useAutolayout=\"YES\" launchScreen=\"YES\" useTraitCollections=\"YES\" colorMatched=\"YES\" initialViewController=\"01J-lp-oVM\">\n    <device id=\"retina4_7\" orientation=\"portrait\">\n        <adaptation id=\"fullscreen\"/>\n    </device>\n    <dependencies>\n        <deployment identifier=\"iOS\"/>\n        <plugIn identifier=\"com.apple.InterfaceBuilder.IBCocoaTouchPlugin\" version=\"14088\"/>\n        <capability name=\"documents saved in the Xcode 8 format\" minToolsVersion=\"8.0\"/>\n    </dependencies>\n    <scenes>\n        <!--View Controller-->\n        <scene sceneID=\"EHf-IW-A2E\">\n            <objects>\n                <viewController id=\"01J-lp-oVM\" sceneMemberID=\"viewController\">\n                    <layoutGuides>\n                        <viewControllerLayoutGuide type=\"top\" id=\"RcK-zI-EFm\"/>\n                        <viewControllerLayoutGuide type=\"bottom\" id=\"9Nz-se-ZS5\"/>\n                    </layoutGuides>\n                    <view key=\"view\" contentMode=\"scaleToFill\" id=\"Ze5-6b-2t3\">\n                        <rect key=\"frame\" x=\"0.0\" y=\"0.0\" width=\"375\" height=\"667\"/>\n                        <autoresizingMask key=\"autoresizingMask\" widthSizable=\"YES\" heightSizable=\"YES\"/>\n                        <color key=\"backgroundColor\" red=\"1\" green=\"1\" blue=\"1\" alpha=\"1\" colorSpace=\"custom\" customColorSpace=\"sRGB\"/>\n                    </view>\n                </viewController>\n                <placeholder placeholderIdentifier=\"IBFirstResponder\" id=\"iYj-Kq-Ea1\" userLabel=\"First Responder\" sceneMemberID=\"firstResponder\"/>\n            </objects>\n            <point key=\"canvasLocation\" x=\"53\" y=\"375\"/>\n        </scene>\n    </scenes>\n</document>\n"
  },
  {
    "path": "TestApplication/Base.lproj/Main.storyboard",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<document type=\"com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB\" version=\"3.0\" toolsVersion=\"14113\" targetRuntime=\"iOS.CocoaTouch\" propertyAccessControl=\"none\" useAutolayout=\"YES\" useTraitCollections=\"YES\" colorMatched=\"YES\" initialViewController=\"BYZ-38-t0r\">\n    <device id=\"retina4_7\" orientation=\"portrait\">\n        <adaptation id=\"fullscreen\"/>\n    </device>\n    <dependencies>\n        <deployment identifier=\"iOS\"/>\n        <plugIn identifier=\"com.apple.InterfaceBuilder.IBCocoaTouchPlugin\" version=\"14088\"/>\n        <capability name=\"documents saved in the Xcode 8 format\" minToolsVersion=\"8.0\"/>\n    </dependencies>\n    <scenes>\n        <!--View Controller-->\n        <scene sceneID=\"tne-QT-ifu\">\n            <objects>\n                <viewController id=\"BYZ-38-t0r\" customClass=\"ViewController\" customModule=\"TestApplication\" customModuleProvider=\"target\" sceneMemberID=\"viewController\">\n                    <layoutGuides>\n                        <viewControllerLayoutGuide type=\"top\" id=\"70N-6l-NTK\"/>\n                        <viewControllerLayoutGuide type=\"bottom\" id=\"P3f-bd-hhK\"/>\n                    </layoutGuides>\n                    <view key=\"view\" contentMode=\"scaleToFill\" id=\"8bC-Xf-vdC\">\n                        <rect key=\"frame\" x=\"0.0\" y=\"0.0\" width=\"375\" height=\"667\"/>\n                        <autoresizingMask key=\"autoresizingMask\" widthSizable=\"YES\" heightSizable=\"YES\"/>\n                        <color key=\"backgroundColor\" red=\"1\" green=\"1\" blue=\"1\" alpha=\"1\" colorSpace=\"custom\" customColorSpace=\"sRGB\"/>\n                    </view>\n                </viewController>\n                <placeholder placeholderIdentifier=\"IBFirstResponder\" id=\"dkx-z0-nzr\" sceneMemberID=\"firstResponder\"/>\n            </objects>\n        </scene>\n    </scenes>\n</document>\n"
  },
  {
    "path": "TestApplication/Info.plist",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n<plist version=\"1.0\">\n<dict>\n\t<key>CFBundleDevelopmentRegion</key>\n\t<string>$(DEVELOPMENT_LANGUAGE)</string>\n\t<key>CFBundleExecutable</key>\n\t<string>$(EXECUTABLE_NAME)</string>\n\t<key>CFBundleIdentifier</key>\n\t<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>\n\t<key>CFBundleInfoDictionaryVersion</key>\n\t<string>6.0</string>\n\t<key>CFBundleName</key>\n\t<string>$(PRODUCT_NAME)</string>\n\t<key>CFBundlePackageType</key>\n\t<string>APPL</string>\n\t<key>CFBundleShortVersionString</key>\n\t<string>1.0</string>\n\t<key>CFBundleVersion</key>\n\t<string>1</string>\n\t<key>LSRequiresIPhoneOS</key>\n\t<true/>\n\t<key>UILaunchStoryboardName</key>\n\t<string>LaunchScreen</string>\n\t<key>UIMainStoryboardFile</key>\n\t<string>Main</string>\n\t<key>UIRequiredDeviceCapabilities</key>\n\t<array>\n\t\t<string>armv7</string>\n\t</array>\n\t<key>UISupportedInterfaceOrientations</key>\n\t<array>\n\t\t<string>UIInterfaceOrientationPortrait</string>\n\t\t<string>UIInterfaceOrientationLandscapeLeft</string>\n\t\t<string>UIInterfaceOrientationLandscapeRight</string>\n\t</array>\n\t<key>UISupportedInterfaceOrientations~ipad</key>\n\t<array>\n\t\t<string>UIInterfaceOrientationPortrait</string>\n\t\t<string>UIInterfaceOrientationPortraitUpsideDown</string>\n\t\t<string>UIInterfaceOrientationLandscapeLeft</string>\n\t\t<string>UIInterfaceOrientationLandscapeRight</string>\n\t</array>\n</dict>\n</plist>\n"
  },
  {
    "path": "TestApplication/ViewController.swift",
    "content": "//\n//  ViewController.swift\n//  TestApplication\n//\n//  Created by Daniele Margutti on 06/06/2018.\n//  Copyright © 2018 SwiftDate. All rights reserved.\n//\n\nimport UIKit\n\nclass ViewController: UIViewController {\n\n\toverride func viewDidLoad() {\n\t\tsuper.viewDidLoad()\n\t}\n\n\toverride func didReceiveMemoryWarning() {\n\t\tsuper.didReceiveMemoryWarning()\n\t}\n\n}\n"
  },
  {
    "path": "Tests/LinuxMain.swift",
    "content": "// Generated using Sourcery 0.15.0 — https://github.com/krzysztofzablocki/Sourcery\n// DO NOT EDIT\n\n@testable import SwiftDateTests\nimport XCTest\n\nextension TestDateInRegion {\n    static var allTests: [(String, (TestDateInRegion) -> () throws -> Void)] = [\n        (\"testDateInRegion_ParseWithLocale\", testDateInRegion_ParseWithLocale),\n        (\"testDateInRegion_InitWithDateAndRegion\", testDateInRegion_InitWithDateAndRegion),\n        (\"testDateInRegion_InitFromTimeInterval\", testDateInRegion_InitFromTimeInterval),\n        (\"testDateInRegion_InitFromComponents\", testDateInRegion_InitFromComponents),\n        (\"testDateInRegion_InitFromParams\", testDateInRegion_InitFromParams),\n        (\"testDateInRegion_PastAndFuture\", testDateInRegion_PastAndFuture),\n        (\"testDateInRegion_Description\", testDateInRegion_Description),\n        (\"testDateInRegion_DateComponents\", testDateInRegion_DateComponents),\n        (\"testDateInRegion_Hash\", testDateInRegion_Hash),\n        (\"testDateInRegion_InitComponentsCallback\", testDateInRegion_InitComponentsCallback),\n        (\"testDateInRegion_ExtractComponents\", testDateInRegion_ExtractComponents),\n        (\"testDateInRegion_InitStringAutoFormat\", testDateInRegion_InitStringAutoFormat)\n    ]\n}\n\nextension TestDateInRegion_Compare {\n    static var allTests: [(String, (TestDateInRegion_Compare) -> () throws -> Void)] = [\n        (\"testDateInRegion_compareCloseTo\", testDateInRegion_compareCloseTo),\n        (\"testDateInRegion_compare\", testDateInRegion_compare),\n        (\"testDateInRegion_compareGranularity\", testDateInRegion_compareGranularity),\n        (\"testDateInRegion_isBeforeDate\", testDateInRegion_isBeforeDate),\n        (\"testDateInRegion_isAfterDate\", testDateInRegion_isAfterDate),\n        (\"testDateInRegion_isInRange\", testDateInRegion_isInRange),\n        (\"testDateInRegion_earlierAndLaterDate\", testDateInRegion_earlierAndLaterDate),\n        (\"testDateInRegion_compareMath\", testDateInRegion_compareMath),\n        (\"testDateInRange_GranuralityTest\", testDateInRange_GranuralityTest)\n    ]\n}\n\nextension TestDateInRegion_Components {\n    static var allTests: [(String, (TestDateInRegion_Components) -> () throws -> Void)] = [\n        (\"testDateInRegion_Components\", testDateInRegion_Components),\n        (\"testDateInRegion_isLeapMonth\", testDateInRegion_isLeapMonth),\n        (\"testDateInRegion_dateBySet\", testDateInRegion_dateBySet),\n        (\"testDateInRegion_isLeapYear\", testDateInRegion_isLeapYear),\n        (\"testDateInRegion_julianDayAndModifiedJulianDay\", testDateInRegion_julianDayAndModifiedJulianDay),\n        (\"test_ordinalDay\", test_ordinalDay),\n        (\"testDateInRegion_ISOFormatterAlt\", testDateInRegion_ISOFormatterAlt),\n        (\"testDateInRegion_getIntervalForComponentBetweenDates\", testDateInRegion_getIntervalForComponentBetweenDates),\n        (\"testDateInRegion_timeIntervalSince\", testDateInRegion_timeIntervalSince),\n        (\"testQuarter\", testQuarter),\n        (\"testAbsoluteDateISOFormatting\", testAbsoluteDateISOFormatting)\n    ]\n}\n\nextension TestDateInRegion_Create {\n    static var allTests: [(String, (TestDateInRegion_Create) -> () throws -> Void)] = [\n        (\"testDateInRegion_DateBySetTime\", testDateInRegion_DateBySetTime),\n        (\"testDateInRegion_DateBySet\", testDateInRegion_DateBySet),\n        (\"testDateInRegion_RandomDatesInRange\", testDateInRegion_RandomDatesInRange),\n        (\"testDateInRegion_RandomDatesBackToDays\", testDateInRegion_RandomDatesBackToDays),\n        (\"testDateInRegion_EnumareDates\", testDateInRegion_EnumareDates),\n        (\"testDateInRegion_oldestAndNewestAndSortsIn\", testDateInRegion_oldestAndNewestAndSortsIn)\n    ]\n}\n\nextension TestDateInRegion_Langs {\n    static var allTests: [(String, (TestDateInRegion_Langs) -> () throws -> Void)] = [\n        (\"testLanguages\", testLanguages)\n    ]\n}\n\nextension TestDateInRegion_Math {\n    static var allTests: [(String, (TestDateInRegion_Math) -> () throws -> Void)] = [\n        (\"testDateInRegion_DateTruncated\", testDateInRegion_DateTruncated),\n        (\"testDateInRegion_Rounding\", testDateInRegion_Rounding),\n        (\"testDateInRegion_MathOperations\", testDateInRegion_MathOperations)\n    ]\n}\n\nextension TestFormatters {\n    static var allTests: [(String, (TestFormatters) -> () throws -> Void)] = [\n        (\"testDotNETFormatter\", testDotNETFormatter),\n        (\"testRSSFormatter\", testRSSFormatter),\n        (\"testRSSAltFormatter\", testRSSAltFormatter),\n        (\"testSQLFormatter\", testSQLFormatter),\n        (\"testISOFormatter\", testISOFormatter),\n        (\"testTZInISOParser\", testTZInISOParser),\n        (\"testRSSAltLocale\", testRSSAltLocale),\n        (\"testTimeInterval_Clock\", testTimeInterval_Clock),\n        (\"testFormatterCustom\", testFormatterCustom),\n        (\"testTimeInterval_FormatterUnits\", testTimeInterval_FormatterUnits),\n        (\"testTimeInterval_Formatter\", testTimeInterval_Formatter),\n        (\"testColloquialFormatter\", testColloquialFormatter),\n        (\"testISOParser\", testISOParser)\n    ]\n}\n\nextension TestRegion {\n    static var allTests: [(String, (TestRegion) -> () throws -> Void)] = [\n        (\"testRegionInit\", testRegionInit)\n    ]\n}\n\nextension TestSwiftDate {\n    static var allTests: [(String, (TestSwiftDate) -> () throws -> Void)] = [\n        (\"testAutoFormats\", testAutoFormats)\n    ]\n}\n\nXCTMain([\n    testCase(TestDateInRegion.allTests),\n    testCase(TestDateInRegion_Compare.allTests),\n    testCase(TestDateInRegion_Components.allTests),\n    testCase(TestDateInRegion_Create.allTests),\n    testCase(TestDateInRegion_Langs.allTests),\n    testCase(TestDateInRegion_Math.allTests),\n    testCase(TestFormatters.allTests),\n    testCase(TestRegion.allTests),\n    testCase(TestSwiftDate.allTests)\n])\n"
  },
  {
    "path": "Tests/SwiftDateTests/TestDataStructures.swift",
    "content": "//\n//  SwiftDate\n//  Parse, validate, manipulate, and display dates, time and timezones in Swift\n//\n//  Created by Daniele Margutti\n//   - Web: https://www.danielemargutti.com\n//   - Twitter: https://twitter.com/danielemargutti\n//   - Mail: hello@danielemargutti.com\n//\n//  Copyright © 2019 Daniele Margutti. Licensed under MIT License.\n//\n\nimport SwiftDate\nimport XCTest\n\nclass TestDataStructures: XCTestCase {\n\n\tfunc test_Weekday() {\n\t\t// Circular operations\n\t\tXCTAssert(WeekDay.monday.subtract(days: 2) == .saturday, \"Failed to use circular operation for weekday\")\n\t\tXCTAssert(WeekDay.friday.add(days: 4) == .tuesday, \"Failed to use circular operation for weekday\")\n\t\tXCTAssert(WeekDay.monday.add(days: 0) == .monday, \"Failed to use circular operation for weekday\")\n\t\tXCTAssert(WeekDay.friday.subtract(days: 0) == .friday, \"Failed to use circular operation for weekday\")\n\t\tXCTAssert(WeekDay.friday.add(days: -1) == .thursday, \"Failed to use circular operation for weekday\")\n\t\tXCTAssert(WeekDay.friday.subtract(days: -1) == .saturday, \"Failed to use circular operation for weekday\")\n\n\t\t// Locale display name\n\t\tXCTAssert(WeekDay.monday.name(locale: Locales.italian).lowercased() == \"lunedì\", \"Failed to get the weekday display name in locale\")\n\t\tXCTAssert(WeekDay.sunday.name(locale: Locales.english).lowercased() == \"sunday\", \"Failed to get the weekday display name in locale\")\n\t\tXCTAssert(WeekDay.monday.name(locale: Locales.ukrainian).lowercased() == \"понеділок\", \"Failed to get the month display name in locale\")\n\t}\n\n\tfunc test_Month() {\n\t\t// Circular operations\n\t\tXCTAssert(Month.january.subtract(months: 2) == .november, \"Failed to use circular operation for month\")\n\t\tXCTAssert(Month.september.add(months: 5) == .february, \"Failed to use circular operation for month\")\n\t\tXCTAssert(Month.september.add(months: 0) == .september, \"Failed to use circular operation for month\")\n\t\tXCTAssert(Month.december.subtract(months: 0) == .december, \"Failed to use circular operation for month\")\n\t\tXCTAssert(Month.december.add(months: -1) == .november, \"Failed to use circular operation for month\")\n\t\tXCTAssert(Month.may.subtract(months: -1) == .june, \"Failed to use circular operation for month\")\n\n\t\t// Locale display name\n\t\tXCTAssert(Month.january.name(locale: Locales.italian).lowercased() == \"gennaio\", \"Failed to get the month display name in locale\")\n\t\tXCTAssert(Month.may.name(locale: Locales.english).lowercased() == \"may\", \"Failed to get the month display name in locale\")\n\t\tXCTAssert(Month.may.name(locale: Locales.french).lowercased() == \"mai\", \"Failed to get the month display name in locale\")\n\n\t\t// Number of days in month\n\t\tXCTAssert(Month.february.numberOfDays(year: 2016) == 29, \"Failed to get a leap year\")\n\t\tXCTAssert(Month.january.numberOfDays(year: 2017) == 31, \"Failed to get a leap year\")\n\t\tXCTAssert(Month.february.numberOfDays(year: 1924) == 29, \"Failed to get a leap year\")\n\t}\n\n\tfunc test_Year() {\n\t\tXCTAssert(Year(2016).isLeap() == true, \"Failed to get a leap year\")\n\t\tXCTAssert(Year(2020).isLeap() == true, \"Failed to get a leap year\")\n\t\tXCTAssert(Year(2024).isLeap() == true, \"Failed to get a leap year\")\n\t\tXCTAssert(Year(2028).isLeap() == true, \"Failed to get a leap year\")\n\t\tXCTAssert(Year(2096).isLeap() == true, \"Failed to get a leap year\")\n\t\tXCTAssert(Year(1924).isLeap() == true, \"Failed to get a leap year\")\n\t\tXCTAssert(Year(2067).isLeap() == false, \"Failed to get a non leap year\")\n\n\t\tXCTAssert(Year(1924).numberOfDays() == 366, \"Failed to get the correct number of day in a year\")\n\t\tXCTAssert(Year(1944).numberOfDays() == 366, \"Failed to get the correct number of day in a year\")\n\t\tXCTAssert(Year(2067).numberOfDays() == 365, \"Failed to get the correct number of day in a year\")\n\t}\n\n}\n"
  },
  {
    "path": "Tests/SwiftDateTests/TestDate.swift",
    "content": "//\n//  TestDate.swift\n//  SwiftDate-macOS Tests\n//\n//  Created by Imthath M on 30/05/19.\n//  Copyright © 2019 SwiftDate. All rights reserved.\n//\n\nimport SwiftDate\nimport XCTest\n\nclass TestDate: XCTestCase {\n\n\toverride func setUp() {\n\t\t// Put setup code here. This method is called before the invocation of each test method in the class.\n\t}\n\n\toverride func tearDown() {\n\t\t// Put teardown code here. This method is called after the invocation of each test method in the class.\n\t}\n\n\tfunc testDifferencesBetweenDates() {\n\t\tlet date = Date()\n\t\tlet date2 = \"2019-01-05\".toDate()!.date\n\t\tlet result = date.differences(in: [.hour, .day, .month], from: date2)\n\t\tprint(result)\n\t}\n\n  func testDifferenceBetweenDates() {\n    let date = Date()\n    let date2 = \"2019-01-05\".toDate()!.date\n    let result = date.difference(in: .day, from: date2)\n    print(result!)\n  }\n\n\tfunc testPositionInRange() {\n\t\tlet regionRome = Region(calendar: Calendars.gregorian, zone: Zones.europeRome, locale: Locales.italian)\n\t\tlet regionLondon = Region(calendar: Calendars.gregorian, zone: Zones.europeLondon, locale: Locales.english)\n\t\tlet dateFormat = \"yyyy-MM-dd HH:mm:ss\"\n\n\t\tlet lowerBound = \"2018-05-31 23:00:00\".toDate(dateFormat, region: regionRome)!.date\n\t\tlet upperBound = \"2018-06-01 01:00:00\".toDate(dateFormat, region: regionRome)!.date\n\n\t\tlet testDate1 = \"2018-06-01 00:30:00\".toDate(dateFormat, region: regionRome)!.date\n\t\tXCTAssertEqual( testDate1.positionInRange(date: lowerBound, and: upperBound), 0.75)\n\n\t\tlet testDate2 = \"2018-05-31 22:30:00\".toDate(dateFormat, region: regionLondon)!.date\n\t\tXCTAssertEqual( testDate2.positionInRange(date: lowerBound, and: upperBound), 0.25)\n\n\t\tlet testDate3 = \"2018-05-31 21:00:00\".toDate(dateFormat, region: regionLondon)!.date\n\t\tXCTAssertNil( testDate3.positionInRange(date: lowerBound, and: upperBound))\n\n\t\tlet testDate4 = \"2018-06-01 03:00:00\".toDate(dateFormat, region: regionLondon)!.date\n\t\tXCTAssertNil( testDate4.positionInRange(date: lowerBound, and: upperBound))\n\t}\n\n}\n"
  },
  {
    "path": "Tests/SwiftDateTests/TestDateInRegion+Compare.swift",
    "content": "//\n//  SwiftDate\n//  Parse, validate, manipulate, and display dates, time and timezones in Swift\n//\n//  Created by Daniele Margutti\n//   - Web: https://www.danielemargutti.com\n//   - Twitter: https://twitter.com/danielemargutti\n//   - Mail: hello@danielemargutti.com\n//\n//  Copyright © 2019 Daniele Margutti. Licensed under MIT License.\n//\n\nimport SwiftDate\nimport XCTest\n\nclass TestDateInRegion_Compare: XCTestCase {\n\n\tfunc testDateInRegion_compareCloseTo() {\n\t\tlet regionRome = Region(calendar: Calendars.gregorian, zone: Zones.europeRome, locale: Locales.italian)\n\t\tlet dateFormat = \"yyyy-MM-dd HH:mm:ss\"\n\n\t\tlet refDate = DateInRegion(\"2015-01-01 00:00:00\", format: dateFormat, region: regionRome)!\n\t\tlet dateA = DateInRegion(\"2015-01-01 01:00:00\", format: dateFormat, region: regionRome)!\n\t\tlet dateB = DateInRegion(\"2014-12-31 22:30:00\", format: dateFormat, region: regionRome)!\n\t\tlet dateC = DateInRegion(\"2015-01-01 04:00:00\", format: dateFormat, region: regionRome)!\n\n\t\tlet failMsg = \"Failed to evaluate if date is close to another with given interval\"\n\t\tXCTAssert( (dateA.compareCloseTo(refDate, precision: 1.hours.timeInterval) == true), failMsg)\n\t\tXCTAssert( (dateB.compareCloseTo(refDate, precision: 1.hours.timeInterval) == false), failMsg)\n\t\tXCTAssert( (dateC.compareCloseTo(refDate, precision: 3.hours.timeInterval) == false), failMsg)\n\t\tXCTAssert( (dateC.compareCloseTo(refDate, precision: 5.hours.timeInterval) == true), failMsg)\n\t}\n\n\tfunc testDateInRegion_compare() {\n\n\t\t// isToday\n\t\tXCTAssert( DateInRegion().compare(.isToday), \"Failed to evaluate isToday\")\n\t\tXCTAssert( ((DateInRegion() - 2.days).compare(.isToday) == false), \"Failed to evaluate isToday == false\")\n\n\t\t// isTomorrow\n\t\tXCTAssert( (DateInRegion() + 1.days + 5.minutes).compare(.isTomorrow), \"Failed to evaluate isTomorrow\")\n\t\tXCTAssert( (DateInRegion().dateAt(.endOfDay).compare(.isTomorrow) == false), \"Failed to evaluate isTomorrow\")\n\n\t\t// isYesterday\n\t\tXCTAssert( (DateInRegion().dateAt(.startOfDay) - 1.days).compare(.isYesterday), \"Failed to evaluate isYesterday\")\n\t\tXCTAssert( ((DateInRegion().dateAt(.startOfDay)).compare(.isYesterday) == false), \"Failed to evaluate isYesterday == false\")\n\n\t\t// isThisWeek\n\t\tXCTAssert( DateInRegion().compare(.isThisWeek), \"Failed to evaluate isThisWeek\")\n\t\tXCTAssert( DateInRegion().dateAt(.startOfWeek).compare(.isThisWeek), \"Failed to evaluate isThisWeek\")\n\n\t\t// isNextWeek\n\t\tXCTAssert( (DateInRegion() + 7.days).compare(.isNextWeek), \"Failed to evaluate isNextWeek\")\n\t\tXCTAssert( (DateInRegion().dateAt(.endOfWeek) + 1.days).compare(.isNextWeek), \"Failed to evaluate isNextWeek\")\n\n\t\t// isLastWeek\n\t\tXCTAssert( (DateInRegion() - 7.days).compare(.isLastWeek), \"Failed to evaluate isLastWeek\")\n\t\tXCTAssert( (DateInRegion().dateAt(.startOfWeek) - 1.days).compare(.isLastWeek), \"Failed to evaluate isLastWeek\")\n\n\t\t// isSameWeek\n\t\tlet regionRome = Region(calendar: Calendars.gregorian, zone: Zones.europeRome, locale: Locales.italian)\n\t\tlet dateFormat = \"yyyy-MM-dd HH:mm:ss\"\n\t\tlet dateA = DateInRegion(\"2018-06-19 01:00:00\", format: dateFormat, region: regionRome)!\n\t\tlet dateB = DateInRegion(\"2018-06-23 22:30:00\", format: dateFormat, region: regionRome)!\n\t\tlet dateC = DateInRegion(\"2018-06-17 23:59:00\", format: dateFormat, region: regionRome)!\n\n\t\tXCTAssert( dateA.compare(.isSameWeek(dateB)), \"Failed to evaluate isSameWeek\")\n\t\tXCTAssert( dateA.compare(.isSameWeek(dateC)) == false, \"Failed to evaluate isSameWeek == false\")\n\n\t\t// isThisMonth\n\t\tXCTAssert( (DateInRegion().dateAt(.startOfMonth) + 6.days).compare(.isThisMonth), \"Failed to evaluate isThisMonth\")\n\t\tXCTAssert( DateInRegion().compare(.isThisMonth), \"Failed to evaluate isThisMonth\")\n\t\tXCTAssert( (DateInRegion().dateAt(.startOfMonth) - 1.days).compare(.isThisMonth) == false, \"Failed to evaluate isThisMonth == false\")\n\n\t\t// isNextMonth\n\t\tXCTAssert( (DateInRegion().dateAt(.startOfMonth) - 1.days).compare(.isNextMonth) == false, \"Failed to evaluate isNextMonth == false\")\n\t\tXCTAssert( (DateInRegion().dateAt(.endOfMonth) + 5.days).compare(.isNextMonth), \"Failed to evaluate isNextMonth\")\n\t\tXCTAssert( DateInRegion().compare(.isNextMonth) == false, \"Failed to evaluate isNextMonth == false\")\n\n\t\t// isLastMonth\n\t\tXCTAssert( (DateInRegion().dateAt(.startOfMonth) - 1.days).compare(.isLastMonth), \"Failed to evaluate isLastMonth\")\n\t\tXCTAssert( (DateInRegion().dateAt(.endOfMonth) + 5.days).compare(.isLastMonth) == false, \"Failed to evaluate isLastMonth == false\")\n\t\tXCTAssert( DateInRegion().compare(.isLastMonth) == false, \"Failed to evaluate isLastMonth == false\")\n\n\t\t// isSameMonth\n\t\tlet dateA1 = DateInRegion(\"2018-06-19 01:00:00\", format: dateFormat, region: regionRome)!\n\t\tlet dateB1 = DateInRegion(\"2018-06-23 22:30:00\", format: dateFormat, region: regionRome)!\n\t\tlet dateC1 = DateInRegion(\"2018-07-01 00:00:00\", format: dateFormat, region: regionRome)!\n\t\tXCTAssert( dateA1.compare(.isSameMonth(dateB1)), \"Failed to evaluate isSameMonth\")\n\t\tXCTAssert( dateB1.compare(.isSameMonth(dateC1)) == false, \"Failed to evaluate isSameMonth == false\")\n\n\t\t// prevWeek/nextWeek\n\t\tXCTAssert( dateA1.dateAt(.prevWeek).toISO() == \"2018-06-11T00:00:00+02:00\", \"Failed to evaluate prevWeek\")\n\t\tXCTAssert( dateA1.dateAt(.nextWeek).toISO() == \"2018-06-25T00:00:00+02:00\", \"Failed to evaluate prevWeek\")\n\n\t\t// isThisYear\n\t\tXCTAssert( DateInRegion().compare(.isThisYear), \"Failed to evaluate isThisYear\")\n\t\tXCTAssert( (DateInRegion() + 1.years).compare(.isThisYear) == false, \"Failed to evaluate isThisYear == false\")\n\t\tXCTAssert( (DateInRegion() - 1.years).compare(.isThisYear) == false, \"Failed to evaluate isThisYear == false\")\n\n\t\t// isSameYear\n\t\tlet dateA2 = DateInRegion(\"2018-01-01 00:00:00\", format: dateFormat, region: regionRome)!\n\t\tlet dateB2 = DateInRegion(\"2017-12-31 23:59:59\", format: dateFormat, region: regionRome)!\n\t\tlet dateC2 = DateInRegion(\"2018-12-31 23:59:59\", format: dateFormat, region: regionRome)!\n\t\tXCTAssert( dateA2.compare(.isSameYear(dateB2)) == false, \"Failed to evaluate isSameYear == false\")\n\t\tXCTAssert( dateA2.compare(.isSameYear(dateC2)), \"Failed to evaluate isSameYear\")\n\t\tXCTAssert( dateB2.compare(.isSameYear(dateC2)) == false, \"Failed to evaluate isSameYear == false\")\n\n\t\t// isInTheFuture\n\t\tXCTAssert( (DateInRegion() + 1.seconds).compare(.isInTheFuture), \"Failed to evaluate isInTheFuture\")\n\t\tXCTAssert( (DateInRegion() - 1.seconds).compare(.isInTheFuture) == false, \"Failed to evaluate isInTheFuture == false\")\n\t\tXCTAssert( (DateInRegion() + 1.years).compare(.isInTheFuture), \"Failed to evaluate isInTheFuture\")\n\n\t\t// isInThePast\n\t\tXCTAssert( (DateInRegion() - 1.seconds).compare(.isInThePast), \"Failed to evaluate isInThePast\")\n\t\tXCTAssert( (DateInRegion() + 1.seconds).compare(.isInThePast) == false, \"Failed to evaluate isInThePast == false\")\n\t\tXCTAssert( (DateInRegion() - 1.years).compare(.isInThePast), \"Failed to evaluate isInThePast\")\n\n\t\t// isEarlier\n\t\tlet dateA3 = DateInRegion(\"2018-01-01 00:00:00\", format: dateFormat, region: regionRome)!\n\t\tlet dateB3 = DateInRegion(\"2017-12-31 23:59:59\", format: dateFormat, region: regionRome)!\n\t\tXCTAssert( dateA3.compare(.isEarlier(than: dateB3)) == false, \"Failed to evaluate isEarlier == false\")\n\t\tXCTAssert( dateB3.compare(.isEarlier(than: dateA3)), \"Failed to evaluate isEarlier\")\n\n\t\t// isLater\n\t\tXCTAssert( dateA3.compare(.isLater(than: dateB3)), \"Failed to evaluate isLater\")\n\t\tXCTAssert( dateB3.compare(.isLater(than: dateA3)) == false, \"Failed to evaluate isLater == false\")\n\n\t\t// isWeekday\n\t\tXCTAssert( DateInRegion().dateAt(.endOfWeek).compare(.isWeekday) == false, \"Failed to evaluate isWeekday == false\")\n\t\tXCTAssert( (DateInRegion().dateAt(.startOfWeek) + 1.days).compare(.isWeekday), \"Failed to evaluate isWeekday\")\n\n\t\t// isWeekend\n\t\tXCTAssert( DateInRegion().dateAt(.endOfWeek).compare(.isWeekend), \"Failed to evaluate isWeekend\")\n\t\tXCTAssert( (DateInRegion().dateAt(.startOfWeek) + 1.days).compare(.isWeekend) == false, \"Failed to evaluate isWeekend == false\")\n\n\t\t// isInDST\n\t\t// Region rome:\n\t\t// \t25 Mar 2018 - Daylight Saving Time Started\n\t\t// \t28 Oct 2018 - Daylight Saving Time Ends\n\t\tXCTAssert( DateInRegion().dateAt(.endOfWeek).compare(.isWeekend), \"Failed to evaluate isWeekend\")\n\t\tlet dateA4 = DateInRegion(\"2018-03-26 00:00:00\", format: dateFormat, region: regionRome)!\n\t\tlet dateB4 = DateInRegion(\"2018-06-01 00:00:00\", format: dateFormat, region: regionRome)!\n\n\t\tlet dateC4 = DateInRegion(\"2018-10-29 00:00:00\", format: dateFormat, region: regionRome)!\n\t\tlet dateD4 = DateInRegion(\"2018-12-01 00:00:00\", format: dateFormat, region: regionRome)!\n\n\t\tXCTAssert( dateA4.compare(.isInDST), \"Failed to evaluate isInDST\")\n\t\tXCTAssert( dateB4.compare(.isInDST), \"Failed to evaluate isInDST\")\n\n\t\tXCTAssert( dateC4.compare(.isInDST) == false, \"Failed to evaluate isInDST == false\")\n\t\tXCTAssert( dateD4.compare(.isInDST) == false, \"Failed to evaluate isInDST == false\")\n\n\t\t// isMorning\n\t\tlet dateA5 = DateInRegion(\"2018-03-26 05:00:00\", format: dateFormat, region: regionRome)!\n\t\tlet dateA6 = DateInRegion(\"2018-03-26 10:00:00\", format: dateFormat, region: regionRome)!\n\t\tlet dateA7 = DateInRegion(\"2018-03-26 11:59:00\", format: dateFormat, region: regionRome)!\n\t\tlet dateA8 = DateInRegion(\"2018-03-26 13:59:00\", format: dateFormat, region: regionRome)!\n\t\tlet dateA9 = DateInRegion(\"2018-03-26 17:59:00\", format: dateFormat, region: regionRome)!\n\t\tlet dateA10 = DateInRegion(\"2018-03-26 23:00:00\", format: dateFormat, region: regionRome)!\n\t\tlet dateA11 = DateInRegion(\"2018-03-26 04:00:00\", format: dateFormat, region: regionRome)!\n\t\tXCTAssert( dateA5.compare(.isMorning), \"Failed to evaluate isMorning\")\n\t\tXCTAssert( dateA6.compare(.isMorning), \"Failed to evaluate isMorning\")\n\t\tXCTAssert( dateA7.compare(.isMorning), \"Failed to evaluate isMorning\")\n\t\tXCTAssert( dateA8.compare(.isMorning) == false, \"Failed to evaluate isMorning == false\")\n\n\t\t// isAfternoon\n\t\tXCTAssert( dateA5.compare(.isAfternoon) == false, \"Failed to evaluate isAfternoon == false\")\n\t\tXCTAssert( dateA8.compare(.isAfternoon), \"Failed to evaluate isAfternoon\")\n\t\tXCTAssert( dateA9.compare(.isAfternoon) == false, \"Failed to evaluate isAfternoon == false\")\n\n\t\t// isEvening\n\t\tXCTAssert( dateA9.compare(.isEvening), \"Failed to evaluate isEvening\")\n\t\tXCTAssert( dateA10.compare(.isEvening) == false, \"Failed to evaluate isEvening == false\")\n\n\t\t// isNight\n\t\tXCTAssert( dateA5.compare(.isNight) == false, \"Failed to evaluate isNight == false\")\n\t\tXCTAssert( dateA11.compare(.isNight), \"Failed to evaluate isNight\")\n\t\tXCTAssert( dateA10.compare(.isNight), \"Failed to evaluate isNight\")\n\n\t}\n\n\tfunc testDateInRegion_compareGranularity() {\n\t\tlet regionRome = Region(calendar: Calendars.gregorian, zone: Zones.europeRome, locale: Locales.italian)\n\t\tlet dateFormat = \"yyyy-MM-dd HH:mm:ss\"\n\n\t\tlet date1 = DateInRegion(\"2018-06-19 01:00:00\", format: dateFormat, region: regionRome)!\n\t\tlet date2 = DateInRegion(\"2018-06-19 20:00:00\", format: dateFormat, region: regionRome)!\n\t\tlet date3 = DateInRegion(\"2018-06-21 20:00:00\", format: dateFormat, region: regionRome)!\n\n\t\t// Same day/month/year granularity\n\t\tXCTAssert( date1.compare(toDate: date2, granularity: .day) == .orderedSame, \"Failed to compare with .day granularity\")\n\t\tXCTAssert( date1.compare(toDate: date2, granularity: .month) == .orderedSame, \"Failed to compare with .month granularity\")\n\t\tXCTAssert( date1.compare(toDate: date2, granularity: .year) == .orderedSame, \"Failed to compare with .year granularity\")\n\n\t\t// Different day\n\t\tXCTAssert( date2.compare(toDate: date3, granularity: .day) == .orderedAscending, \"Failed to compare with .day granularity\")\n\t\tXCTAssert( date2.compare(toDate: date3, granularity: .month) == .orderedSame, \"Failed to compare with .month granularity\")\n\t\tXCTAssert( date2.compare(toDate: date3, granularity: .hour) == .orderedAscending, \"Failed to compare with .hour granularity\")\n\t}\n\n\tfunc testDateInRegion_isBeforeDate() {\n\t\tlet regionRome = Region(calendar: Calendars.gregorian, zone: Zones.europeRome, locale: Locales.italian)\n\t\tlet regionLondon = Region(calendar: Calendars.gregorian, zone: Zones.europeLondon, locale: Locales.english)\n\t\tlet dateFormat = \"yyyy-MM-dd HH:mm:ss\"\n\n\t\tlet date1 = DateInRegion(\"2018-06-19 01:00:00\", format: dateFormat, region: regionRome)!\n\t\tlet date2 = DateInRegion(\"2018-06-19 01:00:00\", format: dateFormat, region: regionLondon)!\n\t\tlet date3 = DateInRegion(\"2018-06-21 01:10:00\", format: dateFormat, region: regionRome)!\n\n\t\tXCTAssert( date1.isBeforeDate(date2, granularity: .hour), \"Failed to isBeforeDate() - .hour\")\n\t\tXCTAssert( date1.isBeforeDate(date3, granularity: .hour), \"Failed to isBeforeDate() - .hour\")\n\t\tXCTAssert( date1.isBeforeDate(date2, granularity: .day) == false, \"Failed to isBeforeDate() - .day == false\")\n\t}\n\n\tfunc testDateInRegion_isAfterDate() {\n\t\tlet regionRome = Region(calendar: Calendars.gregorian, zone: Zones.europeRome, locale: Locales.italian)\n\t\tlet regionLondon = Region(calendar: Calendars.gregorian, zone: Zones.europeLondon, locale: Locales.english)\n\t\tlet dateFormat = \"yyyy-MM-dd HH:mm:ss\"\n\n\t\tlet date1 = DateInRegion(\"2018-06-19 01:00:00\", format: dateFormat, region: regionRome)!\n\t\tlet date2 = DateInRegion(\"2018-06-19 01:00:00\", format: dateFormat, region: regionLondon)!\n\t\tlet date3 = DateInRegion(\"2018-06-21 01:10:00\", format: dateFormat, region: regionRome)!\n\t\tlet date4 = DateInRegion(\"2018-06-30 00:00:00\", format: dateFormat, region: regionRome)!\n\t\tlet date5 = DateInRegion(\"2018-06-30 00:00:00\", format: dateFormat, region: regionLondon)!\n\n\t\tXCTAssert( date3.isAfterDate(date1, granularity: .day), \"Failed to isAfterDate() - .day\")\n\t\tXCTAssert( date1.isAfterDate(date3, granularity: .month) == false, \"Failed to isAfterDate() - .month == false\")\n\t\tXCTAssert( date4.isAfterDate(date5, granularity: .month) == false, \"Failed to isAfterDate() - .day == false\")\n\t\tXCTAssert( date2.isAfterDate(date1, granularity: .year) == false, \"Failed to isAfterDate() - .year == false\")\n\t}\n\n\tfunc testDateInRegion_positionInRange() {\n\t\tlet regionRome = Region(calendar: Calendars.gregorian, zone: Zones.europeRome, locale: Locales.italian)\n\t\tlet regionLondon = Region(calendar: Calendars.gregorian, zone: Zones.europeLondon, locale: Locales.english)\n\t\tlet dateFormat = \"yyyy-MM-dd HH:mm:ss\"\n\n\t\tlet lowerBound = DateInRegion(\"2018-05-31 23:00:00\", format: dateFormat, region: regionRome)!\n\t\tlet upperBound = DateInRegion(\"2018-06-01 01:00:00\", format: dateFormat, region: regionRome)!\n\n\t\tlet testDate1 = DateInRegion(\"2018-06-01 00:30:00\", format: dateFormat, region: regionRome)!\n\t\tXCTAssertEqual( testDate1.positionInRange(date: lowerBound, and: upperBound), 0.75)\n\n\t\tlet testDate2 = DateInRegion(\"2018-05-31 22:30:00\", format: dateFormat, region: regionLondon)!\n\t\tXCTAssertEqual( testDate2.positionInRange(date: lowerBound, and: upperBound), 0.25)\n\n\t\tlet testDate3 = DateInRegion(\"2018-05-31 21:00:00\", format: dateFormat, region: regionLondon)!\n\t\tXCTAssertNil( testDate3.positionInRange(date: lowerBound, and: upperBound))\n\n\t\tlet testDate4 = DateInRegion(\"2018-06-01 03:00:00\", format: dateFormat, region: regionLondon)!\n\t\tXCTAssertNil( testDate4.positionInRange(date: lowerBound, and: upperBound))\n\t}\n\n\tfunc testDateInRegion_isInRange() {\n\t\tlet regionRome = Region(calendar: Calendars.gregorian, zone: Zones.europeRome, locale: Locales.italian)\n\t\tlet regionLondon = Region(calendar: Calendars.gregorian, zone: Zones.europeLondon, locale: Locales.english)\n\t\tlet dateFormat = \"yyyy-MM-dd HH:mm:ss\"\n\n\t\tlet lowerBound = DateInRegion(\"2018-05-31 23:00:00\", format: dateFormat, region: regionRome)!\n\t\tlet upperBound = DateInRegion(\"2018-06-01 01:00:00\", format: dateFormat, region: regionRome)!\n\n\t\tlet testDate1 = DateInRegion(\"2018-06-01 00:02:00\", format: dateFormat, region: regionRome)!\n\t\tXCTAssert( testDate1.isInRange(date: lowerBound, and: upperBound, orEqual: true, granularity: .hour), \"Failed to isInRange .hour\")\n\n\t\tlet testDate2 = DateInRegion(\"2018-06-01 00:02:00\", format: dateFormat, region: regionLondon)!\n\t\tXCTAssert( testDate2.isInRange(date: lowerBound, and: upperBound, orEqual: true, granularity: .hour), \"Failed to isInRange .hour\")\n\n\t\tlet testDate3 = DateInRegion(\"2018-06-01 01:00:01\", format: dateFormat, region: regionLondon)!\n\t\tXCTAssert( testDate3.isInRange(date: lowerBound, and: upperBound, orEqual: true, granularity: .hour) == false, \"Failed to isInRange .hour == false\")\n\t}\n\n\tfunc testDateInRegion_earlierAndLaterDate() {\n\t\tlet regionRome = Region(calendar: Calendars.gregorian, zone: Zones.europeRome, locale: Locales.italian)\n\t\tlet regionLondon = Region(calendar: Calendars.gregorian, zone: Zones.europeLondon, locale: Locales.english)\n\t\tlet dateFormat = \"yyyy-MM-dd HH:mm:ss\"\n\n\t\tlet date1 = DateInRegion(\"2018-05-31 23:00:00\", format: dateFormat, region: regionRome)!\n\t\tlet date2 = DateInRegion(\"2018-06-01 00:00:00\", format: dateFormat, region: regionRome)!\n\t\tlet date3 = DateInRegion(\"2018-06-01 01:00:00\", format: dateFormat, region: regionLondon)!\n\n\t\t// earlierDate()\n\t\tXCTAssert( (date1.earlierDate(date2) == date1), \"Failed to get .earlierDate()\")\n\t\tXCTAssert( (date1.earlierDate(date3) == date1), \"Failed to get .earlierDate()\")\n\t\tXCTAssert( (date1.date.earlierDate(date2.date) == date1.date), \"Failed to get .earlierDate()\")\n\t\tXCTAssert( (date1.date.earlierDate(date3.date) == date1.date), \"Failed to get .earlierDate()\")\n\n\t\t// laterDate()\n\t\tXCTAssert( (date1.laterDate(date2) == date2), \"Failed to get .laterDate()\")\n\t\tXCTAssert( (date1.laterDate(date3) == date3), \"Failed to get .laterDate()\")\n\t\tXCTAssert( (date1.date.laterDate(date2.date) == date2.date), \"Failed to get .laterDate()\")\n\t\tXCTAssert( (date1.date.laterDate(date3.date) == date3.date), \"Failed to get .laterDate()\")\n\t}\n\n\tfunc testDateInRegion_compareMath() {\n\t\tlet regionRome = Region(calendar: Calendars.gregorian, zone: Zones.europeRome, locale: Locales.italian)\n\t\tlet regionNY = Region(calendar: Calendars.gregorian, zone: Zones.americaNewYork, locale: Locales.english)\n\t\tlet dateFormat = \"yyyy-MM-dd HH:mm:ss\"\n\n\t\tlet date1 = DateInRegion(\"2018-01-01 00:10:00\", format: dateFormat, region: regionRome)!\n\t\tlet date2 = DateInRegion(\"2017-12-31 23:00:00\", format: dateFormat, region: regionRome)!\n\t\tlet date3 = DateInRegion(\"2018-01-01 00:20:00\", format: dateFormat, region: regionNY)!\n\n\t\tXCTAssert( (date1 >= date2), \"Failed to math compare two dates\")\n\t\tXCTAssert( (date1 > date2), \"Failed to math compare two dates\")\n\t\tXCTAssert( (date3 > date1), \"Failed to math compare two dates\")\n\t\tXCTAssert( (date3 == date3), \"Failed to math compare two dates\")\n\t\tXCTAssert( (date3 >= date3), \"Failed to math compare two dates\")\n\t\tXCTAssert( (date3 <= date3), \"Failed to math compare two dates\")\n\t\tXCTAssert( (date1 <= date3), \"Failed to math compare two dates\")\n\t}\n\n\tfunc testDateInRange_GranuralityTest() {\n\t\tlet startTime = Date(timeIntervalSince1970: 1_538_344_800.0) // 2018-09-30 22:00:00 +0000\n\t\tlet endTime = Date(timeIntervalSince1970: 1_540_940_400.0 + (60 * 60 * 3)) // 2018-10-31 02:00:00 +0000\n\t\tlet checkStart = Date(timeIntervalSince1970: 1_540_976_400.0) // 2018-10-31 09:00:00 +0000\n\n\t\tlet isInside = checkStart.isInRange(date: startTime, and: endTime, orEqual: true, granularity: .day) // should return false even if its true\n\t\tXCTAssert( (isInside == true), \"Failed to compare date with granularity\")\n\t}\n\n}\n"
  },
  {
    "path": "Tests/SwiftDateTests/TestDateInRegion+Components.swift",
    "content": "//\n//  SwiftDate\n//  Parse, validate, manipulate, and display dates, time and timezones in Swift\n//\n//  Created by Daniele Margutti\n//   - Web: https://www.danielemargutti.com\n//   - Twitter: https://twitter.com/danielemargutti\n//   - Mail: hello@danielemargutti.com\n//\n//  Copyright © 2019 Daniele Margutti. Licensed under MIT License.\n//\n\nimport SwiftDate\nimport XCTest\n\nclass TestDateInRegion_Components: XCTestCase {\n\n\tfunc testDateInRegion_Components() {\n\t\tlet regionLondon = Region(calendar: Calendars.gregorian, zone: Zones.europeLondon, locale: Locales.italian)\n\t\tlet dateFormat = \"yyyy-MM-dd HH:mm:ss\"\n\n\t\t// TEST #1: Date In Italian\n\t\tlet dateA = DateInRegion(\"2018-02-05 23:14:45\", format: dateFormat, region: regionLondon)!\n\t\tXCTValidateDateComponents(date: dateA, expec: ExpectedDateComponents {\n\t\t\t$0.year = 2018\n\t\t\t$0.month = 2\n\t\t\t$0.day = 5\n\t\t\t$0.hour = 23\n\t\t\t$0.minute = 14\n\t\t\t$0.second = 45\n\t\t\t$0.monthNameDefault = \"febbraio\"\n\t\t\t$0.monthNameDefaultStd = \"febbraio\"\n\t\t\t$0.monthNameShort = \"feb\"\n\t\t\t$0.monthNameStandaloneShort = \"feb\"\n\t\t\t$0.msInDay = 83_686_000\n\t\t\t$0.weekday = 2\n\t\t\t$0.weekdayNameShort = \"lun\"\n\t\t\t$0.weekdayNameVeryShort = \"L\"\n\t\t\t$0.weekOfMonth = 2\n\t\t\t$0.eraNameShort = \"a.C.\"\n\t\t\t$0.weekdayOrdinal = 1\n\t\t\t$0.nearestHour = 23\n\t\t\t$0.yearForWeekOfYear = 2018\n\t\t\t$0.quarter = 1\n\t\t})\n\n\t\t// TEST #1: Date In French\n\t\tlet regionParis = Region(calendar: Calendars.gregorian, zone: Zones.europeParis, locale: Locales.french)\n\t\tlet dateB = DateInRegion(\"2018-02-05 23:14:45\", format: dateFormat, region: regionParis)!\n\t\tXCTValidateDateComponents(date: dateB, expec: ExpectedDateComponents {\n\t\t\t$0.monthNameDefault = \"février\"\n\t\t\t$0.monthNameShort = \"févr.\"\n\t\t\t$0.eraNameShort = \"av. J.-C.\"\n\t\t\t$0.weekdayNameDefault = \"lundi\"\n\t\t})\n\n\t\t// TEST #3: Other components\n\t\tXCTAssert( (dateB.region == regionParis), \"Failed to assign correct region to date\")\n\t\tXCTAssert( (dateB.calendar.identifier == regionParis.calendar.identifier), \"Failed to assign correct region's calendar to date\")\n\t\tXCTAssert( (dateB.quarterName(.default) == \"1er trimestre\"), \"Failed to get quarterName in default\")\n\t\tXCTAssert( (dateB.quarterName(.short) == \"T1\"), \"Failed to get quarterName in short\")\n\t\tXCTAssert( (dateB.quarterName(.default, locale: Locales.italian) == \"1º trimestre\"), \"Failed to get quarterName with overwrite of locale\")\n\t}\n\n\tfunc testDateInRegion_isLeapMonth() {\n\t\tlet regionRome = Region(calendar: Calendars.gregorian, zone: Zones.europeRome, locale: Locales.italian)\n\t\tlet dateFormat = \"yyyy-MM-dd HH:mm:ss\"\n\n\t\tlet dateA = DateInRegion(\"2018-02-05 00:00:00\", format: dateFormat, region: regionRome)!\n\t\tlet dateB = DateInRegion(\"2016-02-22 00:00:00\", format: dateFormat, region: regionRome)!\n\t\tlet dateC = DateInRegion(\"2017-12-10 00:00:00\", format: dateFormat, region: regionRome)!\n\t\tXCTAssert( dateA.isLeapMonth == false, \"Failed to evaluate is date isLeapMonth == false\")\n\t\tXCTAssert( dateC.isLeapMonth == false, \"Failed to evaluate is date isLeapMonth == false\")\n\t\tXCTAssert( dateB.isLeapMonth, \"Failed to evaluate is date isLeapMonth\")\n\t}\n\n\tfunc testDateInRegion_dateBySet() {\n\t\tlet originalDate = \"2018-10-10T12:02:16.024\".toISODate()\n\t\tlet newDate = originalDate?.dateBySet(hour: nil, min: nil, secs: nil, ms: 7)\n\t\tXCTAssert( newDate?.toISO([.withInternetDateTimeExtended]) == \"2018-10-10T12:02:16.007Z\", \"Failed to set milliseconds\")\n\t}\n\n\tfunc testDateInRegion_isLeapYear() {\n\t\tlet regionRome = Region(calendar: Calendars.gregorian, zone: Zones.europeRome, locale: Locales.italian)\n\t\tlet dateFormat = \"yyyy-MM-dd HH:mm:ss\"\n\n\t\tlet dateA = DateInRegion(\"2018-04-05 00:00:00\", format: dateFormat, region: regionRome)!\n\t\tlet dateB = DateInRegion(\"2016-07-22 00:00:00\", format: dateFormat, region: regionRome)!\n\t\tlet dateC = DateInRegion(\"2017-12-10 00:00:00\", format: dateFormat, region: regionRome)!\n\t\tXCTAssert( dateA.isLeapYear == false, \"Failed to evaluate is date isLeapYear == false\")\n\t\tXCTAssert( dateC.isLeapYear == false, \"Failed to evaluate is date isLeapYear == false\")\n\t\tXCTAssert( dateB.isLeapYear, \"Failed to evaluate is date isLeapYear\")\n\t}\n\n\tfunc testDateInRegion_julianDayAndModifiedJulianDay() {\n\n\t\t// swiftlint:disable nesting\n\t\tstruct ExpectedJulian {\n\t\t\tvar dateISO: String\n\t\t\tvar julianDay: Double\n\t\t\tvar modifiedJulianDay: Double\n\t\t}\n\n\t\tlet dates = [\n\t\t\tExpectedJulian(dateISO: \"2017-12-22T00:06:18+01:00\", julianDay: 2_458_109.462_708_333_5, modifiedJulianDay: 58108.962_708_333_51),\n\t\t\tExpectedJulian(dateISO: \"2018-06-02T02:14:45+02:00\", julianDay: 2_458_271.510_243_055_4, modifiedJulianDay: 58271.010_243_055_41),\n\t\t\tExpectedJulian(dateISO: \"2018-04-04T13:31:12+02:00\", julianDay: 2_458_212.98, modifiedJulianDay: 58212.479_999_999_98),\n\t\t\tExpectedJulian(dateISO: \"2018-03-18T10:11:10+01:00\", julianDay: 2_458_195.882_754_629_5, modifiedJulianDay: 58195.382_754_629_48),\n\t\t\tExpectedJulian(dateISO: \"2018-03-10T18:03:22+01:00\", julianDay: 2_458_188.210_671_296_3, modifiedJulianDay: 58187.710_671_296_34),\n\t\t\tExpectedJulian(dateISO: \"2017-07-14T06:33:47+02:00\", julianDay: 2_457_948.690_127_315, modifiedJulianDay: 57948.190_127_315),\n\t\t\tExpectedJulian(dateISO: \"2018-02-14T16:51:14+01:00\", julianDay: 2_458_164.160_578_703_5, modifiedJulianDay: 58163.660_578_703_51),\n\t\t\tExpectedJulian(dateISO: \"2017-08-15T17:41:44+02:00\", julianDay: 2_457_981.153_981_481_7, modifiedJulianDay: 57980.653_981_481_68),\n\t\t\tExpectedJulian(dateISO: \"2018-03-04T09:54:54+01:00\", julianDay: 2_458_181.871_458_333, modifiedJulianDay: 58181.371_458_332_986),\n\t\t\tExpectedJulian(dateISO: \"2017-09-23T08:18:15+02:00\", julianDay: 2_458_019.762_673_611, modifiedJulianDay: 58019.262_673_610_82),\n\t\t\tExpectedJulian(dateISO: \"2017-12-10T10:29:42+01:00\", julianDay: 2_458_097.895625, modifiedJulianDay: 58097.395_624_999_89),\n\t\t\tExpectedJulian(dateISO: \"2017-11-11T02:49:41+01:00\", julianDay: 2_458_068.576_168_981_4, modifiedJulianDay: 58068.076_168_981_38),\n\t\t\tExpectedJulian(dateISO: \"2017-07-06T04:05:39+02:00\", julianDay: 2_457_940.587_256_944_7, modifiedJulianDay: 57940.087_256_944_74),\n\t\t\tExpectedJulian(dateISO: \"2017-12-02T00:23:52+01:00\", julianDay: 2_458_089.474_907_407_5, modifiedJulianDay: 58088.974_907_407_54),\n\t\t\tExpectedJulian(dateISO: \"2017-11-14T17:59:46+01:00\", julianDay: 2_458_072.208_171_296_4, modifiedJulianDay: 58071.708_171_296_4),\n\t\t\tExpectedJulian(dateISO: \"2018-03-02T10:53:52+01:00\", julianDay: 2_458_179.912_407_407_5, modifiedJulianDay: 58179.412_407_407_54),\n\t\t\tExpectedJulian(dateISO: \"2018-04-14T23:46:35+02:00\", julianDay: 2_458_223.407_349_537, modifiedJulianDay: 58222.907_349_537_13),\n\t\t\tExpectedJulian(dateISO: \"2018-04-28T07:25:22+02:00\", julianDay: 2_458_236.725_949_074, modifiedJulianDay: 58236.225_949_074_14),\n\t\t\tExpectedJulian(dateISO: \"2018-01-06T14:36:53+01:00\", julianDay: 2_458_125.067_280_092_3, modifiedJulianDay: 58124.567_280_092_28),\n\t\t\tExpectedJulian(dateISO: \"2017-09-24T19:58:19+02:00\", julianDay: 2_458_021.248_831_019, modifiedJulianDay: 58020.748_831_018_806),\n\t\t\tExpectedJulian(dateISO: \"2017-12-17T21:12:31+01:00\", julianDay: 2_458_105.342_025_463, modifiedJulianDay: 58104.842_025_463_004),\n\t\t\tExpectedJulian(dateISO: \"2018-05-04T02:28:42+02:00\", julianDay: 2_458_242.519_930_555_5, modifiedJulianDay: 58242.019_930_555_485),\n\t\t\tExpectedJulian(dateISO: \"2018-01-21T18:41:34+01:00\", julianDay: 2_458_140.237_199_074, modifiedJulianDay: 58139.737_199_074_12),\n\t\t\tExpectedJulian(dateISO: \"2018-04-05T02:36:54+02:00\", julianDay: 2_458_213.525625, modifiedJulianDay: 58213.025_624_999_78),\n\t\t\tExpectedJulian(dateISO: \"2018-02-07T13:35:16+01:00\", julianDay: 2_458_157.024_490_741, modifiedJulianDay: 58156.524_490_741_08),\n\t\t\tExpectedJulian(dateISO: \"2017-11-30T00:58:20+01:00\", julianDay: 2_458_087.498_842_592_4, modifiedJulianDay: 58086.998_842_592_35),\n\t\t\tExpectedJulian(dateISO: \"2018-04-10T07:10:34+02:00\", julianDay: 2_458_218.715_671_296, modifiedJulianDay: 58218.215_671_296_23),\n\t\t\tExpectedJulian(dateISO: \"2017-08-11T09:36:56+02:00\", julianDay: 2_457_976.817_314_815, modifiedJulianDay: 57976.317_314_814_776),\n\t\t\tExpectedJulian(dateISO: \"2018-04-28T12:30:18+02:00\", julianDay: 2_458_236.937_708_333, modifiedJulianDay: 58236.437_708_333_135),\n\t\t\tExpectedJulian(dateISO: \"2017-09-17T11:59:29+02:00\", julianDay: 2_458_013.916_307_870_3, modifiedJulianDay: 58013.416_307_870_3)\n\t\t]\n\n\t\tdates.forEach {\n\t\t\tlet date = $0.dateISO.toISODate()!\n\t\t\tguard date.julianDay == $0.julianDay else {\n\t\t\t\tXCTFail(\"Failed to evaluate julianDay of '\\($0.dateISO)'. Got '\\(date.julianDay)', expected '\\($0.julianDay)'\")\n\t\t\t\treturn\n\t\t\t}\n\t\t\tguard date.modifiedJulianDay == $0.modifiedJulianDay else {\n\t\t\t\tXCTFail(\"Failed to evaluate modifiedJulianDay of '\\($0.dateISO)'. Got '\\(date.modifiedJulianDay)', expected '\\($0.modifiedJulianDay)'\")\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\n\t}\n\n\t@available(iOS 9.0, macOS 10.11, *)\n\tfunc test_ordinalDay() {\n\t\tlet newYork = Region(calendar: Calendars.gregorian, zone: Zones.americaNewYork, locale: Locales.englishUnitedStates)\n\n\t\tlet localDate = DateInRegion(components: {\n\t\t\t$0.year = 2002\n\t\t\t$0.month = 3\n\t\t\t$0.day = 1\n\t\t\t$0.hour = 5\n\t\t\t$0.minute = 30\n\t\t}, region: newYork)!\n\t\tXCTAssert(localDate.ordinalDay == \"1st\", \"Failed to get the correct value of the ordinalDay for a date\")\n\n\t\tlet localDate2 = DateInRegion(components: {\n\t\t\t$0.year = 2002\n\t\t\t$0.month = 3\n\t\t\t$0.day = 2\n\t\t\t$0.hour = 5\n\t\t\t$0.minute = 30\n\t\t}, region: newYork)!\n\t\tXCTAssert(localDate2.ordinalDay == \"2nd\", \"Failed to get the correct value of the ordinalDay for a date\")\n\n\t\tlet localDate3 = DateInRegion(components: {\n\t\t\t$0.year = 2002\n\t\t\t$0.month = 3\n\t\t\t$0.day = 3\n\t\t\t$0.hour = 5\n\t\t\t$0.minute = 30\n\t\t}, region: newYork)!\n\t\tXCTAssert(localDate3.ordinalDay == \"3rd\", \"Failed to get the correct value of the ordinalDay for a date\")\n\n\t\tlet localDate4 = DateInRegion(components: {\n\t\t\t$0.year = 2002\n\t\t\t$0.month = 3\n\t\t\t$0.day = 4\n\t\t\t$0.hour = 5\n\t\t\t$0.minute = 30\n\t\t}, region: newYork)!\n\t\tXCTAssert(localDate4.ordinalDay == \"4th\", \"Failed to get the correct value of the ordinalDay for a date\")\n\n\t\tlet regionRome = Region(calendar: Calendars.gregorian, zone: Zones.europeRome, locale: Locales.italian)\n\t\tlet localDate5 = DateInRegion(components: {\n\t\t\t$0.year = 2002\n\t\t\t$0.month = 3\n\t\t\t$0.day = 2\n\t\t\t$0.hour = 5\n\t\t\t$0.minute = 30\n\t\t}, region: regionRome)!\n\t\tXCTAssert(localDate5.ordinalDay == \"2º\", \"Failed to get the correct value of the ordinalDay for a date\")\n\t}\n\n\tfunc testDateInRegion_ISOFormatterAlt() {\n\t\tlet regionRome = Region(calendar: Calendars.gregorian, zone: Zones.europeRome, locale: Locales.italian)\n\t\tlet dateFormat = \"yyyy-MM-dd HH:mm:ss\"\n\t\tlet date = DateInRegion(\"2017-07-22 00:00:00\", format: dateFormat, region: regionRome)!\n\n\t\tXCTAssert( date.toISO() == \"2017-07-22T00:00:00+02:00\", \"Failed to format ISO\")\n\t\tXCTAssert( date.toISO([.withFullDate]) == \"2017-07-22\", \"Failed to format ISO\")\n\t\tXCTAssert( date.toISO([.withFullDate, .withFullTime, .withDashSeparatorInDate, .withSpaceBetweenDateAndTime]) == \"2017-07-22 00:00:00+02:00\", \"Failed to format ISO\")\n\t}\n\n\tfunc testDateInRegion_getIntervalForComponentBetweenDates() {\n\t\tlet regionRome = Region(calendar: Calendars.gregorian, zone: Zones.europeRome, locale: Locales.italian)\n\t\tlet dateFormat = \"yyyy-MM-dd HH:mm:ss\"\n\n\t\tlet dateA = DateInRegion(\"2017-07-22 00:00:00\", format: dateFormat, region: regionRome)!\n\t\tlet dateB = DateInRegion(\"2017-07-23 12:00:00\", format: dateFormat, region: regionRome)!\n\t\tlet dateC = DateInRegion(\"2017-09-23 12:00:00\", format: dateFormat, region: regionRome)!\n\t\tlet dateD = DateInRegion(\"2017-09-23 12:54:00\", format: dateFormat, region: regionRome)!\n\n\t\tXCTAssert( (dateA.getInterval(toDate: dateB, component: .hour) == 36), \"Failed to evaluate is hours interval\")\n\t\tXCTAssert( (dateA.getInterval(toDate: dateB, component: .day) == 2), \"Failed to evaluate is days interval\") // 1 days, 12 hours\n\t\tXCTAssert( (dateB.getInterval(toDate: dateC, component: .month) == 2), \"Failed to evaluate is months interval\")\n\t\tXCTAssert( (dateB.getInterval(toDate: dateC, component: .day) == 62), \"Failed to evaluate is days interval\")\n\t\tXCTAssert( (dateB.getInterval(toDate: dateC, component: .year) == 0), \"Failed to evaluate is years interval\")\n\t\tXCTAssert( (dateB.getInterval(toDate: dateC, component: .weekOfYear) == 9), \"Failed to evaluate is weeksOfYear interval\")\n\t\tXCTAssert( (dateC.getInterval(toDate: dateD, component: .minute) == 54), \"Failed to evaluate is minutes interval\")\n\t\tXCTAssert( (dateC.getInterval(toDate: dateD, component: .hour) == 0), \"Failed to evaluate is hours interval\")\n\t\tXCTAssert( (dateA.getInterval(toDate: dateD, component: .minute) == 91494), \"Failed to evaluate is minutes interval\")\n\t}\n\n\tfunc testDateInRegion_timeIntervalSince() {\n\t\tlet regionRome = Region(calendar: Calendars.gregorian, zone: Zones.europeRome, locale: Locales.italian)\n\t\tlet regionLondon = Region(calendar: Calendars.gregorian, zone: Zones.europeLondon, locale: Locales.english)\n\t\tlet dateFormat = \"yyyy-MM-dd HH:mm:ss\"\n\n\t\tlet dateA = DateInRegion(\"2017-07-22 00:00:00\", format: dateFormat, region: regionRome)!\n\t\tlet dateB = DateInRegion(\"2017-07-22 00:00:00\", format: dateFormat, region: regionRome)!\n\t\tlet dateC = DateInRegion(\"2017-07-23 13:20:15\", format: dateFormat, region: regionLondon)!\n\t\tlet dateD = DateInRegion(\"2017-07-23 13:20:20\", format: dateFormat, region: regionLondon)!\n\n\t\tXCTAssert( dateA.timeIntervalSince(dateC) == -138015.0, \"Failed to evaluate is minutes interval\")\n\t\tXCTAssert( dateA.timeIntervalSince(dateB) == 0, \"Failed to evaluate is minutes interval\")\n\t\tXCTAssert( dateC.timeIntervalSince(dateD) == -5, \"Failed to evaluate is minutes interval\")\n\t}\n\n\tfunc testQuarter() {\n\t\tlet regionLondon = Region(calendar: Calendars.gregorian, zone: Zones.europeLondon, locale: Locales.english)\n\t\tlet dateFormat = \"yyyy-MM-dd HH:mm:ss\"\n\n\t\tlet dateA = DateInRegion(\"2018-02-05 23:14:45\", format: dateFormat, region: regionLondon)!\n\t\tlet dateB = DateInRegion(\"2018-09-05 23:14:45\", format: dateFormat, region: regionLondon)!\n\t\tlet dateC = DateInRegion(\"2018-12-05 23:14:45\", format: dateFormat, region: regionLondon)!\n\n\t\tXCTAssert( dateA.quarter == 1, \"Failed to evaluate quarter property\")\n\t\tXCTAssert( dateB.quarter == 3, \"Failed to evaluate quarter property\")\n\t\tXCTAssert( dateC.quarter == 4, \"Failed to evaluate quarter property\")\n\t}\n\n\tfunc testAbsoluteDateISOFormatting() {\n\t\tlet now = DateInRegion()\n\t\tlet iso8601_string = now.toISO([.withInternetDateTime])\n\t\tlet absoluteDate = now.date\n\t\tlet absoluteDate_iso8601_string = absoluteDate.toISO([.withInternetDateTime])\n\t\tXCTAssert( absoluteDate_iso8601_string == iso8601_string, \"Failed respect the absolute ISO date\")\n\t}\n    \n    func testComparingTimeUnitsWithDateComponents() {\n        SwiftDate.defaultRegion = .local\n\n        let now = Date()\n        XCTAssert((now.addingTimeInterval(3600) - now).in(.hour) == 1, \"Failed to compare date\")\n        XCTAssert((now.addingTimeInterval(3600) - now) == 1.hours, \"Failed to compare date\")\n    }\n    \n}\n"
  },
  {
    "path": "Tests/SwiftDateTests/TestDateInRegion+Create.swift",
    "content": "//\n//  SwiftDate\n//  Parse, validate, manipulate, and display dates, time and timezones in Swift\n//\n//  Created by Daniele Margutti\n//   - Web: https://www.danielemargutti.com\n//   - Twitter: https://twitter.com/danielemargutti\n//   - Mail: hello@danielemargutti.com\n//\n//  Copyright © 2019 Daniele Margutti. Licensed under MIT License.\n//\n\nimport SwiftDate\nimport XCTest\n\npublic func randomNumber<T: SignedInteger>(inRange range: ClosedRange<T> = 1...6) -> T {\n\tlet length = Int64(range.upperBound - range.lowerBound + 1)\n\tlet value = Int64.random(in: 0..<Int64.max) % length + Int64(range.lowerBound)\n\treturn T(value)\n}\n\nclass TestDateInRegion_Create: XCTestCase {\n\n\tfunc testDateInRegion_DateBySetTime() {\n\t\tlet regionRome = Region(calendar: Calendars.gregorian, zone: Zones.europeRome, locale: Locales.italian)\n\t\tlet date1 = DateInRegion(\"2010-01-01 00:00:00\", format: \"yyyy-MM-dd HH:mm:ss\", region: regionRome)!\n\t\tguard let date1a = date1.dateBySet(hour: 20, min: 13, secs: 15) else {\n\t\t\tXCTFail(\"Failed to alter date's time\")\n\t\t\treturn\n\t\t}\n\t\tXCTAssert( (date1a.hour == 20 && date1a.minute == 13 && date1a.second == 15 ), \"Failed to alter date's time\")\n\n\t\t// altering only one component\n\t\tguard let date2a = date1.dateBySet(hour: 20, min: nil, secs: nil) else {\n\t\t\tXCTFail(\"Failed to alter date's time\")\n\t\t\treturn\n\t\t}\n\t\tXCTAssert( (date2a.hour == 20 && date2a.minute == 00 && date2a.second == 00 ), \"Failed to alter date's time\")\n\n\t}\n\n\tfunc testDateInRegion_DateBySet() {\n\t\t// swiftlint:disable nesting\n\t\tstruct ExpectDateBySet {\n\t\t\tvar components: [Calendar.Component: Int?] = [:]\n\n\t\t\tinit() {\n\t\t\t\tlet allCmps: [Calendar.Component] = [.second, .minute, .hour, .day, .month, .year]\n\t\t\t\tfor i in 0..<allCmps.count {\n\t\t\t\t\tlet componentToAlter = allCmps[i]\n\t\t\t\t\tlet range: ClosedRange<Int>?\n\t\t\t\t\tswitch componentToAlter {\n\t\t\t\t\tcase .second, .minute:\trange = 0...50\n\t\t\t\t\tcase .hour:\t\t\t\trange = 0...20\n\t\t\t\t\tcase .day:\t\t\t\trange = 1...28\n\t\t\t\t\tcase .month:\t\t\trange = 1...12\n\t\t\t\t\tcase .year:\t\t\t\trange = 2000...2050\n\t\t\t\t\tdefault:\t\t\t\trange = nil\n\t\t\t\t\t}\n\t\t\t\t\tif let range = range {\n\t\t\t\t\t\tlet value = randomNumber(inRange: range)\n\t\t\t\t\t\tcomponents[componentToAlter] = value\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tfunc verify(date: DateInRegion) {\n\t\t\t\tcomponents.keys.forEach {\n\t\t\t\t\tif let value = date.dateComponents.value(for: $0), let expected = components[$0] as? Int {\n\t\t\t\t\t\tif value != expected {\n\t\t\t\t\t\t\tXCTFail(\"Failed to set value of component \\($0). Got \\(value), expected \\(expected)\")\n\t\t\t\t\t\t\treturn\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t}\n\t\t}\n\n\t\tfor _ in 0..<50 {\n\t\t\tlet randomDate = \"2041-05-18T18:00:25Z\".toISODate()! //DateInRegion.randomDate(region: regionRome)\n\t\t\tlet alterComponents = ExpectDateBySet()\n\t\t\tif let alteredDate = randomDate.dateBySet(alterComponents.components) {\n\t\t\t\talterComponents.verify(date: alteredDate)\n\t\t\t}\n\t\t}\n\t}\n\n\tfunc testDateInRegion_RandomDatesInRange() {\n\t\t// Random dates\n\t\tlet regionNorw = Region(calendar: Calendars.gregorian, zone: Zones.europeOslo, locale: Locales.norwegianBokmlSvalbardJanMayen)\n\t\tlet randomDateAny = DateInRegion.randomDate(region: regionNorw)\n\t\tguard randomDateAny.region == regionNorw else {\n\t\t\tXCTFail(\"Failed to generate a random date in region\")\n\t\t\treturn\n\t\t}\n\n\t\t// Random dates in range\n\t\tlet regionRome = Region(calendar: Calendars.gregorian, zone: Zones.europeRome, locale: Locales.italian)\n\t\tlet upperLimit = DateInRegion(\"2015-01-01 00:00:00\", format: \"yyyy-MM-dd HH:mm:ss\", region: regionRome)!\n\t\tlet lowerLimit = DateInRegion(\"2010-01-01 00:00:00\", format: \"yyyy-MM-dd HH:mm:ss\", region: regionRome)!\n\n\t\tlet randomDates = DateInRegion.randomDates(count: 50, between: lowerLimit, and: upperLimit, region: regionRome)\n\t\trandomDates.forEach {\n\t\t\tguard $0.isInRange(date: lowerLimit, and: upperLimit) else {\n\t\t\t\tXCTFail(\"Random date '\\($0.description)' is not in given range\")\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}\n\n\tfunc testDateInRegion_RandomDatesBackToDays() {\n\t\tfor _ in 0..<50 {\n\t\t\tlet daysBack = (Int.random(in: 0..<365) + 1)\n\t\t\tlet randomDate = DateInRegion.randomDate(withinDaysBeforeToday: daysBack)\n\t\t\tguard randomDate.getInterval(toDate: DateInRegion(), component: .day) <= daysBack else {\n\t\t\t\tXCTFail(\"Failed to generate a random back date back to max \\(daysBack) days\")\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}\n\n\tfunc testDateInRegion_EnumerateDates() {\n\t\tlet regionRome = Region(calendar: Calendars.gregorian, zone: Zones.europeRome, locale: Locales.italian)\n\n\t\t// TEST DATE #1\n\t\t// +1 days\n\t\tlet fromDate1 = DateInRegion(\"2015-01-01 00:00:00\", format: \"yyyy-MM-dd HH:mm:ss\", region: regionRome)!\n\t\tlet toDate1 = DateInRegion(\"2015-01-02 03:00:00\", format: \"yyyy-MM-dd HH:mm:ss\", region: regionRome)!\n\n\t\tlet increment1 = DateComponents.create {\n\t\t\t$0.hour = 1\n\t\t}\n\t\tlet enumeratedDates1 = DateInRegion.enumerateDates(from: fromDate1, to: toDate1, increment: increment1)\n\t\tlet expectedDates1 = [\n\t\t\t\"2015-01-01 00:00:00\",\n\t\t\t\"2015-01-01 01:00:00\",\n\t\t\t\"2015-01-01 02:00:00\",\n\t\t\t\"2015-01-01 03:00:00\",\n\t\t\t\"2015-01-01 04:00:00\",\n\t\t\t\"2015-01-01 05:00:00\",\n\t\t\t\"2015-01-01 06:00:00\",\n\t\t\t\"2015-01-01 07:00:00\",\n\t\t\t\"2015-01-01 08:00:00\",\n\t\t\t\"2015-01-01 09:00:00\",\n\t\t\t\"2015-01-01 10:00:00\",\n\t\t\t\"2015-01-01 11:00:00\",\n\t\t\t\"2015-01-01 12:00:00\",\n\t\t\t\"2015-01-01 13:00:00\",\n\t\t\t\"2015-01-01 14:00:00\",\n\t\t\t\"2015-01-01 15:00:00\",\n\t\t\t\"2015-01-01 16:00:00\",\n\t\t\t\"2015-01-01 17:00:00\",\n\t\t\t\"2015-01-01 18:00:00\",\n\t\t\t\"2015-01-01 19:00:00\",\n\t\t\t\"2015-01-01 20:00:00\",\n\t\t\t\"2015-01-01 21:00:00\",\n\t\t\t\"2015-01-01 22:00:00\",\n\t\t\t\"2015-01-01 23:00:00\",\n\t\t\t\"2015-01-02 00:00:00\",\n\t\t\t\"2015-01-02 01:00:00\",\n\t\t\t\"2015-01-02 02:00:00\",\n\t\t\t\"2015-01-02 03:00:00\"]\n\t\tXCTExpectedFormattedDates(enumeratedDates1, expected: expectedDates1)\n\n\t\t// TEST DATE #2\n\t\t// +1 hour, +30 minutes, +10 seconds\n\t\tlet increment2 = DateComponents.create {\n\t\t\t$0.hour = 1\n\t\t\t$0.minute = 30\n\t\t\t$0.second = 10\n\t\t}\n\t\tlet fromDate2 = DateInRegion(\"2015-01-01 10:00:00\", format: \"yyyy-MM-dd HH:mm:ss\", region: regionRome)!\n\t\tlet toDate2 = DateInRegion(\"2015-01-02 03:00:00\", format: \"yyyy-MM-dd HH:mm:ss\", region: regionRome)!\n\t\tlet enumeratedDates2 = DateInRegion.enumerateDates(from: fromDate2, to: toDate2, increment: increment2)\n\t\tlet expectedDates2 = [\n\t\t\t\"2015-01-01 10:00:00\",\n\t\t\t\"2015-01-01 11:30:10\",\n\t\t\t\"2015-01-01 13:00:20\",\n\t\t\t\"2015-01-01 14:30:30\",\n\t\t\t\"2015-01-01 16:00:40\",\n\t\t\t\"2015-01-01 17:30:50\",\n\t\t\t\"2015-01-01 19:01:00\",\n\t\t\t\"2015-01-01 20:31:10\",\n\t\t\t\"2015-01-01 22:01:20\",\n\t\t\t\"2015-01-01 23:31:30\",\n\t\t\t\"2015-01-02 01:01:40\",\n\t\t\t\"2015-01-02 02:31:50\"\n\t\t]\n\t\tXCTExpectedFormattedDates(enumeratedDates2, expected: expectedDates2)\n\n\t\t// TEST DATE #3\n\t\t// +1 month\n\t\tlet increment3 = DateComponents.create {\n\t\t\t$0.month = 1\n\t\t}\n\t\tlet fromDate3 = DateInRegion(\"2015-01-01 01:00:00\", format: \"yyyy-MM-dd HH:mm:ss\", region: regionRome)!\n\t\tlet toDate3 = DateInRegion(\"2016-02-05 02:00:00\", format: \"yyyy-MM-dd HH:mm:ss\", region: regionRome)!\n\t\tlet enumeratedDates3 = DateInRegion.enumerateDates(from: fromDate3, to: toDate3, increment: increment3)\n\t\tlet expectedDates3 = [\n\t\t\t\"2015-01-01 01:00:00\",\n\t\t\t\"2015-02-01 01:00:00\",\n\t\t\t\"2015-03-01 01:00:00\",\n\t\t\t\"2015-04-01 01:00:00\",\n\t\t\t\"2015-05-01 01:00:00\",\n\t\t\t\"2015-06-01 01:00:00\",\n\t\t\t\"2015-07-01 01:00:00\",\n\t\t\t\"2015-08-01 01:00:00\",\n\t\t\t\"2015-09-01 01:00:00\",\n\t\t\t\"2015-10-01 01:00:00\",\n\t\t\t\"2015-11-01 01:00:00\",\n\t\t\t\"2015-12-01 01:00:00\",\n\t\t\t\"2016-01-01 01:00:00\",\n\t\t\t\"2016-02-01 01:00:00\"\n\t\t]\n\t\tXCTExpectedFormattedDates(enumeratedDates3, expected: expectedDates3)\n\t}\n\n\tfunc XCTExpectedFormattedDates(_ list: [DateInRegion], expected expectedDates: [String]) {\n\t\tlist.enumerated().forEach {\n\t\t\tlet formatted = $0.element.toFormat(\"yyyy-MM-dd HH:mm:ss\")\n\t\t\tlet expected = expectedDates[$0.offset]\n\t\t\tguard expected == formatted else {\n\t\t\t\tXCTFail(\"Failed to enumerate dates. Got '\\(formatted)' expected '\\(expected)\")\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}\n\n\tfunc testDateInRegion_oldestAndNewestAndSortsIn() {\n\t\tlet regionRome = Region(calendar: Calendars.gregorian, zone: Zones.europeRome, locale: Locales.italian)\n\t\tlet regionLondon = Region(calendar: Calendars.gregorian, zone: Zones.europeLondon, locale: Locales.english)\n\t\tlet regionNY = Region(calendar: Calendars.gregorian, zone: Zones.americaNewYork, locale: Locales.english)\n\n\t\tlet datesArrayFormat = \"yyyy-MM-dd HH:mm:ss\"\n\n\t\tlet date1 = DateInRegion(\"2015-09-24 13:20:55\", format: datesArrayFormat, region: regionRome)!\n\t\tlet date2 = DateInRegion(\"2015-11-14 14:44:00\", format: datesArrayFormat, region: regionRome)!\n\t\tlet date3 = DateInRegion(\"2017-01-01 00:00:00\", format: datesArrayFormat, region: regionRome)!\n\t\tlet date4 = DateInRegion(\"2015-09-24 13:00:55\", format: datesArrayFormat, region: regionNY)!\n\t\tlet date5 = DateInRegion(\"2017-11-30 20:00:40\", format: datesArrayFormat, region: regionNY)!\n\t\tlet date6 = DateInRegion(\"2017-11-29 23:59:59\", format: datesArrayFormat, region: regionLondon)!\n\t\tlet datesArray = [date1, date2, date3, date4, date5, date6]\n\n\t\t// Oldest and Newest\n\t\tXCTAssert( (DateInRegion.oldestIn(list: datesArray) == date1), \"Failed to get the oldest date in list\")\n\t\tXCTAssert( (DateInRegion.newestIn(list: datesArray) == date5), \"Failed to get the newest date in list\")\n\n\t\t// Order by newest\n\t\tlet orderedByNewest = DateInRegion.sortedByNewest(list: datesArray)\n\t\tXCTSameDateArray([date5, date6, date3, date2, date4, date1], orderedByNewest)\n\n\t\t// Order by oldest\n\t\tlet orderedByOldest = DateInRegion.sortedByOldest(list: datesArray)\n\t\tXCTSameDateArray([date1, date4, date2, date3, date6, date5], orderedByOldest)\n\t}\n\n\t@discardableResult\n\tfunc XCTSameDateArray(_ left: [DateInRegion], _ right: [DateInRegion]) -> Bool {\n\t\tguard left.count == right.count else { return false }\n\t\t// swiftlint:disable for_where\n\t\tfor idx in 0..<left.count {\n\t\t\tif left[idx] != right[idx] {\n\t\t\t\tXCTFail(\"At index \\(idx). Expected date = {\\(left[idx].date)}, got = {\\(right[idx].date)}\")\n\t\t\t\treturn false\n\t\t\t}\n\t\t}\n\t\treturn true\n\t}\n\n\tfunc testDateInRegion_DateForWeekdays() {\n\t\tfunc validateArrayOfISODates(_ found: [String], _ expected: [String]) {\n\t\t\tguard found.count == expected.count else {\n\t\t\t\tXCTFail(\"Failed to validate array of dates. Different in number.\")\n\t\t\t\treturn\n\t\t\t}\n\t\t\tfor i in 0..<expected.count {\n\t\t\t\tguard found[i] == expected[i] else {\n\t\t\t\t\tXCTFail(\"Failed to validate item '\\(i)'. Found '\\(found[i])', expecting '\\(expected[i])'\")\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tlet mondaysInJan2019 = DateInRegion.datesForWeekday(.monday, inMonth: 1, ofYear: 2019, region: Region.UTC).map { $0.toISO() }\n\t\tvalidateArrayOfISODates(mondaysInJan2019, [\n\t\t\t\"2019-01-07T00:00:00Z\",\n\t\t\t\"2019-01-14T00:00:00Z\",\n\t\t\t\"2019-01-21T00:00:00Z\",\n\t\t\t\"2019-01-28T00:00:00Z\"\n\t\t])\n\n\t\tlet fromDate = DateInRegion(year: 2019, month: 5, day: 27, hour: 0, minute: 0)\n\t\tlet toDate = DateInRegion(year: 2019, month: 6, day: 8, hour: 0, minute: 0)\n\n\t\tlet fridaysInJunePartial = DateInRegion.datesForWeekday(.friday, from: fromDate, to: toDate, region: Region.UTC).map {\n\t\t\t$0.toISO()\n\t\t}\n\t\tvalidateArrayOfISODates(fridaysInJunePartial, [\n\t\t\t\"2019-05-31T00:00:00Z\",\n\t\t\t\"2019-06-07T00:00:00Z\"\n\t\t])\n\t}\n\n    func testDateInRegion_DateAtStartOf() {\n        let regionRome = Region(calendar: Calendars.gregorian, zone: Zones.europeRome, locale: Locales.italian)\n        let currentDate = DateInRegion(Date(), region: regionRome)\n\n        let startOfDay1 = currentDate.dateAt(.startOfDay).date\n        let startOfDay2 = currentDate.dateAtStartOf(.day).date\n\n        XCTAssert( startOfDay1 == startOfDay2, \"dateAt(.startOfDay), dateAtStartOf(.day) are not same.\")\n\n        let startOfWeek1 = currentDate.dateAt(.startOfWeek).date\n        let startOfWeek2 = currentDate.dateAtStartOf(.weekOfYear).date\n\n        XCTAssert( startOfWeek1 == startOfWeek2, \"dateAt(.startOfWeek), dateAtStartOf(.weekday) are not same.\")\n\n        let startOfMonth1 = currentDate.dateAt(.startOfMonth).date\n        let startOfMonth2 = currentDate.dateAtStartOf(.month).date\n\n        XCTAssert( startOfMonth1 == startOfMonth2, \"dateAt(.startOfMonth), dateAtStartOf(.month) are not same.\")\n    }\n}\n"
  },
  {
    "path": "Tests/SwiftDateTests/TestDateInRegion+Math.swift",
    "content": "//\n//  SwiftDate\n//  Parse, validate, manipulate, and display dates, time and timezones in Swift\n//\n//  Created by Daniele Margutti\n//   - Web: https://www.danielemargutti.com\n//   - Twitter: https://twitter.com/danielemargutti\n//   - Mail: hello@danielemargutti.com\n//\n//  Copyright © 2019 Daniele Margutti. Licensed under MIT License.\n//\n\nimport SwiftDate\nimport XCTest\n\nclass TestDateInRegion_Math: XCTestCase {\n\n\tfunc testDateInRegion_DateTruncated() {\n\t\tlet format = \"yyyy-MM-dd HH:mm:ss\"\n\t\tlet rome = Region(calendar: Calendars.gregorian, zone: Zones.europeRome, locale: Locales.italian)\n\n\t\tlet d1 = DateInRegion(\"2017-07-22 15:03:50\", format: format, region: rome)!\n\t\tlet d1_truncatedAt = d1.dateTruncated(at: [.month, .day, .minute])\n\t\tlet d1_truncatedFrom = d1.dateTruncated(from: .hour)\n\n\t\tXCTAssert( d1_truncatedAt?.description == \"{abs_date=\\'2017-01-01T14:00:50Z\\', rep_date=\\'2017-01-01T15:00:50+01:00\\', region={calendar=\\'gregorian\\', timezone=\\'Europe/Rome\\', locale=\\'it\\'}\", \"Failed to truncate date at components\")\n\n\t\tXCTAssert( d1_truncatedFrom?.description == \"{abs_date=\\'2017-07-21T22:00:00Z\\', rep_date=\\'2017-07-22T00:00:00+02:00\\', region={calendar=\\'gregorian\\', timezone=\\'Europe/Rome\\', locale=\\'it\\'}\", \"Failed to truncate date from hour component\")\n\n\t}\n\n\tfunc testDateInRegion_Rounding() {\n\t\tlet format = \"yyyy-MM-dd HH:mm:ss\"\n\t\tlet rome = Region(calendar: Calendars.gregorian, zone: Zones.europeRome, locale: Locales.italian)\n\n\t\t// Round down 10m\n\t\tlet d1 = DateInRegion(\"2017-07-22 00:03:50\", format: format, region: rome)\n\t\tlet d1_rounded = d1?.dateRoundedAt(.to10Mins)\n\t\tXCTAssert( d1_rounded?.description == \"{abs_date=\\'2017-07-21T22:00:00Z\\', rep_date=\\'2017-07-22T00:00:00+02:00\\', region={calendar=\\'gregorian\\', timezone=\\'Europe/Rome\\', locale=\\'it\\'}\", \"Failed to round a date down 10mins\")\n\n\t\t// Round up 10min\n\t\tlet d2 = DateInRegion(\"2015-01-24 15:07:20\", format: format, region: rome)\n\t\tlet d2_roundedup10 = d2?.dateRoundedAt(.to10Mins)\n\t\tXCTAssert( d2_roundedup10?.description == \"{abs_date=\\'2015-01-24T14:10:00Z\\', rep_date=\\'2015-01-24T15:10:00+01:00\\', region={calendar=\\'gregorian\\', timezone=\\'Europe/Rome\\', locale=\\'it\\'}\", \"Failed to round a date up 10mins\")\n\n\t\t// Round up 30min\n\t\tlet d2_roundedc30 = d2?.dateRoundedAt(.toCeil30Mins)\n\t\tXCTAssert( d2_roundedc30?.description == \"{abs_date=\\'2015-01-24T14:30:00Z\\', rep_date=\\'2015-01-24T15:30:00+01:00\\', region={calendar=\\'gregorian\\', timezone=\\'Europe/Rome\\', locale=\\'it\\'}\", \"Failed to round a date ceil 30mins\")\n\n\t}\n\n\tfunc testDateInRegion_MathOperations() {\n\t\tlet regionRome = Region(calendar: Calendars.gregorian, zone: Zones.europeRome, locale: Locales.italian)\n\t\tlet dateFormat = \"yyyy-MM-dd HH:mm:ss\"\n\n\t\tlet date1 = DateInRegion(\"2017-07-22 00:00:00\", format: dateFormat, region: regionRome)!\n\t\tlet date2 = DateInRegion(\"2017-07-22 00:00:00\", format: dateFormat, region: regionRome)!\n\t\tlet date3 = DateInRegion(\"2018-08-23 10:50:20\", format: dateFormat, region: regionRome)!\n\n\t\t// TEST #1\n\t\t// (DateInRegion - DateInRegion) -> DateComponents\n\t\tXCTAssert( date1.componentsTo(date2).isZero, \"Failed to extract components from math operation between dates\")\n\t\tXCTAssert( date3.componentsTo(date2).hour == 10, \"Failed to extract components from math operation between dates\")\n\t\tXCTAssert( date3.componentsTo(date2).day == 1, \"Failed to extract components from math operation between dates\")\n\t\tXCTAssert( date3.componentsTo(date2).year == 1, \"Failed to extract components from math operation between dates\")\n\n\t\t// TEST #2\n\t\t// (DateInRegion + DateComponents) -> DateInRegion\n\t\tlet components1 = DateComponents.create {\n\t\t\t$0.day = 1\n\t\t\t$0.hour = 2\n\t\t\t$0.minute = 30\n\t\t}\n\t\tlet finalDate1 = (date1 + components1).toFormat(dateFormat)\n\t\tXCTAssert( (finalDate1 == \"2017-07-23 02:30:00\"), \"Failed to sum date to components and get the exact final date\")\n\n\t\t// TEST #3\n\t\tlet components2 = DateComponents.create {\n\t\t\t$0.year = 1\n\t\t\t$0.weekOfYear = 2\n\t\t}\n\t\tlet finalDate2 = (date1 + components2).toFormat(dateFormat)\n\t\tXCTAssert( (finalDate2 == \"2018-08-05 00:00:00\"), \"Failed to sum date to components and get the exact final date\")\n\n\t\t// TEST #4\n\t\t// (DateInRegion - DateComponents) -> DateInRegion\n\t\tlet finalDate3 = (date1 - DateComponents.create({\n\t\t\t$0.day = 30\n\t\t\t$0.hour = 27\n\t\t})).toFormat(dateFormat)\n\t\tXCTAssert( (finalDate3 == \"2017-06-20 21:00:00\"), \"Failed to minus date to components and get the exact final date\")\n\n\t\t// TEST #5\n\t\tlet finalDate4 = (date1 + [Calendar.Component.year: 1]).toFormat(dateFormat)\n\t\tXCTAssert( (finalDate4 == \"2018-07-22 00:00:00\"), \"Failed to add components dict and get the exact final date\")\n\n\t\t// TEST #6\n\t\tlet finalDate5 = (date1 + [Calendar.Component.day: 20, Calendar.Component.hour: 10]).toFormat(dateFormat)\n\t\tXCTAssert( (finalDate5 == \"2017-08-11 10:00:00\"), \"Failed to add components dict and get the exact final date\")\n\n    }\n\n    func testNextWeekday() {\n        let regionRome = Region(calendar: Calendars.gregorian, zone: Zones.europeRome, locale: Locales.italian)\n        let dateFormat = \"yyyy-MM-dd HH:mm:ss\"\n\n        let date1 = DateInRegion(\"2019-05-11 00:00:00\", format: dateFormat, region: regionRome)!\n        let nextFriday = date1.nextWeekday(.friday)\n        XCTAssert(nextFriday.toISO() == \"2019-05-17T00:00:00+02:00\", \"Failed to get the next weekday from date\")\n    }\n\n    func testDateAtWeekdayOrdinal() {\n        let regionRome = Region(calendar: Calendars.gregorian, zone: Zones.europeRome, locale: Locales.italian)\n        let dateFormat = \"yyyy-MM-dd HH:mm:ss\"\n\n        let date1 = DateInRegion(\"2019-05-11 00:00:00\", format: dateFormat, region: regionRome)!\n        let result = date1.dateAt(weekdayOrdinal: 3, weekday: .friday, monthNumber: date1.month + 1)\n        XCTAssert(result.toISO() == \"2019-06-21T00:00:00+02:00\", \"Failed to get the next weekday from date\")\n    }\n\n}\n"
  },
  {
    "path": "Tests/SwiftDateTests/TestDateInRegion.swift",
    "content": "//\n//  SwiftDate\n//  Parse, validate, manipulate, and display dates, time and timezones in Swift\n//\n//  Created by Daniele Margutti\n//   - Web: https://www.danielemargutti.com\n//   - Twitter: https://twitter.com/danielemargutti\n//   - Mail: hello@danielemargutti.com\n//\n//  Copyright © 2019 Daniele Margutti. Licensed under MIT License.\n//\n\nimport SwiftDate\nimport XCTest\n\nclass TestDateInRegion: XCTestCase {\n\n\tlet testDate = Date()\n\tlet testRegion = Region(calendar: Calendars.gregorian, zone: Zones.europeRome, locale: Locales.italian)\n\n\tfunc testDateInRegion_ParseWithLocale() {\n\t\tlet itRegion = Region(calendar: Calendars.gregorian, zone: Zones.europeRome, locale: Locales.italian)\n\t\tlet dateIt = \"15 Settembre 2001\".toDate(\"dd MMM yyyy\", region: itRegion)\n\t\tXCTAssertNotNil(dateIt, \"Failed to parse with forced locale it\")\n\n\t\tlet dateEnStr = \"10 July 2005\"\n\t\tlet dateEnFail = dateEnStr.toDate(\"dd MMM yyyy\", region: itRegion)\n\t\tXCTAssertNil(dateEnFail, \"This date should be not represented\")\n\n\t\tlet enRegion = Region(calendar: Calendars.gregorian, zone: Zones.europeRome, locale: Locales.english)\n\t\tlet dateEnSuccess = dateEnStr.toDate(\"dd MMM yyyy\", region: enRegion)\n\t\tXCTAssertNotNil(dateEnSuccess, \"Failed to parse with forced locale en\")\n\t}\n\n\tfunc testDateInRegion_InitWithDateAndRegion() {\n\t\tSwiftDate.defaultRegion = testRegion\n\n\t\t// test with given date in test region\n\t\tlet dateInTestRegion = DateInRegion(testDate, region: testRegion)\n\t\tXCTAssert( (dateInTestRegion.date == testDate), \"Failed to create DateInRegion with given date and test region / different date\")\n\t\tXCTAssert( (dateInTestRegion.region == testRegion), \"Failed to create DateInRegion with given date and test region / different region\")\n\n\t\t// test with current date in test region\n\t\tlet nowInTestRegion = DateInRegion(region: testRegion)\n\t\tXCTAssertInTimeIntervalRange(value: (Date().timeIntervalSince1970 - nowInTestRegion.date.timeIntervalSince1970), range: 5, \"Failed to create DateInRegion with now date and test region / date is not now\")\n\t\tXCTAssert( (nowInTestRegion.region == testRegion), \"Failed to create DateInRegion with now date and test region / different region\")\n\n\t\t// test with current date in default region\n\t\tlet nowInDefRegion = DateInRegion()\n\t\tXCTAssertInTimeIntervalRange(value: (Date().timeIntervalSince1970 - nowInDefRegion.date.timeIntervalSince1970), range: 5, \"Failed to create DateInRegion with now date and default region / date is not now\")\n\t\tXCTAssert( (nowInDefRegion.region == SwiftDate.defaultRegion), \"Failed to create DateInRegion with now date and default region / different region\")\n\n\t}\n\n\tfunc testDateInRegion_InitFromTimeInterval() {\n\t\tSwiftDate.defaultRegion = Region(calendar: Calendars.buddhist, zone: Zones.indianCocos, locale: Locales.nepaliIndia)\n\n\t\t// Init with seconds and default region at UTC timezone\n\t\tlet secsFromEpoch = DateInRegion(seconds: 10)\n\t\tXCTAssert( (secsFromEpoch.date.timeIntervalSince1970 == 10), \"Failed to create DateInRegion from epoch time and UTC region / different date\")\n\t\tXCTAssert( (secsFromEpoch.region.timeZone == Region.UTC.timeZone), \"Failed to create DateInRegion from epoch time and UTC region / different region than UTC\")\n\t\tXCTAssert( (secsFromEpoch.region.locale == Region.UTC.locale), \"Failed to create DateInRegion from epoch time and UTC region / no default's region locale\")\n\t\tXCTAssert( (secsFromEpoch.region.calendar.identifier == Region.UTC.calendar.identifier), \"Failed to create DateInRegion from epoch time and UTC region / no default's region calendar\")\n\n\t\t// Init with milliseconds and default region at UTC timezone\n\t\tlet msecsFromEpoch = DateInRegion(milliseconds: 5000)\n\t\tXCTAssert( (msecsFromEpoch.date.timeIntervalSince1970 == 5), \"Failed to create DateInRegion from epoch time and UTC region / different date\")\n\n\t\t// Init with second and given region\n\t\tlet regionBerlin = Region(calendar: Calendars.gregorian, zone: Zones.europeBerlin, locale: Locales.dutch)\n\t\tlet secsFromEpochInBerlin = DateInRegion(seconds: 56673, region: regionBerlin)\n\t\tXCTAssert( (secsFromEpochInBerlin.region == regionBerlin), \"Failed to create DateInRegion from epoch time and fixed region / different region\")\n\t\tXCTAssert( (secsFromEpochInBerlin.date.timeIntervalSince1970 == 56673), \"Failed to create DateInRegion from epoch time and fixed region / different date\")\n\n\t\t// Init with milliseconds and given region\n\t\tlet msecsFromEpochInRegion = DateInRegion(milliseconds: 5000, region: regionBerlin)\n\t\tXCTAssert( (msecsFromEpochInRegion.date.timeIntervalSince1970 == 5), \"Failed to create DateInRegion from epoch time and fixed region / different date\")\n\t\tXCTAssert( (msecsFromEpochInRegion.region == regionBerlin), \"Failed to create DateInRegion from epoch time and fixed region / different date\")\n\n\t\t// Init with fraction of seconds\n\t\tlet msecsLessThanSeconds = DateInRegion(milliseconds: 10)\n\t\tXCTAssertEqual(round(msecsLessThanSeconds.date.timeIntervalSince1970 * 1000), 10)\n\n\t}\n\n\tfunc testDateInRegion_InitFromComponents() {\n\n\t\tlet regionRome = Region(calendar: Calendars.gregorian, zone: Zones.europeRome, locale: Locales.italian)\n\t\tlet regionUTC = Region.UTC\n\n\t\tvar dComponents = DateComponents()\n\t\tdComponents.year = 1995\n\t\tdComponents.month = 6\n\t\tdComponents.day = 15\n\t\tdComponents.hour = 16\n\t\tdComponents.minute = 30\n\t\tdComponents.second = 55\n\n\t\tguard let dateInRome = DateInRegion(components: dComponents, region: regionRome) else {\n\t\t\tXCTFail(\"Failed to create DateInRegion from valid components\")\n\t\t\treturn\n\t\t}\n\n\t\t// Date must be expressed in Rome Time Zone which is UTC+1 for given date (1995/06/15)\n\t\t// So we expect the same components of the date components and given hour -1 in absolute date (UTC)\n\t\tlet validDateTime = ((dateInRome.year == dComponents.year!) &&\n\t\t\t(dateInRome.month == dComponents.month!) &&\n\t\t\t(dateInRome.day == dComponents.day!) &&\n\t\t\t(dateInRome.hour == dComponents.hour!) &&\n\t\t\t(dateInRome.minute == dComponents.minute!) &&\n\t\t\t(dateInRome.second == dComponents.second!))\n\t\tXCTAssert(validDateTime, \"Failed to create a valid DateInRegion in given region from components. One or more date components differs from original DateComponents\")\n\t\tXCTAssert( (dateInRome.date.in(region: regionUTC).hour == 14), \"DateInRegion absolute date different from expected UTC value (14:30 UTC for given date)\")\n\t}\n\n\tfunc testDateInRegion_InitFromParams() {\n\n\t\t// Init with fixed parameters in a given region\n\t\tlet regionLondon = Region(calendar: Calendars.gregorian, zone: Zones.europeLondon, locale: Locales.englishUnitedKingdom)\n\t\tlet aDayInLondon = DateInRegion(year: 2001, month: 1, day: 5, hour: 23, minute: 30, second: 0, region: regionLondon)\n\t\tlet validDateLondon = (aDayInLondon.year == 2001 && aDayInLondon.month == 1 && aDayInLondon.day == 5 && aDayInLondon.hour == 23 && aDayInLondon.minute == 30 && aDayInLondon.second == 0)\n\t\tXCTAssert(validDateLondon, \"Failed to create a valid DateInRegion from paramters. One or more date components differs from original params\")\n\n\t\t// Init with fixed parameters (and some other missings) in default region\n\t\tSwiftDate.defaultRegion = Region(calendar: Calendars.gregorian, zone: Zones.americaNewYork, locale: Locales.englishUnitedStates)\n\t\tlet aDayInNY = DateInRegion(year: 1995, month: 1, day: 5)\n\t\tlet validDateNY = (aDayInNY.year == 1995 && aDayInNY.month == 1 && aDayInNY.day == 5 && aDayInNY.hour == 0 && aDayInNY.minute == 0 && aDayInNY.second == 0)\n\t\tXCTAssert(validDateNY, \"Failed to create a valid DateInRegion from paramters and default region. One or more date components differs from original params\")\n\t\tXCTAssert( (aDayInNY.region == SwiftDate.defaultRegion), \"Failed to create a valid DateInRegion from paramters and default region.\")\n\n\t}\n\n\tfunc testDateInRegion_PastAndFuture() {\n\t\tXCTAssert( (DateInRegion.past().date == Date.distantPast), \"Failed to create DateInRegion with distant past date\")\n\t\tXCTAssert( (DateInRegion.future().date == Date.distantFuture), \"Failed to create DateInRegion with distant future date\")\n\t}\n\n\tfunc testDateInRegion_Description() {\n\t\tlet regionParis = Region(calendar: Calendars.gregorian, zone: Zones.europeParis, locale: Locales.frenchFrance)\n\t\tlet aDayInParis = DateInRegion(year: 2018, month: 5, day: 1, region: regionParis)\n\n\t\tlet descriptionDayInParis = aDayInParis.description\n\t\tlet expectedDescription = \"{abs_date='2018-04-30T22:00:00Z', rep_date='2018-05-01T00:00:00+02:00', region={calendar='gregorian', timezone='Europe/Paris', locale='fr_FR'}\"\n\t\tXCTAssert( (descriptionDayInParis == expectedDescription), \"Failed to create valid description from DateInRegion\")\n\t}\n\n\tfunc testDateInRegion_DateComponents() {\n\t\tlet regionParis = Region(calendar: Calendars.gregorian, zone: Zones.europeParis, locale: Locales.frenchFrance)\n\t\tlet aDayInParis = DateInRegion(year: 2018, month: 5, day: 1, region: regionParis)\n\n\t\t// Components of the date are expressed into the context of the region in which the date is created\n\t\tlet comps = aDayInParis.dateComponents\n\t\tlet areValidComponents = (comps.day! == 1 && comps.month! == 5 && comps.year! == 2018 && comps.hour! == 0 && comps.minute! == 0 && comps.second! == 0)\n\t\tXCTAssert(areValidComponents, \"Failed to extract valid components in the context of the region of the DateInRegion instance\")\n\t}\n\n\tfunc testDateInRegion_Hash() {\n\t\t//\t\tlet regionParis = Region(calendar: Calendars.gregorian, zone: Zones.europeParis, locale: Locales.frenchFrance)\n\t\t//\t\tlet aDayInParis = DateInRegion(year: 2018, month: 5, day: 1, region: regionParis)\n\t\t//\t\tlet sameDayInParis = DateInRegion(year: aDayInParis.year, month: aDayInParis.month, day: aDayInParis.day, region: regionParis)\n\t\t//\n\t\t//\t\tXCTAssert( (aDayInParis.hashValue != sameDayInParis.hashValue), \"Failed to extract hash value from different date with same values\")\n\t}\n\n\tfunc testDateInRegion_InitComponentsCallback() {\n\t\t// From components in fixed region\n\t\tlet regionRome = Region(calendar: Calendars.gregorian, zone: Zones.europeRome, locale: Locales.italian)\n\t\tguard let dateInRome = DateInRegion(components: {\n\t\t\t$0.year = 2001\n\t\t\t$0.month = 9\n\t\t\t$0.day = 11\n\t\t\t$0.hour = 12\n\t\t\t$0.minute = 0\n\t\t\t$0.second = 5\n\t\t}, region: regionRome) else {\n\t\t\tXCTFail(\"Failed to create valid date from components callback init\")\n\t\t\treturn\n\t\t}\n\t\tXCTValidateDateComponents(date: dateInRome, expec: ExpectedDateComponents {\n\t\t\t$0.year = 2001\n\t\t\t$0.month = 9\n\t\t\t$0.day = 11\n\t\t\t$0.hour = 12\n\t\t\t$0.minute = 0\n\t\t\t$0.second = 5\n\t\t})\n\n\t\t// From components in default region\n\t\tlet regionNY = Region(calendar: Calendars.gregorian, zone: Zones.americaNewYork, locale: Locales.english)\n\t\tSwiftDate.defaultRegion = regionNY\n\n\t\tguard let dateInNY = DateInRegion(components: {\n\t\t\t$0.year = 2001\n\t\t\t$0.month = 9\n\t\t\t$0.day = 11\n\t\t\t$0.hour = 12\n\t\t\t$0.minute = 0\n\t\t\t$0.second = 5\n\t\t}) else {\n\t\t\tXCTFail(\"Failed to create valid date from components callback init\")\n\t\t\treturn\n\t\t}\n\n\t\tlet inUTC = dateInNY.convertTo(region: Region.UTC)\n\t\tXCTValidateDateComponents(date: inUTC, expec: ExpectedDateComponents {\n\t\t\t$0.year = 2001\n\t\t\t$0.month = 9\n\t\t\t$0.day = 11\n\t\t\t$0.hour = 16\n\t\t\t$0.minute = 0\n\t\t\t$0.second = 5\n\t\t})\n\t}\n\n\tfunc testDateInRegion_ExtractComponents() {\n\t\tlet regionParis = Region(calendar: Calendars.gregorian, zone: Zones.europeParis, locale: Locales.frenchFrance)\n\t\tlet dateInParis = DateInRegion(year: 2006, month: 1, day: 1, hour: 0, minute: 45, second: 30, region: regionParis)\n\n\t\t// Validate in local region\n\t\tlet componentsOfDate = dateInParis.dateComponents\n\t\tXCTAssert((componentsOfDate.year! == 2006), \"Failed to extract local timezone date components from date / invalid year\")\n\t\tXCTAssert((componentsOfDate.month! == 1), \"Failed to extract local timezone date components from date / invalid month\")\n\t\tXCTAssert((componentsOfDate.day! == 1), \"Failed to extract local timezone date components from date / invalid day\")\n\t\tXCTAssert((componentsOfDate.hour! == 0), \"Failed to extract local timezone date components from date / invalid hour\")\n\t\tXCTAssert((componentsOfDate.minute! == 45), \"Failed to extract local timezone date components from date / invalid minute\")\n\t\tXCTAssert((componentsOfDate.second! == 30), \"Failed to extract local timezone date components from date / invalid second\")\n\n\t\t// Validate in UTC\n\t\tSwiftDate.defaultRegion = Region.UTC\n\t\tlet componentsInUTC = dateInParis.date.dateComponents // components are expressed in default zone! UTC\n\t\tXCTAssert((componentsInUTC.year! == 2005), \"Failed to extract local timezone date components from date / invalid year\")\n\t\tXCTAssert((componentsInUTC.month! == 12), \"Failed to extract local timezone date components from date / invalid month\")\n\t\tXCTAssert((componentsInUTC.day! == 31), \"Failed to extract local timezone date components from date / invalid day\")\n\t\tXCTAssert((componentsInUTC.hour! == 23), \"Failed to extract local timezone date components from date / invalid hour\")\n\t\tXCTAssert((componentsInUTC.minute! == 45), \"Failed to extract local timezone date components from date / invalid minute\")\n\t\tXCTAssert((componentsInUTC.second! == 30), \"Failed to extract local timezone date components from date / invalid second\")\n\t}\n\n\tfunc testDateInRegion_InitStringAutoFormat() {\n\t\tlet regionParis = Region(calendar: Calendars.gregorian, zone: Zones.europeParis, locale: Locales.frenchFrance)\n\n\t\t// Init with no format (yyyy-MM-dd'T'HH:mm:ssZZZZZ)\n\t\tlet expectedResult = ExpectedDateComponents {\n\t\t\t$0.year = 2015\n\t\t\t$0.month = 9\n\t\t\t$0.day = 24\n\t\t\t$0.hour = 13\n\t\t\t$0.minute = 20\n\t\t\t$0.second = 55\n\t\t}\n\n\t\tXCTValidateParse(string: \"1:20 48055000\", format: nil, region: regionParis, expec: ExpectedDateComponents {\n\t\t\t$0.hour = 13\n\t\t\t$0.minute = 20\n\t\t\t$0.msInDay = 48_056_000\n\t\t}) // h:mm A\n\t\tXCTValidateParse(string: \"après Jésus-Christ-[4]04-jeu.\", format: nil, region: regionParis, expec: ExpectedDateComponents {\n\t\t\t$0.day = 27\n\t\t\t$0.era = 1\n\t\t}) // GGGG-[W]WW-E\n\t\tXCTValidateParse(string: \"après Jésus-Christ-[4]04\", format: nil, region: regionParis, expec: ExpectedDateComponents {\n\t\t\t$0.era = 1\n\t\t}) // GGGG-[W]WW\n\t\tXCTValidateParse(string: \"2015-09-24T13:20:55+02:00\", format: nil, region: regionParis, expec: expectedResult) // yyyy-MM-dd'T'HH:mm:ssZZZZZ\n\t\tXCTValidateParse(string: \"2015-09-24T13:20:55Z\", format: nil, region: regionParis, expec: expectedResult) // yyyy'-'MM'-'dd'T'HH':'mm':'ss'Z'\n\t\tXCTValidateParse(string: \"2015-09-24T13:20:55.000Z\", format: nil, region: regionParis, expec: expectedResult) // yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'SSS'Z'\n\t\tXCTValidateParse(string: \"2015-09-24T13:20:55.000+0200\", format: nil, region: regionParis, expec: expectedResult) // yyyy-MM-dd'T'HH:mm:ss.SSSZ\n\t\tXCTValidateParse(string: \"2015-09-24\", format: nil, region: regionParis, expec: ExpectedDateComponents {\n\t\t\t$0.year = 2015\n\t\t\t$0.month = 9\n\t\t\t$0.day = 24\n\t\t}) // yyyy-MM-dd\n\t\tXCTValidateParse(string: \"2015-09-24 13:20:55\", format: nil, region: regionParis, expec: expectedResult) // yyyy-MM-dd HH:mm:ss\n\t\tXCTValidateParse(string: \"1:20:55 48055000\", format: nil, region: regionParis, expec: ExpectedDateComponents {\n\t\t\t$0.hour = 13\n\t\t\t$0.minute = 20\n\t\t\t$0.second = 55\n\t\t\t$0.msInDay = 48_056_000\n\t\t}) // h:mm:ss A\n\t\tXCTValidateParse(string: \"09/24/2015\", format: nil, region: regionParis, expec: ExpectedDateComponents {\n\t\t\t$0.month = 9\n\t\t\t$0.day = 24\n\t\t\t$0.year = 2015\n\t\t\t$0.hour = 0\n\t\t\t$0.minute = 0\n\t\t\t$0.second = 0\n\t\t}) // MM/dd/yyyy\n\t\tXCTValidateParse(string: \"septembre 24, 2015\", format: nil, region: regionParis, expec: ExpectedDateComponents {\n\t\t\t$0.month = 9\n\t\t\t$0.day = 24\n\t\t\t$0.year = 2015\n\t\t\t$0.hour = 0\n\t\t\t$0.minute = 0\n\t\t\t$0.second = 0\n\t\t}) // MMMM d, yyyy\n\t\tXCTValidateParse(string: \"002015-09-24\", format: nil, region: regionParis, expec: ExpectedDateComponents {\n\t\t\t$0.month = 9\n\t\t\t$0.day = 24\n\t\t\t$0.year = 2015\n\t\t\t$0.hour = 0\n\t\t\t$0.minute = 0\n\t\t\t$0.second = 0\n\t\t}) // yyyyyy-MM-dd\n\t\tXCTValidateParse(string: \"2015-09-24\", format: nil, region: regionParis, expec: ExpectedDateComponents {\n\t\t\t$0.month = 9\n\t\t\t$0.day = 24\n\t\t\t$0.year = 2015\n\t\t\t$0.hour = 0\n\t\t\t$0.minute = 0\n\t\t\t$0.second = 0\n\t\t}) // yyyy-MM-dd\n\t\tXCTValidateParse(string: \"2015-024\", format: nil, region: regionParis, expec: ExpectedDateComponents {\n\t\t\t$0.dayOfYear = 24\n\t\t\t$0.year = 2015\n\t\t\t$0.hour = 0\n\t\t\t$0.minute = 0\n\t\t\t$0.second = 0\n\t\t}) // yyyy-ddd\n\t\tXCTValidateParse(string: \"13:20:55.0000\", format: nil, region: regionParis, expec: ExpectedDateComponents {\n\t\t\t$0.hour = 13\n\t\t\t$0.minute = 20\n\t\t\t$0.second = 55\n\t\t}) // HH:mm:ss.SSSS\n\t\tXCTValidateParse(string: \"13:20:55\", format: nil, region: regionParis, expec: ExpectedDateComponents {\n\t\t\t$0.hour = 13\n\t\t\t$0.minute = 20\n\t\t\t$0.second = 55\n\t\t}) // HH:mm:ss\n\t\tXCTValidateParse(string: \"13:20\", format: nil, region: regionParis, expec: ExpectedDateComponents {\n\t\t\t$0.hour = 13\n\t\t\t$0.minute = 20\n\t\t}) // HH:mm\n\t\tXCTValidateParse(string: \"13\", format: nil, region: regionParis, expec: ExpectedDateComponents {\n\t\t\t$0.hour = 13\n\t\t}) // HH\n\n\t}\n}\n\npublic struct ExpectedDateComponents {\n\tvar year: Int?\n\tvar day: Int?\n\tvar dayOfYear: Int?\n\tvar month: Int?\n\tvar hour: Int?\n\tvar minute: Int?\n\tvar second: Int?\n\tvar weekOfMonth: Int?\n\tvar msInDay: Int?\n\tvar era: Int?\n\tvar monthDays: Int?\n\tvar weekOfYear: Int?\n\tvar weekdayOrdinal: Int?\n\tvar firstDayOfWeek: Int?\n\tvar lastDayOfWeek: Int?\n\tvar yearForWeekOfYear: Int?\n\tvar quarter: Int?\n\tvar DSTOffset: TimeInterval?\n\tvar nearestHour: Int?\n\n\tvar monthNameDefault: String?\n\tvar monthNameDefaultStd: String?\n\tvar monthNameShort: String?\n\tvar monthNameStandaloneShort: String?\n\tvar monthNameVeryShort: String?\n\tvar monthNameStandaloneVeryShort: String?\n\n\tvar weekday: Int?\n\tvar weekdayNameDefault: String?\n\tvar weekdayNameDefaultStd: String?\n\tvar weekdayNameShort: String?\n\tvar weekdayNameShortStd: String?\n\tvar weekdayNameVeryShort: String?\n\tvar weekdayNameVeryShortStd: String?\n\n\tvar eraNameDefault: String?\n\tvar eraNameDefaultStd: String?\n\tvar eraNameShort: String?\n\tvar eraNameShortStd: String?\n\tvar eraNameVeryShort: String?\n\tvar eraNameVeryShortStd: String?\n\n\tpublic init(_ configure: ((inout ExpectedDateComponents) -> Void)? = nil) {\n\t\tconfigure?(&self)\n\t}\n\n\tfunc validate(_ date: DateInRegion, _ origin: String) -> String? {\n\t\tif let year = self.year, year != date.year { return \"year\" }\n\t\tif let day = self.day, day != date.day { return \"day\" }\n\t\tif let month = self.month, month != date.month { return \"month\" }\n\t\tif let minute = self.minute, minute != date.minute {\n\t\t\treturn \"minute exp='\\(self.minute!)' val='\\(date.minute)' date='\\(date)' origin='\\(origin)'\"\n\t\t}\n\t\tif let second = self.second, second != date.second { return \"second\" }\n\t\tif let weekOfMonth = self.weekOfMonth, weekOfMonth != date.weekOfMonth { return \"weekOfMonth\" }\n\t\tif let dayOfYear = self.dayOfYear, dayOfYear != date.dayOfYear { return \"dayOfYear\" }\n\t\tif let era = self.era, era != date.era { return \"era\" }\n\t\tif let msInDay = self.msInDay, msInDay != date.msInDay { return \"msInDay\" }\n\t\tif let monthNameDefault = self.monthNameDefault, monthNameDefault != date.monthName(.`default`) { return \"monthName(.`default`)\" }\n\t\tif let monthNameDefaultStd = self.monthNameDefaultStd, monthNameDefaultStd != date.monthName(.defaultStandalone) { return \"monthName(.defaultStandalone)\" }\n\t\tif let monthNameShort = self.monthNameShort, monthNameShort != date.monthName(.short) { return \"monthName(.short)\" }\n\t\tif let monthNameVeryShort = self.monthNameVeryShort, monthNameVeryShort != date.monthName(.veryShort) { return \"monthName(.veryShort)\" }\n\t\tif let monthNameStandaloneShort = self.monthNameStandaloneShort, monthNameStandaloneShort != date.monthName(.standaloneShort) { return \"monthName(.standaloneShort)\" }\n\t\tif let monthNameStandaloneVeryShort = self.monthNameStandaloneVeryShort, monthNameStandaloneVeryShort != date.weekdayName(.standaloneVeryShort) { return \"weekdayName(.veryShortStandalone)\" }\n\n\t\tif let monthDays = self.monthDays, monthDays != date.monthDays { return \"monthDays\" }\n\n\t\tif let weekday = self.weekday, weekday != date.weekday { return \"weekday\" }\n\t\tif let weekdayNameDefault = self.weekdayNameDefault, weekdayNameDefault != date.weekdayName(.`default`) { return \"weekdayName(.`default`)\" }\n\t\tif let weekdayNameDefaultStd = self.weekdayNameDefaultStd, weekdayNameDefaultStd != date.weekdayName(.defaultStandalone) { return \"weekdayName(.defaultStandalone)\" }\n\t\tif let weekdayNameShort = self.weekdayNameShort, weekdayNameShort != date.weekdayName(.short) { return \"weekdayName(.short)\" }\n\t\tif let weekdayNameShortStd = self.weekdayNameShortStd, weekdayNameShortStd != date.weekdayName(.standaloneShort) { return \"weekdayName(.shortStandalone)\" }\n\t\tif let weekdayNameVeryShort = self.weekdayNameVeryShort, weekdayNameVeryShort != date.weekdayName(.veryShort) { return \"weekdayName(.veryShort)\" }\n\t\tif let weekdayNameVeryShortStd = self.weekdayNameVeryShortStd, weekdayNameVeryShortStd != date.weekdayName(.standaloneVeryShort) { return \"weekdayName(.veryShortStandalone)\" }\n\n\t\tif let weekOfYear = self.weekOfYear, weekOfYear != date.weekOfYear { return \"weekOfYear\" }\n\t\tif let weekdayOrdinal = self.weekdayOrdinal, weekdayOrdinal != date.weekdayOrdinal { return \"weekdayOrdinal\" }\n\t\tif let firstDayOfWeek = self.firstDayOfWeek, firstDayOfWeek != date.firstDayOfWeek { return \"firstDayOfWeek\" }\n\t\tif let lastDayOfWeek = self.lastDayOfWeek, lastDayOfWeek != date.lastDayOfWeek { return \"lastDayOfWeek\" }\n\t\tif let yearForWeekOfYear = self.yearForWeekOfYear, yearForWeekOfYear != date.yearForWeekOfYear { return \"yearForWeekOfYear\" }\n\t\tif let quarter = self.quarter, quarter != date.quarter { return \"quarter\" }\n\n\t\tif let eraNameDefault = self.eraNameDefault, eraNameDefault != date.eraName(.`default`) { return \"eraName(.`default`)\" }\n\t\tif let eraNameDefaultStd = self.eraNameDefaultStd, eraNameDefaultStd != date.eraName(.defaultStandalone) { return \"eraName(.defaultStandalone)\" }\n\t\tif let eraNameShort = self.eraNameShort, eraNameShort != date.eraName(.short) { return \"eraName(.short)\" }\n\t\tif let eraNameShortStd = self.eraNameShortStd, eraNameShortStd != date.eraName(.standaloneShort) { return \"eraName(.shortStandalone)\" }\n\t\tif let eraNameVeryShort = self.eraNameVeryShort, eraNameVeryShort != date.eraName(.veryShort) { return \"eraName(.veryShort)\" }\n\t\tif let eraNameVeryShortStd = self.eraNameVeryShortStd, eraNameVeryShortStd != date.eraName(.standaloneVeryShort) { return \"eraName(.veryShortStandalone)\" }\n\n\t\tif let DSTOffset = self.DSTOffset, DSTOffset != date.DSTOffset { return \"DSTOffset\" }\n\t\tif let nearestHour = self.nearestHour, nearestHour != date.nearestHour { return \"nearestHour\" }\n\n\t\treturn nil\n\t}\n}\n\nfunc XCTValidateParse(string: String, format: String?, region: Region, expec: ExpectedDateComponents) {\n\tguard let date = DateInRegion(string, format: format, region: region) else {\n\t\tXCTFail(\"Failed to parse date '\\(string)' with format: '\\(format ?? \"<AUTO>\")'\")\n\t\treturn\n\t}\n\tif let errors = expec.validate(date, string) {\n\t\tXCTFail(\"Failed to validate components of parsed date string '\\(string)' with format: '\\(format ?? \"<AUTO>\")'. One or more components differ from expected: \\(errors)\")\n\t\treturn\n\t}\n}\n\nfunc XCTValidateDateComponents(date: DateInRegion, expec: ExpectedDateComponents) {\n\tif let errors = expec.validate(date, \"\") {\n\t\tXCTFail(\"Failed to validate components of date '\\(date.description)'. One or more components differ from expected: \\(errors)\")\n\t\treturn\n\t}\n}\n"
  },
  {
    "path": "Tests/SwiftDateTests/TestFormatters.swift",
    "content": "//\n//  SwiftDate\n//  Parse, validate, manipulate, and display dates, time and timezones in Swift\n//\n//  Created by Daniele Margutti\n//   - Web: https://www.danielemargutti.com\n//   - Twitter: https://twitter.com/danielemargutti\n//   - Mail: hello@danielemargutti.com\n//\n//  Copyright © 2019 Daniele Margutti. Licensed under MIT License.\n//\n\nimport SwiftDate\nimport XCTest\n\nclass TestFormatters: XCTestCase {\n\n\tpublic func datesList() -> [String: [String: String]] {\n\t\treturn [\n\t\t\t\"2017-07-22T18:27:02+02:00\": [\n\n\t\t\t\t\"dotnet\": \"/Date(1500740822000+0200)/\",\n\t\t\t\t\"rss\": \"Sat, 22 Jul 2017 18:27:02 +0200\",\n\t\t\t\t\"rss_alt\": \"22 Jul 2017 18:27:02 +0200\",\n\t\t\t\t\"sql\": \"2017-07-22T18:27:02.000+02\",\n\t\t\t\t\"iso\": \"2017-07-22T18:27:02+02:00\"\n\t\t\t],\n\t\t\t\"2017-02-03T06:30:12+01:00\": [\n\n\t\t\t\t\"dotnet\": \"/Date(1486099812000+0100)/\",\n\t\t\t\t\"rss\": \"Fri, 3 Feb 2017 06:30:12 +0100\",\n\t\t\t\t\"rss_alt\": \"3 Feb 2017 06:30:12 +0100\",\n\t\t\t\t\"sql\": \"2017-02-03T06:30:12.000+01\",\n\t\t\t\t\"iso\": \"2017-02-03T06:30:12+01:00\"\n\t\t\t],\n\t\t\t\"2016-03-31T10:57:44+02:00\": [\n\n\t\t\t\t\"dotnet\": \"/Date(1459414664000+0200)/\",\n\t\t\t\t\"rss\": \"Thu, 31 Mar 2016 10:57:44 +0200\",\n\t\t\t\t\"rss_alt\": \"31 Mar 2016 10:57:44 +0200\",\n\t\t\t\t\"sql\": \"2016-03-31T10:57:44.000+02\",\n\t\t\t\t\"iso\": \"2016-03-31T10:57:44+02:00\"\n\t\t\t],\n\t\t\t\"2016-07-23T17:05:31+02:00\": [\n\n\t\t\t\t\"dotnet\": \"/Date(1469286331000+0200)/\",\n\t\t\t\t\"rss\": \"Sat, 23 Jul 2016 17:05:31 +0200\",\n\t\t\t\t\"rss_alt\": \"23 Jul 2016 17:05:31 +0200\",\n\t\t\t\t\"sql\": \"2016-07-23T17:05:31.000+02\",\n\t\t\t\t\"iso\": \"2016-07-23T17:05:31+02:00\"\n\t\t\t],\n\t\t\t\"2017-05-15T11:26:36+02:00\": [\n\n\t\t\t\t\"dotnet\": \"/Date(1494840396000+0200)/\",\n\t\t\t\t\"rss\": \"Mon, 15 May 2017 11:26:36 +0200\",\n\t\t\t\t\"rss_alt\": \"15 May 2017 11:26:36 +0200\",\n\t\t\t\t\"sql\": \"2017-05-15T11:26:36.000+02\",\n\t\t\t\t\"iso\": \"2017-05-15T11:26:36+02:00\"\n\t\t\t],\n\t\t\t\"2018-03-27T20:50:37+02:00\": [\n\n\t\t\t\t\"dotnet\": \"/Date(1522176637000+0200)/\",\n\t\t\t\t\"rss\": \"Tue, 27 Mar 2018 20:50:37 +0200\",\n\t\t\t\t\"rss_alt\": \"27 Mar 2018 20:50:37 +0200\",\n\t\t\t\t\"sql\": \"2018-03-27T20:50:37.000+02\",\n\t\t\t\t\"iso\": \"2018-03-27T20:50:37+02:00\"\n\t\t\t],\n\t\t\t\"2018-02-16T14:52:52+01:00\": [\n\n\t\t\t\t\"dotnet\": \"/Date(1518789172000+0100)/\",\n\t\t\t\t\"rss\": \"Fri, 16 Feb 2018 14:52:52 +0100\",\n\t\t\t\t\"rss_alt\": \"16 Feb 2018 14:52:52 +0100\",\n\t\t\t\t\"sql\": \"2018-02-16T14:52:52.000+01\",\n\t\t\t\t\"iso\": \"2018-02-16T14:52:52+01:00\"\n\t\t\t],\n\t\t\t\"2016-01-10T16:55:35+01:00\": [\n\n\t\t\t\t\"dotnet\": \"/Date(1452441335000+0100)/\",\n\t\t\t\t\"rss\": \"Sun, 10 Jan 2016 16:55:35 +0100\",\n\t\t\t\t\"rss_alt\": \"10 Jan 2016 16:55:35 +0100\",\n\t\t\t\t\"sql\": \"2016-01-10T16:55:35.000+01\",\n\t\t\t\t\"iso\": \"2016-01-10T16:55:35+01:00\"\n\t\t\t],\n\t\t\t\"2017-05-02T23:53:44+02:00\": [\n\n\t\t\t\t\"dotnet\": \"/Date(1493762024000+0200)/\",\n\t\t\t\t\"rss\": \"Tue, 2 May 2017 23:53:44 +0200\",\n\t\t\t\t\"rss_alt\": \"2 May 2017 23:53:44 +0200\",\n\t\t\t\t\"sql\": \"2017-05-02T23:53:44.000+02\",\n\t\t\t\t\"iso\": \"2017-05-02T23:53:44+02:00\"\n\t\t\t],\n\t\t\t\"2017-05-13T20:05:38+02:00\": [\n\n\t\t\t\t\"dotnet\": \"/Date(1494698738000+0200)/\",\n\t\t\t\t\"rss\": \"Sat, 13 May 2017 20:05:38 +0200\",\n\t\t\t\t\"rss_alt\": \"13 May 2017 20:05:38 +0200\",\n\t\t\t\t\"sql\": \"2017-05-13T20:05:38.000+02\",\n\t\t\t\t\"iso\": \"2017-05-13T20:05:38+02:00\"\n\t\t\t],\n\t\t\t\"2017-10-04T17:25:36+02:00\": [\n\n\t\t\t\t\"dotnet\": \"/Date(1507130736000+0200)/\",\n\t\t\t\t\"rss\": \"Wed, 4 Oct 2017 17:25:36 +0200\",\n\t\t\t\t\"rss_alt\": \"4 Oct 2017 17:25:36 +0200\",\n\t\t\t\t\"sql\": \"2017-10-04T17:25:36.000+02\",\n\t\t\t\t\"iso\": \"2017-10-04T17:25:36+02:00\"\n\t\t\t],\n\t\t\t\"2016-04-14T11:58:58+02:00\": [\n\n\t\t\t\t\"dotnet\": \"/Date(1460627938000+0200)/\",\n\t\t\t\t\"rss\": \"Thu, 14 Apr 2016 11:58:58 +0200\",\n\t\t\t\t\"rss_alt\": \"14 Apr 2016 11:58:58 +0200\",\n\t\t\t\t\"sql\": \"2016-04-14T11:58:58.000+02\",\n\t\t\t\t\"iso\": \"2016-04-14T11:58:58+02:00\"\n\t\t\t],\n\t\t\t\"2016-10-03T13:15:37+02:00\": [\n\n\t\t\t\t\"dotnet\": \"/Date(1475493337000+0200)/\",\n\t\t\t\t\"rss\": \"Mon, 3 Oct 2016 13:15:37 +0200\",\n\t\t\t\t\"rss_alt\": \"3 Oct 2016 13:15:37 +0200\",\n\t\t\t\t\"sql\": \"2016-10-03T13:15:37.000+02\",\n\t\t\t\t\"iso\": \"2016-10-03T13:15:37+02:00\"\n\t\t\t],\n\t\t\t\"2015-08-23T16:28:34+02:00\": [\n\n\t\t\t\t\"dotnet\": \"/Date(1440340114000+0200)/\",\n\t\t\t\t\"rss\": \"Sun, 23 Aug 2015 16:28:34 +0200\",\n\t\t\t\t\"rss_alt\": \"23 Aug 2015 16:28:34 +0200\",\n\t\t\t\t\"sql\": \"2015-08-23T16:28:34.000+02\",\n\t\t\t\t\"iso\": \"2015-08-23T16:28:34+02:00\"\n\t\t\t],\n\t\t\t\"2016-09-04T19:52:29+02:00\": [\n\n\t\t\t\t\"dotnet\": \"/Date(1473011549000+0200)/\",\n\t\t\t\t\"rss\": \"Sun, 4 Sep 2016 19:52:29 +0200\",\n\t\t\t\t\"rss_alt\": \"4 Sep 2016 19:52:29 +0200\",\n\t\t\t\t\"sql\": \"2016-09-04T19:52:29.000+02\",\n\t\t\t\t\"iso\": \"2016-09-04T19:52:29+02:00\"\n\t\t\t],\n\t\t\t\"2016-05-09T14:09:55+02:00\": [\n\n\t\t\t\t\"dotnet\": \"/Date(1462795795000+0200)/\",\n\t\t\t\t\"rss\": \"Mon, 9 May 2016 14:09:55 +0200\",\n\t\t\t\t\"rss_alt\": \"9 May 2016 14:09:55 +0200\",\n\t\t\t\t\"sql\": \"2016-05-09T14:09:55.000+02\",\n\t\t\t\t\"iso\": \"2016-05-09T14:09:55+02:00\"\n\t\t\t],\n\t\t\t\"2016-05-11T02:58:47+02:00\": [\n\n\t\t\t\t\"dotnet\": \"/Date(1462928327000+0200)/\",\n\t\t\t\t\"rss\": \"Wed, 11 May 2016 02:58:47 +0200\",\n\t\t\t\t\"rss_alt\": \"11 May 2016 02:58:47 +0200\",\n\t\t\t\t\"sql\": \"2016-05-11T02:58:47.000+02\",\n\t\t\t\t\"iso\": \"2016-05-11T02:58:47+02:00\"\n\t\t\t],\n\t\t\t\"2017-04-08T01:49:29+02:00\": [\n\n\t\t\t\t\"dotnet\": \"/Date(1491608969000+0200)/\",\n\t\t\t\t\"rss\": \"Sat, 8 Apr 2017 01:49:29 +0200\",\n\t\t\t\t\"rss_alt\": \"8 Apr 2017 01:49:29 +0200\",\n\t\t\t\t\"sql\": \"2017-04-08T01:49:29.000+02\",\n\t\t\t\t\"iso\": \"2017-04-08T01:49:29+02:00\"\n\t\t\t],\n\t\t\t\"2017-03-14T04:06:47+01:00\": [\n\n\t\t\t\t\"dotnet\": \"/Date(1489460807000+0100)/\",\n\t\t\t\t\"rss\": \"Tue, 14 Mar 2017 04:06:47 +0100\",\n\t\t\t\t\"rss_alt\": \"14 Mar 2017 04:06:47 +0100\",\n\t\t\t\t\"sql\": \"2017-03-14T04:06:47.000+01\",\n\t\t\t\t\"iso\": \"2017-03-14T04:06:47+01:00\"\n\t\t\t],\n\t\t\t\"2016-05-31T14:31:50+02:00\": [\n\n\t\t\t\t\"dotnet\": \"/Date(1464697910000+0200)/\",\n\t\t\t\t\"rss\": \"Tue, 31 May 2016 14:31:50 +0200\",\n\t\t\t\t\"rss_alt\": \"31 May 2016 14:31:50 +0200\",\n\t\t\t\t\"sql\": \"2016-05-31T14:31:50.000+02\",\n\t\t\t\t\"iso\": \"2016-05-31T14:31:50+02:00\"\n\t\t\t],\n\t\t\t\"2015-09-22T08:28:16+02:00\": [\n\n\t\t\t\t\"dotnet\": \"/Date(1442903296000+0200)/\",\n\t\t\t\t\"rss\": \"Tue, 22 Sep 2015 08:28:16 +0200\",\n\t\t\t\t\"rss_alt\": \"22 Sep 2015 08:28:16 +0200\",\n\t\t\t\t\"sql\": \"2015-09-22T08:28:16.000+02\",\n\t\t\t\t\"iso\": \"2015-09-22T08:28:16+02:00\"\n\t\t\t],\n\t\t\t\"2016-08-11T06:53:56+02:00\": [\n\n\t\t\t\t\"dotnet\": \"/Date(1470891236000+0200)/\",\n\t\t\t\t\"rss\": \"Thu, 11 Aug 2016 06:53:56 +0200\",\n\t\t\t\t\"rss_alt\": \"11 Aug 2016 06:53:56 +0200\",\n\t\t\t\t\"sql\": \"2016-08-11T06:53:56.000+02\",\n\t\t\t\t\"iso\": \"2016-08-11T06:53:56+02:00\"\n\t\t\t],\n\t\t\t\"2018-03-27T19:49:32+02:00\": [\n\n\t\t\t\t\"dotnet\": \"/Date(1522172972000+0200)/\",\n\t\t\t\t\"rss\": \"Tue, 27 Mar 2018 19:49:32 +0200\",\n\t\t\t\t\"rss_alt\": \"27 Mar 2018 19:49:32 +0200\",\n\t\t\t\t\"sql\": \"2018-03-27T19:49:32.000+02\",\n\t\t\t\t\"iso\": \"2018-03-27T19:49:32+02:00\"\n\t\t\t],\n\t\t\t\"2017-03-04T21:04:51+01:00\": [\n\n\t\t\t\t\"dotnet\": \"/Date(1488657891000+0100)/\",\n\t\t\t\t\"rss\": \"Sat, 4 Mar 2017 21:04:51 +0100\",\n\t\t\t\t\"rss_alt\": \"4 Mar 2017 21:04:51 +0100\",\n\t\t\t\t\"sql\": \"2017-03-04T21:04:51.000+01\",\n\t\t\t\t\"iso\": \"2017-03-04T21:04:51+01:00\"\n\t\t\t],\n\t\t\t\"2016-09-19T10:22:17+02:00\": [\n\n\t\t\t\t\"dotnet\": \"/Date(1474273337000+0200)/\",\n\t\t\t\t\"rss\": \"Mon, 19 Sep 2016 10:22:17 +0200\",\n\t\t\t\t\"rss_alt\": \"19 Sep 2016 10:22:17 +0200\",\n\t\t\t\t\"sql\": \"2016-09-19T10:22:17.000+02\",\n\t\t\t\t\"iso\": \"2016-09-19T10:22:17+02:00\"\n\t\t\t],\n\t\t\t\"2016-01-09T08:24:32+01:00\": [\n\n\t\t\t\t\"dotnet\": \"/Date(1452324272000+0100)/\",\n\t\t\t\t\"rss\": \"Sat, 9 Jan 2016 08:24:32 +0100\",\n\t\t\t\t\"rss_alt\": \"9 Jan 2016 08:24:32 +0100\",\n\t\t\t\t\"sql\": \"2016-01-09T08:24:32.000+01\",\n\t\t\t\t\"iso\": \"2016-01-09T08:24:32+01:00\"\n\t\t\t],\n\t\t\t\"2018-05-16T02:33:15+02:00\": [\n\n\t\t\t\t\"dotnet\": \"/Date(1526430795000+0200)/\",\n\t\t\t\t\"rss\": \"Wed, 16 May 2018 02:33:15 +0200\",\n\t\t\t\t\"rss_alt\": \"16 May 2018 02:33:15 +0200\",\n\t\t\t\t\"sql\": \"2018-05-16T02:33:15.000+02\",\n\t\t\t\t\"iso\": \"2018-05-16T02:33:15+02:00\"\n\t\t\t],\n\t\t\t\"2016-11-09T14:42:29+01:00\": [\n\n\t\t\t\t\"dotnet\": \"/Date(1478698949000+0100)/\",\n\t\t\t\t\"rss\": \"Wed, 9 Nov 2016 14:42:29 +0100\",\n\t\t\t\t\"rss_alt\": \"9 Nov 2016 14:42:29 +0100\",\n\t\t\t\t\"sql\": \"2016-11-09T14:42:29.000+01\",\n\t\t\t\t\"iso\": \"2016-11-09T14:42:29+01:00\"\n\t\t\t],\n\t\t\t\"2017-09-18T05:07:13+02:00\": [\n\n\t\t\t\t\"dotnet\": \"/Date(1505704033000+0200)/\",\n\t\t\t\t\"rss\": \"Mon, 18 Sep 2017 05:07:13 +0200\",\n\t\t\t\t\"rss_alt\": \"18 Sep 2017 05:07:13 +0200\",\n\t\t\t\t\"sql\": \"2017-09-18T05:07:13.000+02\",\n\t\t\t\t\"iso\": \"2017-09-18T05:07:13+02:00\"\n\t\t\t],\n\t\t\t\"2016-11-08T19:03:38+01:00\": [\n\n\t\t\t\t\"dotnet\": \"/Date(1478628218000+0100)/\",\n\t\t\t\t\"rss\": \"Tue, 8 Nov 2016 19:03:38 +0100\",\n\t\t\t\t\"rss_alt\": \"8 Nov 2016 19:03:38 +0100\",\n\t\t\t\t\"sql\": \"2016-11-08T19:03:38.000+01\",\n\t\t\t\t\"iso\": \"2016-11-08T19:03:38+01:00\"\n\t\t\t],\n\t\t\t\"2017-08-25T04:33:32+02:00\": [\n\n\t\t\t\t\"dotnet\": \"/Date(1503628412000+0200)/\",\n\t\t\t\t\"rss\": \"Fri, 25 Aug 2017 04:33:32 +0200\",\n\t\t\t\t\"rss_alt\": \"25 Aug 2017 04:33:32 +0200\",\n\t\t\t\t\"sql\": \"2017-08-25T04:33:32.000+02\",\n\t\t\t\t\"iso\": \"2017-08-25T04:33:32+02:00\"\n\t\t\t],\n\t\t\t\"2016-06-07T15:10:47+02:00\": [\n\n\t\t\t\t\"dotnet\": \"/Date(1465305047000+0200)/\",\n\t\t\t\t\"rss\": \"Tue, 7 Jun 2016 15:10:47 +0200\",\n\t\t\t\t\"rss_alt\": \"7 Jun 2016 15:10:47 +0200\",\n\t\t\t\t\"sql\": \"2016-06-07T15:10:47.000+02\",\n\t\t\t\t\"iso\": \"2016-06-07T15:10:47+02:00\"\n\t\t\t],\n\t\t\t\"2016-12-02T14:54:10+01:00\": [\n\n\t\t\t\t\"dotnet\": \"/Date(1480686850000+0100)/\",\n\t\t\t\t\"rss\": \"Fri, 2 Dec 2016 14:54:10 +0100\",\n\t\t\t\t\"rss_alt\": \"2 Dec 2016 14:54:10 +0100\",\n\t\t\t\t\"sql\": \"2016-12-02T14:54:10.000+01\",\n\t\t\t\t\"iso\": \"2016-12-02T14:54:10+01:00\"\n\t\t\t],\n\t\t\t\"2016-02-11T11:48:21+01:00\": [\n\n\t\t\t\t\"dotnet\": \"/Date(1455187701000+0100)/\",\n\t\t\t\t\"rss\": \"Thu, 11 Feb 2016 11:48:21 +0100\",\n\t\t\t\t\"rss_alt\": \"11 Feb 2016 11:48:21 +0100\",\n\t\t\t\t\"sql\": \"2016-02-11T11:48:21.000+01\",\n\t\t\t\t\"iso\": \"2016-02-11T11:48:21+01:00\"\n\t\t\t],\n\t\t\t\"2018-01-23T17:44:12+01:00\": [\n\n\t\t\t\t\"dotnet\": \"/Date(1516725852000+0100)/\",\n\t\t\t\t\"rss\": \"Tue, 23 Jan 2018 17:44:12 +0100\",\n\t\t\t\t\"rss_alt\": \"23 Jan 2018 17:44:12 +0100\",\n\t\t\t\t\"sql\": \"2018-01-23T17:44:12.000+01\",\n\t\t\t\t\"iso\": \"2018-01-23T17:44:12+01:00\"\n\t\t\t],\n\t\t\t\"2016-05-09T22:11:28+02:00\": [\n\n\t\t\t\t\"dotnet\": \"/Date(1462824688000+0200)/\",\n\t\t\t\t\"rss\": \"Mon, 9 May 2016 22:11:28 +0200\",\n\t\t\t\t\"rss_alt\": \"9 May 2016 22:11:28 +0200\",\n\t\t\t\t\"sql\": \"2016-05-09T22:11:28.000+02\",\n\t\t\t\t\"iso\": \"2016-05-09T22:11:28+02:00\"\n\t\t\t],\n\t\t\t\"2015-06-27T04:15:55+02:00\": [\n\n\t\t\t\t\"dotnet\": \"/Date(1435371355000+0200)/\",\n\t\t\t\t\"rss\": \"Sat, 27 Jun 2015 04:15:55 +0200\",\n\t\t\t\t\"rss_alt\": \"27 Jun 2015 04:15:55 +0200\",\n\t\t\t\t\"sql\": \"2015-06-27T04:15:55.000+02\",\n\t\t\t\t\"iso\": \"2015-06-27T04:15:55+02:00\"\n\t\t\t],\n\t\t\t\"2017-08-05T16:04:03+02:00\": [\n\n\t\t\t\t\"dotnet\": \"/Date(1501941843000+0200)/\",\n\t\t\t\t\"rss\": \"Sat, 5 Aug 2017 16:04:03 +0200\",\n\t\t\t\t\"rss_alt\": \"5 Aug 2017 16:04:03 +0200\",\n\t\t\t\t\"sql\": \"2017-08-05T16:04:03.000+02\",\n\t\t\t\t\"iso\": \"2017-08-05T16:04:03+02:00\"\n\t\t\t],\n\t\t\t\"2015-11-19T22:20:40+01:00\": [\n\n\t\t\t\t\"dotnet\": \"/Date(1447968040000+0100)/\",\n\t\t\t\t\"rss\": \"Thu, 19 Nov 2015 22:20:40 +0100\",\n\t\t\t\t\"rss_alt\": \"19 Nov 2015 22:20:40 +0100\",\n\t\t\t\t\"sql\": \"2015-11-19T22:20:40.000+01\",\n\t\t\t\t\"iso\": \"2015-11-19T22:20:40+01:00\"\n\t\t\t],\n\t\t\t\"2017-06-20T14:49:19+02:00\": [\n\n\t\t\t\t\"dotnet\": \"/Date(1497962959000+0200)/\",\n\t\t\t\t\"rss\": \"Tue, 20 Jun 2017 14:49:19 +0200\",\n\t\t\t\t\"rss_alt\": \"20 Jun 2017 14:49:19 +0200\",\n\t\t\t\t\"sql\": \"2017-06-20T14:49:19.000+02\",\n\t\t\t\t\"iso\": \"2017-06-20T14:49:19+02:00\"\n\t\t\t]\n\t\t]\n\t}\n\n\t/*public func testGenerateSomeRandomDates() {\n\t\tvar total = \"\"\n\t\tlet upperBound = DateInRegion()\n\t\tlet lowerBound = (upperBound - 3.years)\n\t\tlet randomDates = DateInRegion.randomDates(count: 40, between: lowerBound, and: upperBound)\n\t\trandomDates.forEach {\n\t\t\tlet adjustedDateNoMS = $0.toISO().toISODate()!\n\t\t\ttotal += \"\\\"\\($0.toISO())\\\" : [\\n\\t\"\n\t\t\ttotal += \"\\n\\t\" + \"\\\"dotnet\\\": \\\"\\(adjustedDateNoMS.toDotNET())\\\",\"\n\t\t\ttotal += \"\\n\\t\" + \"\\\"rss\\\": \\\"\\(adjustedDateNoMS.toRSS(alt: false))\\\",\"\n\t\t\ttotal += \"\\n\\t\" + \"\\\"rss_alt\\\": \\\"\\(adjustedDateNoMS.toRSS(alt: true))\\\",\"\n\t\t\ttotal += \"\\n\\t\" + \"\\\"sql\\\": \\\"\\(adjustedDateNoMS.toSQL())\\\",\"\n\t\t\ttotal += \"\\n\\t\" + \"\\\"iso\\\": \\\"\\(adjustedDateNoMS.toISO())\\\"\"\n\t\t\ttotal += \"\\n],\\n\"\n\t\t}\n\t\tprint(\"\\(total)\")\n\t}*/\n\n\tpublic func testDotNETFormatter() {\n\t\tSwiftDate.defaultRegion = Region(calendar: Calendars.gregorian, zone: Zones.europeRome, locale: Locales.english)\n\t\tdatesList().forEach {\n\t\t\tXCTTestFormatterParser(dateStr: $0.key, expected: $0.value[\"dotnet\"]!, type: \"dotnet\", region: SwiftDate.defaultRegion)\n\t\t}\n\t}\n\n\tpublic func testRSSFormatter() {\n\t\tSwiftDate.defaultRegion = Region(calendar: Calendars.gregorian, zone: Zones.europeRome, locale: Locales.english)\n\t\tdatesList().forEach {\n\t\t\tXCTTestFormatterParser(dateStr: $0.key, expected: $0.value[\"rss\"]!, type: \"rss\", region: SwiftDate.defaultRegion)\n\t\t}\n\t}\n\n\tpublic func testRSSAltFormatter() {\n\t\tSwiftDate.defaultRegion = Region(calendar: Calendars.gregorian, zone: Zones.europeRome, locale: Locales.english)\n\t\tdatesList().forEach {\n\t\t\tXCTTestFormatterParser(dateStr: $0.key, expected: $0.value[\"rss_alt\"]!, type: \"rss_alt\", region: SwiftDate.defaultRegion)\n\t\t}\n\t}\n\n\tpublic func testSQLFormatter() {\n\t\tSwiftDate.defaultRegion = Region(calendar: Calendars.gregorian, zone: Zones.europeRome, locale: Locales.english)\n\t\tdatesList().forEach {\n\t\t\tXCTTestFormatterParser(dateStr: $0.key, expected: $0.value[\"sql\"]!, type: \"sql\", region: SwiftDate.defaultRegion)\n\t\t}\n\t}\n\n\tpublic func testISOFormatter() {\n\t\tSwiftDate.defaultRegion = Region(calendar: Calendars.gregorian, zone: Zones.europeRome, locale: Locales.english)\n\t\tdatesList().forEach {\n\t\t\tXCTTestFormatterParser(dateStr: $0.key, expected: $0.value[\"iso\"]!, type: \"iso\", region: SwiftDate.defaultRegion)\n\t\t}\n\t}\n\n\tfunc XCTTestFormatterParser(dateStr: String, expected: String, type: String, region: Region = SwiftDate.defaultRegion) {\n\t\tguard let srcDate = dateStr.toDate(\"yyyy-MM-dd'T'HH:mm:ssZZZZZ\", region: SwiftDate.defaultRegion) else {\n\t\t\tXCTFail(\"Failed to correctly parse date: '\\(dateStr)'\")\n\t\t\treturn\n\t\t}\n\n\t\tlet dateAsStr: String = dateToString(date: srcDate, format: type)\n\t\tXCTAssert( (dateAsStr == expected),\n\t\t\t\t   \"Failed to convert date '\\(srcDate.description)' to \\(type) format. Expected '\\(expected)', got '\\(dateAsStr)'\")\n\n\t\tguard let decodedSrcDate = stringToDate(string: dateAsStr, format: type, region: region) else {\n\t\t\tXCTFail(\"Failed to convert date string to date of type \\(type): \\(dateAsStr)\")\n\t\t\treturn\n\t\t}\n\t\tXCTAssert( (srcDate == decodedSrcDate),\n\t\t\t\t   \"Failed to validate formatter. Got '\\(decodedSrcDate)' expecting '\\(srcDate)'\")\n\t}\n\n\tfunc dateToString(date srcDate: DateInRegion, format: String) -> String {\n\t\tswitch format {\n\t\tcase \"dotnet\":\treturn srcDate.toDotNET()\n\t\tcase \"rss\":\t\treturn srcDate.toRSS(alt: false)\n\t\tcase \"rss_alt\":\treturn srcDate.toRSS(alt: true)\n\t\tcase \"sql\":\t\treturn srcDate.toSQL()\n\t\tcase \"iso\":\t\treturn srcDate.toISO()\n\t\tdefault:\n\t\t\tXCTFail(\"Unsupported type: \\(format)\")\n\t\t\treturn \"\"\n\t\t}\n\t}\n\n\tfunc stringToDate(string: String, format: String, region: Region) -> DateInRegion? {\n\t\tswitch format {\n\t\tcase \"dotnet\":\treturn string.toDotNETDate(region: region)\n\t\tcase \"rss\":\t\treturn string.toRSSDate(alt: false, region: region)\n\t\tcase \"rss_alt\":\treturn string.toRSSDate(alt: true, region: region)\n\t\tcase \"sql\":\t\treturn string.toSQLDate(region: region)\n\t\tcase \"iso\":\t\treturn string.toISODate(nil, region: region)\n\t\tdefault:\n\t\t\tXCTFail(\"Unsupported type: \\(format)\")\n\t\t\treturn nil\n\t\t}\n\t}\n\n\tfunc testTZInISOParser() {\n\t\tlet gmtTimezone = \"2017-08-05T16:04:03\".toISODate(region: Region.ISO)! // force timezone\n\t\tlet timezoneInDate = \"2017-08-05T16:04:03+02:00\".toISODate()! // parse from iso\n\t\tXCTAssert(gmtTimezone.region.timeZone.secondsFromGMT() == 0, \"ISO Date does not contains timezone (is gmt)\")\n\t\tXCTAssert(timezoneInDate.region.timeZone.secondsFromGMT() == 7200, \"ISO Date does not contains timezone (is gmt)\")\n\t}\n\n\tfunc testRSSAltLocale() {\n\t\tlet regionAny = Region(calendar: Calendars.buddhist, zone: Zones.indianMayotte, locale: Locales.italian)\n\t\t// region must not use passed locale to perform parsing but only locale as final output\n\t\tlet date1 = \"Tue, 20 Jun 2017 14:49:19 +0200\".toRSSDate(alt: false, region: regionAny)\n\t\tlet date2 = \"20 Jun 2017 14:49:19 +0200\".toRSSDate(alt: true, region: regionAny)\n\t\tXCTAssertNotNil(date1, \"Wrong RSS Date region\")\n\t\tXCTAssertNotNil(date2, \"Wrong RSS Alt Date region\")\n\t}\n\n\tfunc testTimeInterval_Clock() {\n\t\tlet value = (2.hours + 5.minutes).timeInterval.toClock()\n\t\tXCTAssert(value == \"02:05:00\", \"Failed to format clock\")\n\t\tlet value2 = (4.minutes + 50.minutes).timeInterval.toClock(zero: DateComponentsFormatter.ZeroFormattingBehavior.dropAll)\n\t\tXCTAssert(value2 == \"54\", \"Failed to format clock\")\n\t}\n\n\tfunc testFormatterCustom() {\n\t\tlet rome = Region(calendar: Calendars.gregorian, zone: Zones.europeRome, locale: Locales.italian)\n\t\tlet date = DateInRegion(year: 2015, month: 1, day: 15, hour: 20, minute: 00, second: 5, nanosecond: 0, region: rome)\n\t\tlet fixedFormat = date.toFormat(\"MMM dd yyyy\", locale: Locales.english)\n\t\tlet regionFormat = date.toFormat(\"MMM dd yyyy\")\n\t\tXCTAssert( fixedFormat == \"Jan 15 2015\", \"Failed to format with fixed locale\")\n\t\tXCTAssert( regionFormat == \"gen 15 2015\", \"Failed to format with standard locale\")\n\t}\n\n\tfunc testTimeInterval_FormatterUnits() {\n\t\t// for TimeInterval\n\t\tlet values = (36.hours + 2.days + 1.weeks).timeInterval.toUnits([.day, .hour])\n\t\tXCTAssert(values[.hour] == 12 && values[.day] == 10, \"Failed to extract day components\")\n\n\t\tlet singleValue = (1.days).timeInterval.toUnit(.minute)\n\t\tXCTAssert(singleValue == 1440, \"Failed to extract single date component\")\n\t}\n\n\tfunc testTimeInterval_Formatter() {\n\t\tlet value1 = (2.hours + 5.minutes + 32.seconds).timeInterval.toString(options: {\n\t\t\t$0.unitsStyle = .full\n\t\t\t$0.collapsesLargestUnit = false\n\t\t\t$0.allowsFractionalUnits = true\n\t\t\t$0.locale = Locales.english\n\t\t})\n\t\tlet value2 = (5.hours + 2.days).timeInterval.toString(options: {\n\t\t\t$0.unitsStyle = .abbreviated\n\t\t\t$0.locale = Locales.english\n\t\t})\n\t\tXCTAssert(value1 == \"2 hours, 5 minutes, 32 seconds\", \"Failed to format interval to string\")\n\t\tXCTAssert(value2 == \"2d 5h\", \"Failed to format interval to string\")\n\t}\n/*\n\tfunc testColloquialFormatter() {\n\t\tlet ago5Mins = DateInRegion() - 5.minutes\n\t\tlet r1 = ago5Mins.toRelative(style: RelativeFormatter.defaultStyle(), locale: Locales.italian)\n\t\tlet r2 = ago5Mins.toRelative(style: RelativeFormatter.twitterStyle(), locale: Locales.italian)\n\t\tXCTAssert(r1 == \"5 minuti fa\", \"Failed to use colloquial formatter\")\n\t\tXCTAssert(r2 == \"5 min fa\", \"Failed to use colloquial formatter\")\n\n\t\tlet justNow = DateInRegion() - 10.seconds\n\t\tlet r3 = justNow.toRelative(style: RelativeFormatter.defaultStyle(), locale: Locales.italian)\n\t\tXCTAssert(r3 == \"ora\", \"Failed to use colloquial formatter\")\n\n\t\tlet justNow2 = DateInRegion() - 2.hours\n\t\tlet r4 = justNow2.toRelative(style: RelativeFormatter.twitterStyle(), locale: Locales.italian)\n\t\tXCTAssert(r4 == \"2h fa\", \"Failed to use colloquial formatter\")\n\n\t\tlet justNow3 = DateInRegion() - 1.minutes\n\t\tlet r5 = justNow3.toRelative(style: RelativeFormatter.twitterStyle(), locale: Locales.english)\n\t\tXCTAssert(r5 == \"1 min. ago\", \"Failed to use colloquial formatter\")\n\n\t\tlet justNow4 = DateInRegion() - 51.seconds\n\t\tlet r6 = justNow4.toRelative(style: RelativeFormatter.twitterStyle(), locale: Locales.english)\n\t\tXCTAssert(r6 == \"1 min. ago\", \"Failed to use colloquial formatter\")\n\t}\n*/\n\tfunc testISOParser() {\n\n\t\tfunc testISO(_ src: String, _ exp: String) {\n\t\t\tlet output = src.toISODate()?.toISO()\n\t\t\tXCTAssert(output == exp, \"Failed to parse ISO '\\(src)'\")\n\t\t}\n\n\t\ttestISO(\"20060506\", \"2006-05-06T00:00:00Z\") // YYYYMMDD\n\t\ttestISO(\"2001-12-14\", \"2001-12-14T00:00:00Z\") // YYYY-MM-DD\n\t\ttestISO(\"2001-06\", \"2001-06-01T00:00:00Z\") // YYYY-MM\n\t\ttestISO(\"2015\", \"2015-01-01T00:00:00Z\") // YYYY\n\t\t//testISO(\"15\", \"1518-01-01T00:00:00Z\") // YY\n\n\t\t// Implied century: YY is 00-99\n\t\ttestISO(\"150603\", \"2015-06-03T00:00:00Z\") // YYMMDD\n\t\ttestISO(\"161201\", \"2016-12-01T00:00:00Z\") // YY-MM-DD\n\n\t\t// Implied year\n\t\ttestISO(\"--1215\", \"\\(Date().year)-12-15T00:00:00Z\") // --MMDD\n\t\ttestISO(\"--12-15\", \"\\(Date().year)-12-15T00:00:00Z\") // --MM-DD\n\t\ttestISO(\"--12\", \"\\(Date().year)-12-01T00:00:00Z\") // --MM\n\n\t\t// Implied year and month\n\t\ttestISO(\"---15\", \"\\(Date().year)-\\(String(format: \"%02d\", Date().month))-15T00:00:00Z\") // ---DD\n\n\t\t// Ordinal dates: DDD is the number of the day in the year (1-366)\n\t\ttestISO(\"2015010\", \"2015-01-10T00:00:00Z\") // YYYYDDD (DDD is the number of the day of the year)\n\t\ttestISO(\"2015032\", \"2015-02-01T00:00:00Z\") // YYYY-DDD\n\t\ttestISO(\"15-032\", \"2015-02-01T00:00:00Z\") // YY-DDD\n\t\ttestISO(\"15032\", \"2015-02-01T00:00:00Z\") // YYDDD\n\t\ttestISO(\"-032\", \"\\(Date().year)-02-01T00:00:00Z\") // -DDD\n\n\t\t// Week-based dates: ww is the number of the week, and d is the number (1-7) of the day in the week\n\t\ttestISO(\"2018W012\", \"2018-01-02T00:00:00Z\") // yyyyWwwd\n\t\ttestISO(\"2018-W01-2\", \"2018-01-02T00:00:00Z\") // yyyy-Www-d\n\t\ttestISO(\"2018-W01\", \"2017-12-31T00:00:00Z\") // yyyyWww\n\t\ttestISO(\"2018-W01\", \"2017-12-31T00:00:00Z\") // yyyy-Www\n\t\ttestISO(\"18-W01\", \"2017-12-31T00:00:00Z\") // yyWwwd\n\t\ttestISO(\"18-W01-2\", \"2018-01-02T00:00:00Z\") // yy-Www-d\n\t\ttestISO(\"18W01\", \"2017-12-31T00:00:00Z\") // yyWww\n\t\ttestISO(\"18-W01\", \"2017-12-31T00:00:00Z\") // yy-Www\n\n\t\t// Date\n\t\ttestISO(\"1970-01-01\", \"1970-01-01T00:00:00Z\")\n\t\ttestISO(\"2001\", \"2001-01-01T00:00:00Z\")\n\t\ttestISO(\"2001-02-03\", \"2001-02-03T00:00:00Z\")\n\t\ttestISO(\"2001-02-03T04:05\", \"2001-02-03T04:05:00Z\")\n\t\ttestISO(\"2001-02-03T04:05:06.007-06:30\", \"2001-02-03T04:05:06-06:30\")\n\t}\n}\n"
  },
  {
    "path": "Tests/SwiftDateTests/TestRegion.swift",
    "content": "//\n//  SwiftDate\n//  Parse, validate, manipulate, and display dates, time and timezones in Swift\n//\n//  Created by Daniele Margutti\n//   - Web: https://www.danielemargutti.com\n//   - Twitter: https://twitter.com/danielemargutti\n//   - Mail: hello@danielemargutti.com\n//\n//  Copyright © 2019 Daniele Margutti. Licensed under MIT License.\n//\n\nimport SwiftDate\nimport XCTest\n\nclass TestRegion: XCTestCase {\n    \n    func test() {\n        let ago5Mins = DateInRegion() - 5.minutes\n        let x = ago5Mins.toRelative(since: nil, dateTimeStyle: .named, unitsStyle: .short)\n        print(x)\n    }\n\n\tfunc testRegionInit() {\n\n\t\tSwiftDate.defaultRegion = Region(calendar: Calendars.gregorian, zone: Zones.gmt, locale: Locales.english)\n\n\t\t// UTC Region\n\t\tXCTAssert( (Region.UTC.timeZone.identifier == Zones.gmt.toTimezone().identifier), \"Failed to create UTC region\")\n\t\tXCTAssert( (Region.UTC.calendar.identifier == Calendar.autoupdatingCurrent.identifier), \"Failed to inherith the appropriate calendar fromd default region\")\n\t\tXCTAssert( (Region.UTC.locale.identifier == Locale.autoupdatingCurrent.identifier), \"Failed to inherith the appropriate locale fromd default region\")\n\n\t\t// New Region\n\t\tlet region1 = Region(calendar: Calendars.gregorian, zone: Zones.europeRome, locale: Locales.italian)\n\t\tXCTAssert( (region1.timeZone.identifier == \"Europe/Rome\"), \"Failed to set region's zone\")\n\t\tXCTAssert( (region1.calendar.identifier == Calendar.Identifier.gregorian), \"Failed to set region's calendar\")\n\t\tXCTAssert( (region1.locale.identifier == \"it\"), \"Failed to set region's locale\")\n\n\t\t// Current Region\n\t\tlet currentRegion = Region.current\n\t\tXCTAssert( (currentRegion.calendar.identifier == Calendar.current.identifier), \"Failed to set current's region calendar\")\n\t\tXCTAssert( (currentRegion.timeZone.identifier == TimeZone.current.identifier), \"Failed to set current's region timezone\")\n\t\tXCTAssert( (currentRegion.locale.identifier == Locale.current.identifier), \"Failed to set current's region locale\")\n\n\t\t// Default region in another locale and calendar\n\t\tlet modifiedDefaultRegion = Region.currentIn(locale: Locales.japanese, calendar: Calendars.japanese)\n\t\tXCTAssert( (modifiedDefaultRegion.locale.identifier == Locale(identifier: \"ja\").identifier), \"Failed to create new region from default with modified locale\")\n\t\tXCTAssert( (modifiedDefaultRegion.calendar.identifier == Calendar(identifier: Calendar.Identifier.japanese).identifier), \"Failed to create new region from default with modified calendar\")\n\n\t\t// Default region in another locale and calendar, no action\n\t\tlet unmodifiedDefaultRegion = Region.currentIn()\n\t\tXCTAssert( (unmodifiedDefaultRegion == SwiftDate.defaultRegion), \"currentIn() with no parameters should return unmodified default region\")\n\n\t\t// Default region in another locale and calendar, only calendar\n\t\tlet modifiedCalendarDefaultRegion = Region.currentIn(calendar: Calendars.buddhist)\n\t\tXCTAssert( (modifiedCalendarDefaultRegion.calendar.identifier == Calendar.Identifier.buddhist), \"currentIn() with modified calendar only does not work\")\n\t\tXCTAssert( (modifiedCalendarDefaultRegion.locale == SwiftDate.defaultRegion.locale), \"currentIn() with modified calendar also modify the locale\")\n\n\t\t// Default region in another locale and calendar, only locale\n\t\tlet modifiedLocaleDefaultRegion = Region.currentIn(locale: Locales.italian)\n\t\tXCTAssert( (modifiedLocaleDefaultRegion.locale.identifier == Locale(identifier: \"it\").identifier), \"currentIn() with modified locale only does not work\")\n\t\tXCTAssert( (modifiedLocaleDefaultRegion.calendar.identifier == SwiftDate.defaultRegion.calendar.identifier), \"currentIn() with modified locale also modify the calendar\")\n\n\t\t// Init from DateComponents\n\t\tvar dComps = DateComponents()\n\t\tdComps.calendar = Calendar(identifier: Calendar.Identifier.coptic)\n\t\tdComps.timeZone = TimeZone(identifier: \"Pacific/Truk\")\n\t\tlet regionFromComponents = Region(fromDateComponents: dComps)\n\t\tXCTAssert( (regionFromComponents.calendar == dComps.calendar!), \"Failed to create new region from date components / calendar\")\n\t\tXCTAssert( (regionFromComponents.timeZone == dComps.timeZone!), \"Failed to create new region from date components / timezone\")\n\n\t\t// Compare two regions\n\t\tlet regionA = Region(calendar: Calendars.gregorian, zone: Zones.europeOslo, locale: Locales.english)\n\t\tlet regionB = Region(calendar: Calendars.gregorian, zone: Zones.europeOslo, locale: Locales.english)\n\t\tlet regionC = Region(calendar: Calendars.buddhist, zone: Zones.europeOslo, locale: Locales.english)\n\t\tlet regionD = Region(calendar: Calendars.gregorian, zone: Zones.europeRome, locale: Locales.english)\n\t\tlet regionE = Region(calendar: Calendars.buddhist, zone: Zones.europeOslo, locale: Locales.italian)\n\t\tXCTAssert( (regionA == regionB), \"Failed to compare two regions\")\n\t\tXCTAssert( (regionC != regionD && regionD != regionE), \"Failed to compare two regions\")\n\n\t\t// Codable/Decodable for Region\n\t\tdo {\n\t\t\tlet encodedJSON_A = try JSONEncoder().encode(regionA)\n\t\t\tlet encodedJSON_B = try JSONEncoder().encode(regionB)\n\t\t\tXCTAssert( (encodedJSON_A == encodedJSON_B), \"Same data regions does not encode the same\")\n\n\t\t\tlet decodedJSON_RegionA = try JSONDecoder().decode(Region.self, from: encodedJSON_A)\n\t\t\tlet decodedJSON_RegionB = try JSONDecoder().decode(Region.self, from: encodedJSON_B)\n\t\t\tXCTAssert( (decodedJSON_RegionA == decodedJSON_RegionB), \"Same data decoded region are not the same\")\n\n\t\t\tlet stringJSON_A = String(data: encodedJSON_A, encoding: .utf8)\n\t\t\tlet compareStringJSON_A = \"{\\\"timezone\\\":\\\"Europe\\\\/Oslo\\\",\\\"locale\\\":\\\"en\\\",\\\"calendar\\\":\\\"gregorian\\\"}\"\n\t\t\tXCTAssert( (stringJSON_A! == compareStringJSON_A), \"JSON differ in encodable\")\n\n\t\t} catch let err {\n\t\t\tXCTFail(\"Failed to test encodable/decodable on Region: \\(err)\")\n\t\t}\n\n\t\t// Description\n\t\tlet descriptionRegion_A = regionA.description\n\t\tlet expectedDescRegion_A = \"{calendar='gregorian', timezone='Europe/Oslo', locale='en'}\"\n\t\tXCTAssert( (descriptionRegion_A == expectedDescRegion_A), \"Region description differ from expected\")\n\n\t\t// Hash value\n\t\tlet hash_regionA = regionA.hashValue\n\t\tlet hash_regionB = regionB.hashValue\n\t\tXCTAssert( (hash_regionA == hash_regionB), \"Hash value fails\")\n\n\t\t// Current date in this region\n\t\tlet regionIT = Region(calendar: Calendars.gregorian, zone: Zones.europeRome, locale: Locales.italian)\n\t\tlet nowInIT = regionIT.nowInThisRegion()\n\t\tXCTAssert( (nowInIT.region == regionIT), \"Produced date in Region.nowInThisRegion does not have the same origin Region\")\n\t\tXCTAssertInTimeIntervalRange(value: nowInIT.date.timeIntervalSinceNow, range: 2, \"Produced date in Region.nowInThisRegion does not have the current date\")\n\n\t\t// Init with default region data\n\t\tlet regionWithDefault = Region()\n\t\tXCTAssert( (regionWithDefault == SwiftDate.defaultRegion), \"Failed to create new Region from default region\")\n\n\t\t// Init with only fixed calendar\n\t\tlet defaultRegion_fixedCal = Region(calendar: Calendars.buddhist)\n\t\tXCTAssert( (defaultRegion_fixedCal.calendar.identifier == Calendar.Identifier.buddhist), \"Failed to new region from default with fixed only calendar / different calendar\")\n\t\tXCTAssert( (defaultRegion_fixedCal.locale.identifier == SwiftDate.defaultRegion.locale.identifier), \"Failed to new region from default with fixed only calendar / different locale\")\n\t\tXCTAssert( (defaultRegion_fixedCal.timeZone.identifier == SwiftDate.defaultRegion.timeZone.identifier), \"Failed to new region from default with fixed only calendar / different timezone\")\n\n\t}\n\n}\n\nfunc XCTAssertInTimeIntervalRange(value: Double, range: TimeInterval, _ error: String) {\n\tguard value >= (value - range) && value <= (value + range) else {\n\t\tXCTFail(error)\n\t\treturn\n\t}\n}\n"
  },
  {
    "path": "Tests/SwiftDateTests/TestSwiftDate.swift",
    "content": "//\n//  SwiftDate\n//  Parse, validate, manipulate, and display dates, time and timezones in Swift\n//\n//  Created by Daniele Margutti\n//   - Web: https://www.danielemargutti.com\n//   - Twitter: https://twitter.com/danielemargutti\n//   - Mail: hello@danielemargutti.com\n//\n//  Copyright © 2019 Daniele Margutti. Licensed under MIT License.\n//\n\nimport SwiftDate\nimport XCTest\n\nclass TestSwiftDate: XCTestCase {\n\n\tfunc testAutoFormats() {\n\t\tlet builtInAutoFormats = SwiftDate.autoFormats\n\t\tXCTAssert((SwiftDate.autoFormats.isEmpty == false), \"No auto formats available\")\n\t\tlet newFormats = [DateFormats.altRSS, DateFormats.extended, DateFormats.httpHeader]\n\t\tSwiftDate.autoFormats = newFormats\n\t\tXCTAssert( (SwiftDate.autoFormats == newFormats), \"Failed to set new auto formats\")\n\t\tSwiftDate.resetAutoFormats()\n\t\tXCTAssert( (SwiftDate.autoFormats == builtInAutoFormats), \"Failed to reset auto formats\")\n\t}\n\n    func testUTCZone() {\n        SwiftDate.defaultRegion = Region(calendar: Calendars.gregorian, zone: Zones.asiaShanghai, locale: Locales.current)\n        \n        // DO NOT recognized the right timezone\n        // The timezone should be UTC\n        let wrongZone = \"2020-03-13T05:40:48.000Z\"\n        let wrongZoneDate = Date.init(wrongZone)\n        print(wrongZoneDate!.description)\n        XCTAssert(\"2020-03-13 05:40:48 +0000\" == wrongZoneDate!.description)\n        \n        let iso8601Time = \"2020-03-13T05:40:48+00:00\"\n        let iso8601Date = Date.init(iso8601Time)\n        print(iso8601Date!.description)\n        XCTAssert(\"2020-03-13 05:40:48 +0000\" == iso8601Date!.description)\n    }\n}\n"
  },
  {
    "path": "generateLinuxTests.sh",
    "content": "sourcery --sources Tests --templates .sourcery/LinuxMain.stencil --output .sourcery --force-parse generated\nmv .sourcery/LinuxMain.generated.swift Tests/LinuxMain.swift\n"
  }
]