From 6d6b81882153d96cf18a781a221658fa503db6c9 Mon Sep 17 00:00:00 2001 From: Jason Ji Date: Wed, 29 Mar 2017 11:52:46 -0400 Subject: [PATCH 1/8] Fix deprecation warning in Xcode 8.3 --- DateToolsSwift/DateTools/TimePeriod.swift | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/DateToolsSwift/DateTools/TimePeriod.swift b/DateToolsSwift/DateTools/TimePeriod.swift index 4a060a81..3df54292 100644 --- a/DateToolsSwift/DateTools/TimePeriod.swift +++ b/DateToolsSwift/DateTools/TimePeriod.swift @@ -129,11 +129,7 @@ public extension TimePeriodProtocol { if self.beginning != nil && self.end != nil { return abs(self.beginning!.timeIntervalSince(self.end!)) } - #if os(Linux) - return TimeInterval(Double.greatestFiniteMagnitude) - #else - return TimeInterval(DBL_MAX) - #endif + return TimeInterval(Double.greatestFiniteMagnitude) } From 41a2735506cf98e22140de711b950cb771308316 Mon Sep 17 00:00:00 2001 From: Jason Ji Date: Mon, 26 Jun 2017 12:58:28 -0400 Subject: [PATCH 2/8] Refactor by caching Calendar.autoupdatingCurrent in a static variable, avoiding constantly reinstantiating it (which is a performance hit when performing multiple consecutive Date manipulations) --- DateToolsSwift/DateTools/Date+Comparators.swift | 12 ++++++------ DateToolsSwift/DateTools/Date+Components.swift | 14 +++++++------- DateToolsSwift/DateTools/Date+Manipulations.swift | 6 ++++-- 3 files changed, 17 insertions(+), 15 deletions(-) diff --git a/DateToolsSwift/DateTools/Date+Comparators.swift b/DateToolsSwift/DateTools/Date+Comparators.swift index 30f800bf..4547e31e 100644 --- a/DateToolsSwift/DateTools/Date+Comparators.swift +++ b/DateToolsSwift/DateTools/Date+Comparators.swift @@ -44,7 +44,7 @@ public extension Date { * - returns: A TimeChunk representing the time between the dates, in natural form */ public func chunkBetween(date: Date) -> TimeChunk { - var compenentsBetween = Calendar.autoupdatingCurrent.dateComponents([.year, .month, .day, .hour, .minute, .second], from: self, to: date) + var compenentsBetween = Date.autoupdatingCurrentCalendar.dateComponents([.year, .month, .day, .hour, .minute, .second], from: self, to: date) return TimeChunk(seconds: compenentsBetween.second!, minutes: compenentsBetween.minute!, hours: compenentsBetween.hour!, days: compenentsBetween.day!, weeks: 0, months: compenentsBetween.month!, years: compenentsBetween.year!) // TimeChunk(seconds: secondDelta, minutes: minuteDelta, hours: hourDelta, days: dayDelta, weeks: 0, months: monthDelta, years: yearDelta) } @@ -128,7 +128,7 @@ public extension Date { * - returns: True if both paramter dates fall on the same day, false otherwise */ public static func isSameDay(date: Date, as compareDate: Date) -> Bool { - let calendar = Calendar.autoupdatingCurrent + let calendar = Date.autoupdatingCurrentCalendar var components = calendar.dateComponents([.era, .year, .month, .day], from: date) let dateOne = calendar.date(from: components) @@ -262,7 +262,7 @@ public extension Date { public func years(from date: Date, calendar: Calendar?) -> Int { var calendarCopy = calendar if (calendar == nil) { - calendarCopy = Calendar.autoupdatingCurrent + calendarCopy = Date.autoupdatingCurrentCalendar } let earliest = earlierDate(date) @@ -286,7 +286,7 @@ public extension Date { public func months(from date: Date, calendar: Calendar?) -> Int{ var calendarCopy = calendar if (calendar == nil) { - calendarCopy = Calendar.autoupdatingCurrent + calendarCopy = Date.autoupdatingCurrentCalendar } let earliest = earlierDate(date) @@ -310,7 +310,7 @@ public extension Date { public func weeks(from date: Date, calendar: Calendar?) -> Int{ var calendarCopy = calendar if (calendar == nil) { - calendarCopy = Calendar.autoupdatingCurrent + calendarCopy = Date.autoupdatingCurrentCalendar } let earliest = earlierDate(date) @@ -334,7 +334,7 @@ public extension Date { public func days(from date: Date, calendar: Calendar?) -> Int { var calendarCopy = calendar if (calendar == nil) { - calendarCopy = Calendar.autoupdatingCurrent + calendarCopy = Date.autoupdatingCurrentCalendar } let earliest = earlierDate(date) diff --git a/DateToolsSwift/DateTools/Date+Components.swift b/DateToolsSwift/DateTools/Date+Components.swift index 6545908e..e922c55a 100644 --- a/DateToolsSwift/DateTools/Date+Components.swift +++ b/DateToolsSwift/DateTools/Date+Components.swift @@ -24,7 +24,7 @@ public extension Date { * */ public func component(_ component: Calendar.Component) -> Int { - let calendar = Calendar.autoupdatingCurrent + let calendar = Date.autoupdatingCurrentCalendar return calendar.component(component, from: self) } @@ -38,7 +38,7 @@ public extension Date { * */ public func ordinality(of smaller: Calendar.Component, in larger: Calendar.Component) -> Int? { - let calendar = Calendar.autoupdatingCurrent + let calendar = Date.autoupdatingCurrentCalendar return calendar.ordinality(of: smaller, in: larger, for: self) } @@ -55,7 +55,7 @@ public extension Date { * */ public func unit(of smaller: Calendar.Component, in larger: Calendar.Component) -> Int? { - let calendar = Calendar.autoupdatingCurrent + let calendar = Date.autoupdatingCurrentCalendar var units = 1 var unitRange: Range? if larger.hashValue < smaller.hashValue { @@ -224,7 +224,7 @@ public extension Date { * Convenience getter for the date's `daysInMonth` component */ public var daysInMonth: Int { - let calendar = Calendar.autoupdatingCurrent + let calendar = Date.autoupdatingCurrentCalendar let days = calendar.range(of: .day, in: .month, for: self) return days!.count } @@ -298,7 +298,7 @@ public extension Date { * Determine if date is within the current day */ public var isToday: Bool { - let calendar = Calendar.autoupdatingCurrent + let calendar = Date.autoupdatingCurrentCalendar return calendar.isDateInToday(self) } @@ -306,7 +306,7 @@ public extension Date { * Determine if date is within the day tomorrow */ public var isTomorrow: Bool { - let calendar = Calendar.autoupdatingCurrent + let calendar = Date.autoupdatingCurrentCalendar return calendar.isDateInTomorrow(self) } @@ -314,7 +314,7 @@ public extension Date { * Determine if date is within yesterday */ public var isYesterday: Bool { - let calendar = Calendar.autoupdatingCurrent + let calendar = Date.autoupdatingCurrentCalendar return calendar.isDateInYesterday(self) } diff --git a/DateToolsSwift/DateTools/Date+Manipulations.swift b/DateToolsSwift/DateTools/Date+Manipulations.swift index 72b31358..520d405b 100644 --- a/DateToolsSwift/DateTools/Date+Manipulations.swift +++ b/DateToolsSwift/DateTools/Date+Manipulations.swift @@ -13,6 +13,8 @@ import Foundation */ public extension Date { + static let autoupdatingCurrentCalendar = Calendar.autoupdatingCurrent + // MARK: - StartOf /** @@ -126,7 +128,7 @@ public extension Date { * corresponding `TimeChunk` variables */ public func add(_ chunk: TimeChunk) -> Date { - let calendar = Calendar.autoupdatingCurrent + let calendar = Date.autoupdatingCurrentCalendar var components = DateComponents() components.year = chunk.years components.month = chunk.months @@ -147,7 +149,7 @@ public extension Date { * corresponding `TimeChunk` variables */ public func subtract(_ chunk: TimeChunk) -> Date { - let calendar = Calendar.autoupdatingCurrent + let calendar = Date.autoupdatingCurrentCalendar var components = DateComponents() components.year = -chunk.years components.month = -chunk.months From 19bf8b3847aa46a2e97a4a103a1b409c0a30d826 Mon Sep 17 00:00:00 2001 From: Jason Ji Date: Thu, 5 Apr 2018 22:08:47 -0400 Subject: [PATCH 3/8] Bug fix for timeAgo where a date that should be "yesterday" is instead reading an incorrect number of hours apart. --- DateToolsSwift/DateTools/Date+TimeAgo.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/DateToolsSwift/DateTools/Date+TimeAgo.swift b/DateToolsSwift/DateTools/Date+TimeAgo.swift index 527d02de..78435fd3 100644 --- a/DateToolsSwift/DateTools/Date+TimeAgo.swift +++ b/DateToolsSwift/DateTools/Date+TimeAgo.swift @@ -68,8 +68,8 @@ public extension Date { let components = calendar.dateComponents(unitFlags, from: earliest, to: latest) - let yesterday = date.subtract(1.days) - let isYesterday = yesterday.day == self.day + let yesterday = latest.subtract(1.days) + let isYesterday = yesterday.day == earliest.day //Not Yet Implemented/Optional //The following strings are present in the translation files but lack logic as of 2014.04.05 From 2cee2723ebc9cd099e64327fed0b0ed6d58a6194 Mon Sep 17 00:00:00 2001 From: Jason Ji Date: Sat, 21 Apr 2018 14:47:36 -0400 Subject: [PATCH 4/8] Patch for a situation where the two dates are less than 2 days apart, but the day component is 2 apart. (Example: April 19, 10PM and April 21, 2PM) --- DateToolsSwift/DateTools/Date+TimeAgo.swift | 23 +++++++++++++-------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/DateToolsSwift/DateTools/Date+TimeAgo.swift b/DateToolsSwift/DateTools/Date+TimeAgo.swift index 78435fd3..80972bf6 100644 --- a/DateToolsSwift/DateTools/Date+TimeAgo.swift +++ b/DateToolsSwift/DateTools/Date+TimeAgo.swift @@ -112,12 +112,17 @@ public extension Date { else if (components.day! >= 2) { return self.logicalLocalizedStringFromFormat(format: "%%d %@days ago", value: components.day!) } - else if (isYesterday) { - if (numericDates) { - return DateToolsLocalizedStrings("1 day ago"); + else if (components.day! >= 1) { + if (isYesterday) { + if (numericDates) { + return DateToolsLocalizedStrings("1 day ago"); + } + + return DateToolsLocalizedStrings("Yesterday"); + } + else { + return DateToolsLocalizedStrings("1 day ago") } - - return DateToolsLocalizedStrings("Yesterday"); } else if (components.hour! >= 2) { return self.logicalLocalizedStringFromFormat(format: "%%d %@hours ago", value: components.hour!) @@ -200,9 +205,9 @@ public extension Date { private func logicalLocalizedStringFromFormat(format: String, value: Int) -> String{ #if os(Linux) - let localeFormat = String.init(format: format, getLocaleFormatUnderscoresWithValue(Double(value)) as! CVarArg) // this may not work, unclear!! + let localeFormat = String.init(format: format, getLocaleFormatUnderscoresWithValue(Double(value)) as! CVarArg) // this may not work, unclear!! #else - let localeFormat = String.init(format: format, getLocaleFormatUnderscoresWithValue(Double(value))) + let localeFormat = String.init(format: format, getLocaleFormatUnderscoresWithValue(Double(value))) #endif return String.init(format: DateToolsLocalizedStrings(localeFormat), value) @@ -241,9 +246,9 @@ public extension Date { #if os(Linux) // NSLocalizedString() is not available yet, see: https://github.com/apple/swift-corelibs-foundation/blob/16f83ddcd311b768e30a93637af161676b0a5f2f/Foundation/NSData.swift // However, a seemingly-equivalent method from NSBundle is: https://github.com/apple/swift-corelibs-foundation/blob/master/Foundation/NSBundle.swift - return Bundle.main.localizedString(forKey: string, value: "", table: "DateTools") + return Bundle.main.localizedString(forKey: string, value: "", table: "DateTools") #else - return NSLocalizedString(string, tableName: "DateTools", bundle: Bundle.dateToolsBundle(), value: "", comment: "") + return NSLocalizedString(string, tableName: "DateTools", bundle: Bundle.dateToolsBundle(), value: "", comment: "") #endif } From 1d31053569751fa0558c7e00dd13c905b982eece Mon Sep 17 00:00:00 2001 From: Jason Ji Date: Fri, 5 Apr 2019 13:52:40 -0400 Subject: [PATCH 5/8] Update to Swift 5. --- DateToolsSwift.podspec | 2 + .../DateTools/Date+Comparators.swift | 94 +++++++++---------- .../DateTools/Date+Components.swift | 58 ++++++------ DateToolsSwift/DateTools/Date+Format.swift | 16 ++-- DateToolsSwift/DateTools/Date+Inits.swift | 8 +- .../DateTools/Date+Manipulations.swift | 18 ++-- DateToolsSwift/DateTools/Date+TimeAgo.swift | 16 ++-- .../DateTools/Integer+DateTools.swift | 14 +-- DateToolsSwift/DateTools/TimePeriod.swift | 54 +++++------ .../project.pbxproj | 28 +++++- .../xcshareddata/IDEWorkspaceChecks.plist | 8 ++ .../DateToolsExample/AppDelegate.swift | 2 +- 12 files changed, 174 insertions(+), 144 deletions(-) create mode 100644 DateToolsSwift/Examples/DateToolsExample/DateToolsExample.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist diff --git a/DateToolsSwift.podspec b/DateToolsSwift.podspec index 3895b3e2..7fc1ea72 100644 --- a/DateToolsSwift.podspec +++ b/DateToolsSwift.podspec @@ -20,4 +20,6 @@ Pod::Spec.new do |s| s.source_files = 'DateToolsSwift/DateTools' s.resources = 'DateToolsSwift/DateTools/DateTools.bundle' + + s.swift_version = '5.0' end diff --git a/DateToolsSwift/DateTools/Date+Comparators.swift b/DateToolsSwift/DateTools/Date+Comparators.swift index 4547e31e..d068f4f3 100644 --- a/DateToolsSwift/DateTools/Date+Comparators.swift +++ b/DateToolsSwift/DateTools/Date+Comparators.swift @@ -43,7 +43,7 @@ public extension Date { * * - returns: A TimeChunk representing the time between the dates, in natural form */ - public func chunkBetween(date: Date) -> TimeChunk { + func chunkBetween(date: Date) -> TimeChunk { var compenentsBetween = Date.autoupdatingCurrentCalendar.dateComponents([.year, .month, .day, .hour, .minute, .second], from: self, to: date) return TimeChunk(seconds: compenentsBetween.second!, minutes: compenentsBetween.minute!, hours: compenentsBetween.hour!, days: compenentsBetween.day!, weeks: 0, months: compenentsBetween.month!, years: compenentsBetween.year!) // TimeChunk(seconds: secondDelta, minutes: minuteDelta, hours: hourDelta, days: dayDelta, weeks: 0, months: monthDelta, years: yearDelta) @@ -56,7 +56,7 @@ public extension Date { * * - returns: Bool representing comparison result */ - public func equals(_ date: Date) -> Bool { + func equals(_ date: Date) -> Bool { return self.compare(date) == .orderedSame } @@ -68,7 +68,7 @@ public extension Date { * * - returns: Bool representing comparison result */ - public func isLater(than date: Date) -> Bool { + func isLater(than date: Date) -> Bool { return self.compare(date) == .orderedDescending } @@ -80,7 +80,7 @@ public extension Date { * * - returns: Bool representing comparison result */ - public func isLaterThanOrEqual(to date: Date) -> Bool { + func isLaterThanOrEqual(to date: Date) -> Bool { return self.compare(date) == .orderedDescending || self.compare(date) == .orderedSame } @@ -92,7 +92,7 @@ public extension Date { * * - returns: Bool representing comparison result */ - public func isEarlier(than date: Date) -> Bool { + func isEarlier(than date: Date) -> Bool { return self.compare(date) == .orderedAscending } @@ -104,7 +104,7 @@ public extension Date { * * - returns: Bool representing comparison result */ - public func isEarlierThanOrEqual(to date: Date) -> Bool { + func isEarlierThanOrEqual(to date: Date) -> Bool { return self.compare(date) == .orderedAscending || self.compare(date) == .orderedSame } @@ -115,7 +115,7 @@ public extension Date { * * - returns: True if both paramter dates fall on the same day, false otherwise */ - public func isSameDay(date : Date ) -> Bool { + func isSameDay(date : Date ) -> Bool { return Date.isSameDay(date: self, as: date) } @@ -127,7 +127,7 @@ public extension Date { * * - returns: True if both paramter dates fall on the same day, false otherwise */ - public static func isSameDay(date: Date, as compareDate: Date) -> Bool { + static func isSameDay(date: Date, as compareDate: Date) -> Bool { let calendar = Date.autoupdatingCurrentCalendar var components = calendar.dateComponents([.era, .year, .month, .day], from: date) let dateOne = calendar.date(from: components) @@ -154,7 +154,7 @@ public extension Date { * * - returns: The years between receiver and provided date */ - public func years(from date: Date) -> Int { + func years(from date: Date) -> Int { return years(from: date, calendar:nil) } @@ -169,7 +169,7 @@ public extension Date { * * - returns: The years between receiver and provided date */ - public func months(from date: Date) -> Int { + func months(from date: Date) -> Int { return months(from: date, calendar:nil) } @@ -184,7 +184,7 @@ public extension Date { * * - returns: The weeks between receiver and provided date */ - public func weeks(from date: Date) -> Int { + func weeks(from date: Date) -> Int { return weeks(from: date, calendar:nil) } @@ -199,7 +199,7 @@ public extension Date { * * - returns: The days between receiver and provided date */ - public func days(from date: Date) -> Int { + func days(from date: Date) -> Int { return days(from: date, calendar:nil) } @@ -213,7 +213,7 @@ public extension Date { * * - returns: The hours between receiver and provided date */ - public func hours(from date: Date) -> Int { + func hours(from date: Date) -> Int { return Int(self.timeIntervalSince(date)/Constants.SecondsInHour); } @@ -227,7 +227,7 @@ public extension Date { * * - returns: The minutes between receiver and provided date */ - public func minutes(from date: Date) -> Int { + func minutes(from date: Date) -> Int { return Int(self.timeIntervalSince(date)/Constants.SecondsInMinute) } @@ -241,7 +241,7 @@ public extension Date { * * - returns: The seconds between receiver and provided date */ - public func seconds(from date: Date) -> Int { + func seconds(from date: Date) -> Int { return Int(timeIntervalSince(date)) } @@ -259,7 +259,7 @@ public extension Date { * * - returns: The years between receiver and provided date */ - public func years(from date: Date, calendar: Calendar?) -> Int { + func years(from date: Date, calendar: Calendar?) -> Int { var calendarCopy = calendar if (calendar == nil) { calendarCopy = Date.autoupdatingCurrentCalendar @@ -283,7 +283,7 @@ public extension Date { * * - returns: The months between receiver and provided date */ - public func months(from date: Date, calendar: Calendar?) -> Int{ + func months(from date: Date, calendar: Calendar?) -> Int{ var calendarCopy = calendar if (calendar == nil) { calendarCopy = Date.autoupdatingCurrentCalendar @@ -307,7 +307,7 @@ public extension Date { * * - returns: The weeks between receiver and provided date */ - public func weeks(from date: Date, calendar: Calendar?) -> Int{ + func weeks(from date: Date, calendar: Calendar?) -> Int{ var calendarCopy = calendar if (calendar == nil) { calendarCopy = Date.autoupdatingCurrentCalendar @@ -331,7 +331,7 @@ public extension Date { * * - returns: The days between receiver and provided date */ - public func days(from date: Date, calendar: Calendar?) -> Int { + func days(from date: Date, calendar: Calendar?) -> Int { var calendarCopy = calendar if (calendar == nil) { calendarCopy = Date.autoupdatingCurrentCalendar @@ -351,7 +351,7 @@ public extension Date { * The number of years until the receiver's date (0 if the receiver is the same or * earlier than now). */ - public var yearsUntil: Int { + var yearsUntil: Int { return yearsLater(than: Date()) } @@ -359,7 +359,7 @@ public extension Date { * The number of months until the receiver's date (0 if the receiver is the same or * earlier than now). */ - public var monthsUntil: Int { + var monthsUntil: Int { return monthsLater(than: Date()) } @@ -367,7 +367,7 @@ public extension Date { * The number of weeks until the receiver's date (0 if the receiver is the same or * earlier than now). */ - public var weeksUntil: Int { + var weeksUntil: Int { return weeksLater(than: Date()) } @@ -375,7 +375,7 @@ public extension Date { * The number of days until the receiver's date (0 if the receiver is the same or * earlier than now). */ - public var daysUntil: Int { + var daysUntil: Int { return daysLater(than: Date()) } @@ -383,7 +383,7 @@ public extension Date { * The number of hours until the receiver's date (0 if the receiver is the same or * earlier than now). */ - public var hoursUntil: Int{ + var hoursUntil: Int{ return hoursLater(than: Date()) } @@ -391,7 +391,7 @@ public extension Date { * The number of minutes until the receiver's date (0 if the receiver is the same or * earlier than now). */ - public var minutesUntil: Int{ + var minutesUntil: Int{ return minutesLater(than: Date()) } @@ -399,7 +399,7 @@ public extension Date { * The number of seconds until the receiver's date (0 if the receiver is the same or * earlier than now). */ - public var secondsUntil: Int{ + var secondsUntil: Int{ return secondsLater(than: Date()) } @@ -410,7 +410,7 @@ public extension Date { * The number of years the receiver's date is earlier than now (0 if the receiver is * the same or earlier than now). */ - public var yearsAgo: Int { + var yearsAgo: Int { return yearsEarlier(than: Date()) } @@ -418,7 +418,7 @@ public extension Date { * The number of months the receiver's date is earlier than now (0 if the receiver is * the same or earlier than now). */ - public var monthsAgo: Int { + var monthsAgo: Int { return monthsEarlier(than: Date()) } @@ -426,7 +426,7 @@ public extension Date { * The number of weeks the receiver's date is earlier than now (0 if the receiver is * the same or earlier than now). */ - public var weeksAgo: Int { + var weeksAgo: Int { return weeksEarlier(than: Date()) } @@ -434,7 +434,7 @@ public extension Date { * The number of days the receiver's date is earlier than now (0 if the receiver is * the same or earlier than now). */ - public var daysAgo: Int { + var daysAgo: Int { return daysEarlier(than: Date()) } @@ -442,7 +442,7 @@ public extension Date { * The number of hours the receiver's date is earlier than now (0 if the receiver is * the same or earlier than now). */ - public var hoursAgo: Int { + var hoursAgo: Int { return hoursEarlier(than: Date()) } @@ -450,7 +450,7 @@ public extension Date { * The number of minutes the receiver's date is earlier than now (0 if the receiver is * the same or earlier than now). */ - public var minutesAgo: Int { + var minutesAgo: Int { return minutesEarlier(than: Date()) } @@ -458,7 +458,7 @@ public extension Date { * The number of seconds the receiver's date is earlier than now (0 if the receiver is * the same or earlier than now). */ - public var secondsAgo: Int{ + var secondsAgo: Int{ return secondsEarlier(than: Date()) } @@ -473,7 +473,7 @@ public extension Date { * * - returns: The number of years */ - public func yearsEarlier(than date: Date) -> Int { + func yearsEarlier(than date: Date) -> Int { return abs(min(years(from: date), 0)) } @@ -485,7 +485,7 @@ public extension Date { * * - returns: The number of months */ - public func monthsEarlier(than date: Date) -> Int { + func monthsEarlier(than date: Date) -> Int { return abs(min(months(from: date), 0)); } @@ -497,7 +497,7 @@ public extension Date { * * - returns: The number of weeks */ - public func weeksEarlier(than date: Date) -> Int { + func weeksEarlier(than date: Date) -> Int { return abs(min(weeks(from: date), 0)) } @@ -509,7 +509,7 @@ public extension Date { * * - returns: The number of days */ - public func daysEarlier(than date: Date) -> Int { + func daysEarlier(than date: Date) -> Int { return abs(min(days(from: date), 0)) } @@ -521,7 +521,7 @@ public extension Date { * * - returns: The number of hours */ - public func hoursEarlier(than date: Date) -> Int { + func hoursEarlier(than date: Date) -> Int { return abs(min(hours(from: date), 0)) } @@ -533,7 +533,7 @@ public extension Date { * * - returns: The number of minutes */ - public func minutesEarlier(than date: Date) -> Int { + func minutesEarlier(than date: Date) -> Int { return abs(min(minutes(from: date), 0)) } @@ -545,7 +545,7 @@ public extension Date { * * - returns: The number of seconds */ - public func secondsEarlier(than date: Date) -> Int { + func secondsEarlier(than date: Date) -> Int { return abs(min(seconds(from: date), 0)) } @@ -561,7 +561,7 @@ public extension Date { * * - returns: The number of years */ - public func yearsLater(than date: Date) -> Int { + func yearsLater(than date: Date) -> Int { return max(years(from: date), 0) } @@ -574,7 +574,7 @@ public extension Date { * * - returns: The number of months */ - public func monthsLater(than date: Date) -> Int { + func monthsLater(than date: Date) -> Int { return max(months(from: date), 0) } @@ -587,7 +587,7 @@ public extension Date { * * - returns: The number of weeks */ - public func weeksLater(than date: Date) -> Int { + func weeksLater(than date: Date) -> Int { return max(weeks(from: date), 0) } @@ -600,7 +600,7 @@ public extension Date { * * - returns: The number of days */ - public func daysLater(than date: Date) -> Int { + func daysLater(than date: Date) -> Int { return max(days(from: date), 0) } @@ -613,7 +613,7 @@ public extension Date { * * - returns: The number of hours */ - public func hoursLater(than date: Date) -> Int { + func hoursLater(than date: Date) -> Int { return max(hours(from: date), 0) } @@ -626,7 +626,7 @@ public extension Date { * * - returns: The number of minutes */ - public func minutesLater(than date: Date) -> Int { + func minutesLater(than date: Date) -> Int { return max(minutes(from: date), 0) } @@ -639,7 +639,7 @@ public extension Date { * * - returns: The number of seconds */ - public func secondsLater(than date: Date) -> Int { + func secondsLater(than date: Date) -> Int { return max(seconds(from: date), 0) } } diff --git a/DateToolsSwift/DateTools/Date+Components.swift b/DateToolsSwift/DateTools/Date+Components.swift index e922c55a..a0cbe075 100644 --- a/DateToolsSwift/DateTools/Date+Components.swift +++ b/DateToolsSwift/DateTools/Date+Components.swift @@ -23,7 +23,7 @@ public extension Date { * - returns: The value of the component * */ - public func component(_ component: Calendar.Component) -> Int { + func component(_ component: Calendar.Component) -> Int { let calendar = Date.autoupdatingCurrentCalendar return calendar.component(component, from: self) } @@ -37,7 +37,7 @@ public extension Date { * - returns: The ordinal number of a smaller calendar component within a specified larger calendar component * */ - public func ordinality(of smaller: Calendar.Component, in larger: Calendar.Component) -> Int? { + func ordinality(of smaller: Calendar.Component, in larger: Calendar.Component) -> Int? { let calendar = Date.autoupdatingCurrentCalendar return calendar.ordinality(of: smaller, in: larger, for: self) } @@ -54,7 +54,7 @@ public extension Date { * - returns: The number of smaller units required to equal in 1 larger unit, given the date called on * */ - public func unit(of smaller: Calendar.Component, in larger: Calendar.Component) -> Int? { + func unit(of smaller: Calendar.Component, in larger: Calendar.Component) -> Int? { let calendar = Date.autoupdatingCurrentCalendar var units = 1 var unitRange: Range? @@ -125,105 +125,105 @@ public extension Date { /** * Convenience getter for the date's `era` component */ - public var era: Int { + var era: Int { return component(.era) } /** * Convenience getter for the date's `year` component */ - public var year: Int { + var year: Int { return component(.year) } /** * Convenience getter for the date's `month` component */ - public var month: Int { + var month: Int { return component(.month) } /** * Convenience getter for the date's `week` component */ - public var week: Int { + var week: Int { return component(.weekday) } /** * Convenience getter for the date's `day` component */ - public var day: Int { + var day: Int { return component(.day) } /** * Convenience getter for the date's `hour` component */ - public var hour: Int { + var hour: Int { return component(.hour) } /** * Convenience getter for the date's `minute` component */ - public var minute: Int { + var minute: Int { return component(.minute) } /** * Convenience getter for the date's `second` component */ - public var second: Int { + var second: Int { return component(.second) } /** * Convenience getter for the date's `weekday` component */ - public var weekday: Int { + var weekday: Int { return component(.weekday) } /** * Convenience getter for the date's `weekdayOrdinal` component */ - public var weekdayOrdinal: Int { + var weekdayOrdinal: Int { return component(.weekdayOrdinal) } /** * Convenience getter for the date's `quarter` component */ - public var quarter: Int { + var quarter: Int { return component(.quarter) } /** * Convenience getter for the date's `weekOfYear` component */ - public var weekOfMonth: Int { + var weekOfMonth: Int { return component(.weekOfMonth) } /** * Convenience getter for the date's `weekOfYear` component */ - public var weekOfYear: Int { + var weekOfYear: Int { return component(.weekOfYear) } /** * Convenience getter for the date's `yearForWeekOfYear` component */ - public var yearForWeekOfYear: Int { + var yearForWeekOfYear: Int { return component(.yearForWeekOfYear) } /** * Convenience getter for the date's `daysInMonth` component */ - public var daysInMonth: Int { + var daysInMonth: Int { let calendar = Date.autoupdatingCurrentCalendar let days = calendar.range(of: .day, in: .month, for: self) return days!.count @@ -234,42 +234,42 @@ public extension Date { /** * Convenience setter for the date's `year` component */ - public mutating func year(_ year: Int) { + mutating func year(_ year: Int) { self = Date.init(year: year, month: self.month, day: self.day, hour: self.hour, minute: self.minute, second: self.second) } /** * Convenience setter for the date's `month` component */ - public mutating func month(_ month: Int) { + mutating func month(_ month: Int) { self = Date.init(year: self.year, month: month, day: self.day, hour: self.hour, minute: self.minute, second: self.second) } /** * Convenience setter for the date's `day` component */ - public mutating func day(_ day: Int) { + mutating func day(_ day: Int) { self = Date.init(year: self.year, month: self.month, day: day, hour: self.hour, minute: self.minute, second: self.second) } /** * Convenience setter for the date's `hour` component */ - public mutating func hour(_ hour: Int) { + mutating func hour(_ hour: Int) { self = Date.init(year: self.year, month: self.month, day: self.day, hour: hour, minute: self.minute, second: self.second) } /** * Convenience setter for the date's `minute` component */ - public mutating func minute(_ minute: Int) { + mutating func minute(_ minute: Int) { self = Date.init(year: self.year, month: self.month, day: self.day, hour: self.hour, minute: minute, second: self.second) } /** * Convenience setter for the date's `second` component */ - public mutating func second(_ second: Int) { + mutating func second(_ second: Int) { self = Date.init(year: self.year, month: self.month, day: self.day, hour: self.hour, minute: self.minute, second: second) } @@ -279,7 +279,7 @@ public extension Date { /** * Determine if date is in a leap year */ - public var isInLeapYear: Bool { + var isInLeapYear: Bool { let yearComponent = component(.year) if yearComponent % 400 == 0 { @@ -297,7 +297,7 @@ public extension Date { /** * Determine if date is within the current day */ - public var isToday: Bool { + var isToday: Bool { let calendar = Date.autoupdatingCurrentCalendar return calendar.isDateInToday(self) } @@ -305,7 +305,7 @@ public extension Date { /** * Determine if date is within the day tomorrow */ - public var isTomorrow: Bool { + var isTomorrow: Bool { let calendar = Date.autoupdatingCurrentCalendar return calendar.isDateInTomorrow(self) } @@ -313,7 +313,7 @@ public extension Date { /** * Determine if date is within yesterday */ - public var isYesterday: Bool { + var isYesterday: Bool { let calendar = Date.autoupdatingCurrentCalendar return calendar.isDateInYesterday(self) } @@ -321,7 +321,7 @@ public extension Date { /** * Determine if date is in a weekend */ - public var isWeekend: Bool { + var isWeekend: Bool { if weekday == 7 || weekday == 1 { return true } diff --git a/DateToolsSwift/DateTools/Date+Format.swift b/DateToolsSwift/DateTools/Date+Format.swift index 6f97e170..405c2533 100644 --- a/DateToolsSwift/DateTools/Date+Format.swift +++ b/DateToolsSwift/DateTools/Date+Format.swift @@ -24,7 +24,7 @@ public extension Date { * * - returns: Represenation of the date (self) in the specified format */ - public func format(with dateStyle: DateFormatter.Style, timeZone: TimeZone, locale: Locale) -> String { + func format(with dateStyle: DateFormatter.Style, timeZone: TimeZone, locale: Locale) -> String { let dateFormatter = DateFormatter() dateFormatter.dateStyle = dateStyle dateFormatter.timeZone = timeZone @@ -41,7 +41,7 @@ public extension Date { * * - returns String? - Represenation of the date (self) in the specified format */ - public func format(with dateStyle: DateFormatter.Style, timeZone: TimeZone) -> String { + func format(with dateStyle: DateFormatter.Style, timeZone: TimeZone) -> String { #if os(Linux) return format(with: dateStyle, timeZone: timeZone, locale: Locale.current) #else @@ -58,7 +58,7 @@ public extension Date { * * - returns: Represenation of the date (self) in the specified format */ - public func format(with dateStyle: DateFormatter.Style, locale: Locale) -> String { + func format(with dateStyle: DateFormatter.Style, locale: Locale) -> String { return format(with: dateStyle, timeZone: TimeZone.autoupdatingCurrent, locale: locale) } @@ -70,7 +70,7 @@ public extension Date { * * - returns: Represenation of the date (self) in the specified format */ - public func format(with dateStyle: DateFormatter.Style) -> String { + func format(with dateStyle: DateFormatter.Style) -> String { #if os(Linux) return format(with: dateStyle, timeZone: TimeZone.autoupdatingCurrent, locale: Locale.current) #else @@ -90,7 +90,7 @@ public extension Date { * * - returns: Represenation of the date (self) in the specified format */ - public func format(with dateFormat: String, timeZone: TimeZone, locale: Locale) -> String { + func format(with dateFormat: String, timeZone: TimeZone, locale: Locale) -> String { let dateFormatter = DateFormatter() dateFormatter.dateFormat = dateFormat dateFormatter.timeZone = timeZone @@ -108,7 +108,7 @@ public extension Date { * * - returns: Representation of the date (self) in the specified format */ - public func format(with dateFormat: String, timeZone: TimeZone) -> String { + func format(with dateFormat: String, timeZone: TimeZone) -> String { #if os(Linux) return format(with: dateFormat, timeZone: timeZone, locale: Locale.current) #else @@ -125,7 +125,7 @@ public extension Date { * * - returns: Represenation of the date (self) in the specified format */ - public func format(with dateFormat: String, locale: Locale) -> String { + func format(with dateFormat: String, locale: Locale) -> String { return format(with: dateFormat, timeZone: TimeZone.autoupdatingCurrent, locale: locale) } @@ -137,7 +137,7 @@ public extension Date { * * - returns: Represenation of the date (self) in the specified format */ - public func format(with dateFormat: String) -> String { + func format(with dateFormat: String) -> String { #if os(Linux) return format(with: dateFormat, timeZone: TimeZone.autoupdatingCurrent, locale: Locale.current) #else diff --git a/DateToolsSwift/DateTools/Date+Inits.swift b/DateToolsSwift/DateTools/Date+Inits.swift index e3d6f6db..2e943e97 100644 --- a/DateToolsSwift/DateTools/Date+Inits.swift +++ b/DateToolsSwift/DateTools/Date+Inits.swift @@ -27,7 +27,7 @@ public extension Date { * - parameter minute: Minute component of new date * - parameter second: Second component of new date */ - public init(year: Int, month: Int, day: Int, hour: Int, minute: Int, second: Int) { + init(year: Int, month: Int, day: Int, hour: Int, minute: Int, second: Int) { var dateComponents = DateComponents() dateComponents.year = year dateComponents.month = month @@ -50,7 +50,7 @@ public extension Date { * - parameter month: Month component of new date * - parameter day: Day component of new date */ - public init(year: Int, month: Int, day: Int) { + init(year: Int, month: Int, day: Int) { self.init(year: year, month: month, day: day, hour: 0, minute: 0, second: 0) } @@ -61,7 +61,7 @@ public extension Date { * - parameter format: Format style using Apple's date formatting guide * - parameter timeZone: Time zone of date */ - public init(dateString: String, format: String, timeZone: TimeZone) { + init(dateString: String, format: String, timeZone: TimeZone) { let dateFormatter = DateFormatter() dateFormatter.dateStyle = .none; dateFormatter.timeStyle = .none; @@ -82,7 +82,7 @@ public extension Date { * - parameter dateString: Date in the formatting given by the format parameter * - parameter format: Format style using Apple's date formatting guide */ - public init (dateString: String, format: String) { + init (dateString: String, format: String) { self.init(dateString: dateString, format: format, timeZone: TimeZone.autoupdatingCurrent) } } diff --git a/DateToolsSwift/DateTools/Date+Manipulations.swift b/DateToolsSwift/DateTools/Date+Manipulations.swift index 520d405b..b630c924 100644 --- a/DateToolsSwift/DateTools/Date+Manipulations.swift +++ b/DateToolsSwift/DateTools/Date+Manipulations.swift @@ -25,7 +25,7 @@ public extension Date { * - returns: A date retaining the value of the given component and all larger components, * with all smaller components set to their minimum */ - public func start(of component: Component) -> Date { + func start(of component: Component) -> Date { var newDate = self; if component == .second { newDate.second(self.second) @@ -62,7 +62,7 @@ public extension Date { * - returns: A date retaining the value of the given component and all larger components, * with all smaller components set to their maximum */ - public func end(of component: Component) -> Date { + func end(of component: Component) -> Date { var newDate = self; if component == .second { newDate.second(newDate.second + 1) @@ -98,7 +98,7 @@ public extension Date { return newDate } - public func daysInMonth(date: Date) -> Int { + func daysInMonth(date: Date) -> Int { let month = date.month if month == 1 || month == 3 || month == 5 || month == 7 || month == 8 || month == 10 || month == 12 { // 31 day month @@ -127,7 +127,7 @@ public extension Date { * - returns: A date with components increased by the values of the * corresponding `TimeChunk` variables */ - public func add(_ chunk: TimeChunk) -> Date { + func add(_ chunk: TimeChunk) -> Date { let calendar = Date.autoupdatingCurrentCalendar var components = DateComponents() components.year = chunk.years @@ -148,7 +148,7 @@ public extension Date { * - returns: A date with components decreased by the values of the * corresponding `TimeChunk` variables */ - public func subtract(_ chunk: TimeChunk) -> Date { + func subtract(_ chunk: TimeChunk) -> Date { let calendar = Date.autoupdatingCurrentCalendar var components = DateComponents() components.year = -chunk.years @@ -166,28 +166,28 @@ public extension Date { /** * Operator overload for adding a `TimeChunk` to a date. */ - public static func +(leftAddend: Date, rightAddend: TimeChunk) -> Date { + static func +(leftAddend: Date, rightAddend: TimeChunk) -> Date { return leftAddend.add(rightAddend) } /** * Operator overload for subtracting a `TimeChunk` from a date. */ - public static func -(minuend: Date, subtrahend: TimeChunk) -> Date { + static func -(minuend: Date, subtrahend: TimeChunk) -> Date { return minuend.subtract(subtrahend) } /** * Operator overload for adding a `TimeInterval` to a date. */ - public static func +(leftAddend: Date, rightAddend: Int) -> Date { + static func +(leftAddend: Date, rightAddend: Int) -> Date { return leftAddend.addingTimeInterval((TimeInterval(rightAddend))) } /** * Operator overload for subtracting a `TimeInterval` from a date. */ - public static func -(minuend: Date, subtrahend: Int) -> Date { + static func -(minuend: Date, subtrahend: Int) -> Date { return minuend.addingTimeInterval(-(TimeInterval(subtrahend))) } diff --git a/DateToolsSwift/DateTools/Date+TimeAgo.swift b/DateToolsSwift/DateTools/Date+TimeAgo.swift index 80972bf6..56db1b95 100644 --- a/DateToolsSwift/DateTools/Date+TimeAgo.swift +++ b/DateToolsSwift/DateTools/Date+TimeAgo.swift @@ -24,7 +24,7 @@ public extension Date { * * - returns String - Formatted return string */ - public static func timeAgo(since date:Date) -> String{ + static func timeAgo(since date:Date) -> String{ return date.timeAgo(since: Date(), numericDates: false, numericTimes: false) } @@ -36,7 +36,7 @@ public extension Date { * * - returns String - Formatted return string */ - public static func shortTimeAgo(since date:Date) -> String { + static func shortTimeAgo(since date:Date) -> String { return date.shortTimeAgo(since:Date()) } @@ -46,7 +46,7 @@ public extension Date { * * - returns String - Formatted return string */ - public var timeAgoSinceNow: String { + var timeAgoSinceNow: String { return self.timeAgo(since:Date()) } @@ -56,11 +56,11 @@ public extension Date { * * - returns String - Formatted return string */ - public var shortTimeAgoSinceNow: String { + var shortTimeAgoSinceNow: String { return self.shortTimeAgo(since:Date()) } - public func timeAgo(since date:Date, numericDates: Bool = false, numericTimes: Bool = false) -> String { + func timeAgo(since date:Date, numericDates: Bool = false, numericTimes: Bool = false) -> String { let calendar = NSCalendar.current let unitFlags = Set([.second,.minute,.hour,.day,.weekOfYear,.month,.year]) let earliest = self.earlierDate(date) @@ -160,7 +160,7 @@ public extension Date { } - public func shortTimeAgo(since date:Date) -> String { + func shortTimeAgo(since date:Date) -> String { let calendar = NSCalendar.current let unitFlags = Set([.second,.minute,.hour,.day,.weekOfYear,.month,.year]) let earliest = self.earlierDate(date) @@ -262,7 +262,7 @@ public extension Date { * * - returns: The date that is earlier */ - public func earlierDate(_ date:Date) -> Date{ + func earlierDate(_ date:Date) -> Date{ return (self.timeIntervalSince1970 <= date.timeIntervalSince1970) ? self : date } @@ -273,7 +273,7 @@ public extension Date { * * - returns: The date that is later */ - public func laterDate(_ date:Date) -> Date{ + func laterDate(_ date:Date) -> Date{ return (self.timeIntervalSince1970 >= date.timeIntervalSince1970) ? self : date } diff --git a/DateToolsSwift/DateTools/Integer+DateTools.swift b/DateToolsSwift/DateTools/Integer+DateTools.swift index 3dc55657..55e4baab 100644 --- a/DateToolsSwift/DateTools/Integer+DateTools.swift +++ b/DateToolsSwift/DateTools/Integer+DateTools.swift @@ -15,49 +15,49 @@ public extension Int { /** * A `TimeChunk` with its seconds component set to the value of self */ - public var seconds: TimeChunk { + var seconds: TimeChunk { return TimeChunk(seconds: self, minutes: 0, hours: 0, days: 0, weeks: 0, months: 0, years: 0) } /** * A `TimeChunk` with its minutes component set to the value of self */ - public var minutes: TimeChunk { + var minutes: TimeChunk { return TimeChunk(seconds: 0, minutes: self, hours: 0, days: 0, weeks: 0, months: 0, years: 0) } /** * A `TimeChunk` with its hours component set to the value of self */ - public var hours: TimeChunk { + var hours: TimeChunk { return TimeChunk(seconds: 0, minutes: 0, hours: self, days: 0, weeks: 0, months: 0, years: 0) } /** * A `TimeChunk` with its days component set to the value of self */ - public var days: TimeChunk { + var days: TimeChunk { return TimeChunk(seconds: 0, minutes: 0, hours: 0, days: self, weeks: 0, months: 0, years: 0) } /** * A `TimeChunk` with its weeks component set to the value of self */ - public var weeks: TimeChunk { + var weeks: TimeChunk { return TimeChunk(seconds: 0, minutes: 0, hours: 0, days: 0, weeks: self, months: 0, years: 0) } /** * A `TimeChunk` with its months component set to the value of self */ - public var months: TimeChunk { + var months: TimeChunk { return TimeChunk(seconds: 0, minutes: 0, hours: 0, days: 0, weeks: 0, months: self, years: 0) } /** * A `TimeChunk` with its years component set to the value of self */ - public var years: TimeChunk { + var years: TimeChunk { return TimeChunk(seconds: 0, minutes: 0, hours: 0, days: 0, weeks: 0, months: 0, years: self) } } diff --git a/DateToolsSwift/DateTools/TimePeriod.swift b/DateToolsSwift/DateTools/TimePeriod.swift index e64fd57b..48881abe 100644 --- a/DateToolsSwift/DateTools/TimePeriod.swift +++ b/DateToolsSwift/DateTools/TimePeriod.swift @@ -40,7 +40,7 @@ public extension TimePeriodProtocol { /** * True if the `TimePeriod`'s duration is zero */ - public var isMoment: Bool { + var isMoment: Bool { return self.beginning == self.end } @@ -48,7 +48,7 @@ public extension TimePeriodProtocol { * The duration of the `TimePeriod` in years. * Returns the max int if beginning or end are nil. */ - public var years: Int { + var years: Int { if self.beginning != nil && self.end != nil { return self.beginning!.yearsEarlier(than: self.end!) } @@ -59,7 +59,7 @@ public extension TimePeriodProtocol { * The duration of the `TimePeriod` in weeks. * Returns the max int if beginning or end are nil. */ - public var weeks: Int { + var weeks: Int { if self.beginning != nil && self.end != nil { return self.beginning!.weeksEarlier(than: self.end!) } @@ -70,7 +70,7 @@ public extension TimePeriodProtocol { * The duration of the `TimePeriod` in days. * Returns the max int if beginning or end are nil. */ - public var days: Int { + var days: Int { if self.beginning != nil && self.end != nil { return self.beginning!.daysEarlier(than: self.end!) } @@ -81,7 +81,7 @@ public extension TimePeriodProtocol { * The duration of the `TimePeriod` in hours. * Returns the max int if beginning or end are nil. */ - public var hours: Int { + var hours: Int { if self.beginning != nil && self.end != nil { return self.beginning!.hoursEarlier(than: self.end!) } @@ -92,7 +92,7 @@ public extension TimePeriodProtocol { * The duration of the `TimePeriod` in minutes. * Returns the max int if beginning or end are nil. */ - public var minutes: Int { + var minutes: Int { if self.beginning != nil && self.end != nil { return self.beginning!.minutesEarlier(than: self.end!) } @@ -103,7 +103,7 @@ public extension TimePeriodProtocol { * The duration of the `TimePeriod` in seconds. * Returns the max int if beginning or end are nil. */ - public var seconds: Int { + var seconds: Int { if self.beginning != nil && self.end != nil { return self.beginning!.secondsEarlier(than: self.end!) } @@ -114,7 +114,7 @@ public extension TimePeriodProtocol { * The duration of the `TimePeriod` in a time chunk. * Returns a time chunk with all zeroes if beginning or end are nil. */ - public var chunk: TimeChunk { + var chunk: TimeChunk { if beginning != nil && end != nil { return beginning!.chunkBetween(date: end!) } @@ -125,7 +125,7 @@ public extension TimePeriodProtocol { * The length of time between the beginning and end dates of the * `TimePeriod` as a `TimeInterval`. */ - public var duration: TimeInterval { + var duration: TimeInterval { if self.beginning != nil && self.end != nil { return abs(self.beginning!.timeIntervalSince(self.end!)) } @@ -147,7 +147,7 @@ public extension TimePeriodProtocol { * * - returns: The relationship between self and the given time period */ - public func relation(to period: TimePeriodProtocol) -> Relation { + func relation(to period: TimePeriodProtocol) -> Relation { //Make sure that all start and end points exist for comparison if (self.beginning != nil && self.end != nil && period.beginning != nil && period.end != nil) { //Make sure time periods are of positive durations @@ -207,7 +207,7 @@ public extension TimePeriodProtocol { * * - returns: True if the periods are the same */ - public func equals(_ period: TimePeriodProtocol) -> Bool { + func equals(_ period: TimePeriodProtocol) -> Bool { return self.beginning == period.beginning && self.end == period.end } @@ -219,7 +219,7 @@ public extension TimePeriodProtocol { * * - returns: True if self is inside of the given `TimePeriod` */ - public func isInside(of period: TimePeriodProtocol) -> Bool { + func isInside(of period: TimePeriodProtocol) -> Bool { return period.beginning!.isEarlierThanOrEqual(to: self.beginning!) && period.end!.isLaterThanOrEqual(to: self.end!) } @@ -231,7 +231,7 @@ public extension TimePeriodProtocol { * * - returns: True if the given `TimePeriod` is inside of self */ - public func contains(_ date: Date, interval: Interval) -> Bool { + func contains(_ date: Date, interval: Interval) -> Bool { if (interval == .open) { return self.beginning!.isEarlier(than: date) && self.end!.isLater(than: date) } @@ -250,7 +250,7 @@ public extension TimePeriodProtocol { * * - returns: True if the given `TimePeriod` is inside of self */ - public func contains(_ period: TimePeriodProtocol) -> Bool { + func contains(_ period: TimePeriodProtocol) -> Bool { return self.beginning!.isEarlierThanOrEqual(to: period.beginning!) && self.end!.isLaterThanOrEqual(to: period.end!) } @@ -261,7 +261,7 @@ public extension TimePeriodProtocol { * * - returns: True if there is a period of time that is shared by both `TimePeriod`s */ - public func overlaps(with period: TimePeriodProtocol) -> Bool { + func overlaps(with period: TimePeriodProtocol) -> Bool { //Outside -> Inside if (period.beginning!.isEarlier(than: self.beginning!) && period.end!.isLater(than: self.beginning!)) { return true @@ -284,7 +284,7 @@ public extension TimePeriodProtocol { * * - returns: True if there is a period of time or moment that is shared by both `TimePeriod`s */ - public func intersects(with period: TimePeriodProtocol) -> Bool { + func intersects(with period: TimePeriodProtocol) -> Bool { return self.relation(to: period) != .after && self.relation(to: period) != .before } @@ -295,7 +295,7 @@ public extension TimePeriodProtocol { * * - returns: True if there is a period of time between self and the given `TimePeriod` not contained by either period */ - public func hasGap(between period: TimePeriodProtocol) -> Bool { + func hasGap(between period: TimePeriodProtocol) -> Bool { return self.isBefore(period: period) || self.isAfter(period: period) } @@ -306,7 +306,7 @@ public extension TimePeriodProtocol { * * - returns: The gap between the periods. Zero if there is no gap. */ - public func gap(between period: TimePeriodProtocol) -> TimeInterval { + func gap(between period: TimePeriodProtocol) -> TimeInterval { if (self.end!.isEarlier(than: period.beginning!)) { return abs(self.end!.timeIntervalSince(period.beginning!)); } @@ -324,7 +324,7 @@ public extension TimePeriodProtocol { * * - returns: The gap between the periods, zero if there is no gap */ - public func gap(between period: TimePeriodProtocol) -> TimeChunk? { + func gap(between period: TimePeriodProtocol) -> TimeChunk? { if self.end != nil && period.beginning != nil { return (self.end?.chunkBetween(date: period.beginning!))! } @@ -338,7 +338,7 @@ public extension TimePeriodProtocol { * * - returns: True if self is after the given `TimePeriod` */ - public func isAfter(period: TimePeriodProtocol) -> Bool { + func isAfter(period: TimePeriodProtocol) -> Bool { return self.relation(to: period) == .after } @@ -349,7 +349,7 @@ public extension TimePeriodProtocol { * * - returns: True if self is after the given `TimePeriod` */ - public func isBefore(period: TimePeriodProtocol) -> Bool { + func isBefore(period: TimePeriodProtocol) -> Bool { return self.relation(to: period) == .before } @@ -362,7 +362,7 @@ public extension TimePeriodProtocol { * * - parameter timeInterval: The time interval to shift the period by */ - public mutating func shift(by timeInterval: TimeInterval) { + mutating func shift(by timeInterval: TimeInterval) { self.beginning?.addTimeInterval(timeInterval) self.end?.addTimeInterval(timeInterval) } @@ -372,7 +372,7 @@ public extension TimePeriodProtocol { * * - parameter chunk: The time chunk to shift the period by */ - public mutating func shift(by chunk: TimeChunk) { + mutating func shift(by chunk: TimeChunk) { self.beginning = self.beginning?.add(chunk) self.end = self.end?.add(chunk) } @@ -388,7 +388,7 @@ public extension TimePeriodProtocol { * - parameter timeInterval: The time interval to lengthen the period by * - parameter anchor: The anchor point from which to make the change */ - public mutating func lengthen(by timeInterval: TimeInterval, at anchor: Anchor) { + mutating func lengthen(by timeInterval: TimeInterval, at anchor: Anchor) { switch anchor { case .beginning: self.end = self.end?.addingTimeInterval(timeInterval) @@ -409,7 +409,7 @@ public extension TimePeriodProtocol { * - parameter chunk: The time chunk to lengthen the period by * - parameter anchor: The anchor point from which to make the change */ - public mutating func lengthen(by chunk: TimeChunk, at anchor: Anchor) { + mutating func lengthen(by chunk: TimeChunk, at anchor: Anchor) { switch anchor { case .beginning: self.end = self.end?.add(chunk) @@ -430,7 +430,7 @@ public extension TimePeriodProtocol { * - parameter timeInterval: The time interval to shorten the period by * - parameter anchor: The anchor point from which to make the change */ - public mutating func shorten(by timeInterval: TimeInterval, at anchor: Anchor) { + mutating func shorten(by timeInterval: TimeInterval, at anchor: Anchor) { switch anchor { case .beginning: self.end = self.end?.addingTimeInterval(-timeInterval) @@ -451,7 +451,7 @@ public extension TimePeriodProtocol { * - parameter chunk: The time chunk to shorten the period by * - parameter anchor: The anchor point from which to make the change */ - public mutating func shorten(by chunk: TimeChunk, at anchor: Anchor) { + mutating func shorten(by chunk: TimeChunk, at anchor: Anchor) { switch anchor { case .beginning: self.end = self.end?.subtract(chunk) diff --git a/DateToolsSwift/Examples/DateToolsExample/DateToolsExample.xcodeproj/project.pbxproj b/DateToolsSwift/Examples/DateToolsExample/DateToolsExample.xcodeproj/project.pbxproj index c430c6f0..603ead51 100644 --- a/DateToolsSwift/Examples/DateToolsExample/DateToolsExample.xcodeproj/project.pbxproj +++ b/DateToolsSwift/Examples/DateToolsExample/DateToolsExample.xcodeproj/project.pbxproj @@ -247,7 +247,7 @@ isa = PBXProject; attributes = { LastSwiftUpdateCheck = 0800; - LastUpgradeCheck = 0800; + LastUpgradeCheck = 1020; ORGANIZATIONNAME = "Matt York"; TargetAttributes = { 5666F5CE1DBA67FD00839BA5 = { @@ -271,7 +271,7 @@ }; buildConfigurationList = 5666F5CA1DBA67FD00839BA5 /* Build configuration list for PBXProject "DateToolsExample" */; compatibilityVersion = "Xcode 3.2"; - developmentRegion = English; + developmentRegion = en; hasScannedForEncodings = 0; knownRegions = ( en, @@ -398,20 +398,30 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; CLANG_ANALYZER_NONNULL = YES; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; CLANG_WARN_DOCUMENTATION_COMMENTS = YES; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_ENUM_CONVERSION = YES; CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; CLANG_WARN_SUSPICIOUS_MOVES = YES; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; @@ -447,20 +457,30 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; CLANG_ANALYZER_NONNULL = YES; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; CLANG_WARN_DOCUMENTATION_COMMENTS = YES; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_ENUM_CONVERSION = YES; CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; CLANG_WARN_SUSPICIOUS_MOVES = YES; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; @@ -494,7 +514,7 @@ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.MattYork.DateToolsExample; PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 3.0; + SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = "1,2"; }; name = Debug; @@ -508,7 +528,7 @@ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.MattYork.DateToolsExample; PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 3.0; + SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = "1,2"; }; name = Release; diff --git a/DateToolsSwift/Examples/DateToolsExample/DateToolsExample.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/DateToolsSwift/Examples/DateToolsExample/DateToolsExample.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 00000000..18d98100 --- /dev/null +++ b/DateToolsSwift/Examples/DateToolsExample/DateToolsExample.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/DateToolsSwift/Examples/DateToolsExample/DateToolsExample/AppDelegate.swift b/DateToolsSwift/Examples/DateToolsExample/DateToolsExample/AppDelegate.swift index ce5b7f56..132e1118 100644 --- a/DateToolsSwift/Examples/DateToolsExample/DateToolsExample/AppDelegate.swift +++ b/DateToolsSwift/Examples/DateToolsExample/DateToolsExample/AppDelegate.swift @@ -14,7 +14,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate { var window: UIWindow? - func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { + func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { // Override point for customization after application launch. return true } From 10ab4d6eed327a70495872c2af18a9a535fe13dc Mon Sep 17 00:00:00 2001 From: Jason Ji Date: Tue, 9 Jul 2019 08:42:02 -0400 Subject: [PATCH 6/8] Change unused vars to lets. Fixed misspelling of components. --- DateToolsSwift/DateTools/Date+Comparators.swift | 4 ++-- DateToolsSwift/DateTools/TimePeriodGroup.swift | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/DateToolsSwift/DateTools/Date+Comparators.swift b/DateToolsSwift/DateTools/Date+Comparators.swift index d068f4f3..cf718860 100644 --- a/DateToolsSwift/DateTools/Date+Comparators.swift +++ b/DateToolsSwift/DateTools/Date+Comparators.swift @@ -44,8 +44,8 @@ public extension Date { * - returns: A TimeChunk representing the time between the dates, in natural form */ func chunkBetween(date: Date) -> TimeChunk { - var compenentsBetween = Date.autoupdatingCurrentCalendar.dateComponents([.year, .month, .day, .hour, .minute, .second], from: self, to: date) - return TimeChunk(seconds: compenentsBetween.second!, minutes: compenentsBetween.minute!, hours: compenentsBetween.hour!, days: compenentsBetween.day!, weeks: 0, months: compenentsBetween.month!, years: compenentsBetween.year!) + let componentsBetween = Date.autoupdatingCurrentCalendar.dateComponents([.year, .month, .day, .hour, .minute, .second], from: self, to: date) + return TimeChunk(seconds: componentsBetween.second!, minutes: componentsBetween.minute!, hours: componentsBetween.hour!, days: componentsBetween.day!, weeks: 0, months: componentsBetween.month!, years: componentsBetween.year!) // TimeChunk(seconds: secondDelta, minutes: minuteDelta, hours: hourDelta, days: dayDelta, weeks: 0, months: monthDelta, years: yearDelta) } diff --git a/DateToolsSwift/DateTools/TimePeriodGroup.swift b/DateToolsSwift/DateTools/TimePeriodGroup.swift index b4a80942..240bda11 100644 --- a/DateToolsSwift/DateTools/TimePeriodGroup.swift +++ b/DateToolsSwift/DateTools/TimePeriodGroup.swift @@ -120,7 +120,7 @@ open class TimePeriodGroup: Sequence { return false // No need to sorting if they already have different counts } - var compArray1: [TimePeriodProtocol] = array1.sorted { (period1: TimePeriodProtocol, period2: TimePeriodProtocol) -> Bool in + let compArray1: [TimePeriodProtocol] = array1.sorted { (period1: TimePeriodProtocol, period2: TimePeriodProtocol) -> Bool in if period1.beginning == nil && period2.beginning == nil { return false } else if (period1.beginning == nil) { @@ -131,7 +131,7 @@ open class TimePeriodGroup: Sequence { return period2.beginning! < period1.beginning! } } - var compArray2: [TimePeriodProtocol] = array2.sorted { (period1: TimePeriodProtocol, period2: TimePeriodProtocol) -> Bool in + let compArray2: [TimePeriodProtocol] = array2.sorted { (period1: TimePeriodProtocol, period2: TimePeriodProtocol) -> Bool in if period1.beginning == nil && period2.beginning == nil { return false } else if (period1.beginning == nil) { From e1d5ef0317e31b145646b3332f05e3e75eb901d2 Mon Sep 17 00:00:00 2001 From: Jason Ji Date: Fri, 26 Jun 2020 20:53:17 -0400 Subject: [PATCH 7/8] Bump iOS and watchOS deployment targets. --- DateToolsSwift.podspec | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/DateToolsSwift.podspec b/DateToolsSwift.podspec index 7fc1ea72..14dde040 100644 --- a/DateToolsSwift.podspec +++ b/DateToolsSwift.podspec @@ -12,10 +12,10 @@ Pod::Spec.new do |s| s.source = { :git => "https://github.com/MatthewYork/DateTools.git", :tag => "#{s.version.to_s}" } - s.ios.deployment_target = '8.0' + s.ios.deployment_target = '9.0' s.osx.deployment_target = '10.9' s.tvos.deployment_target = '9.0' - s.watchos.deployment_target = '2.0' + s.watchos.deployment_target = '4.0' s.requires_arc = true s.source_files = 'DateToolsSwift/DateTools' From 5d555505dcf3834963e3eb1f92423c072f54cc6e Mon Sep 17 00:00:00 2001 From: Jason Ji Date: Tue, 10 Jun 2025 22:06:49 -0400 Subject: [PATCH 8/8] Get rid of the Obj-C stuff. Redo the README to clarify this is a fork of MatthewYork's project. --- .../contents.xcworkspacedata | 2 +- CREDITS.md | 76 - DateTools.podspec | 21 - DateTools/DateTools/DTConstants.h | 35 - DateTools/DateTools/DTConstants.m | 33 - DateTools/DateTools/DTError.h | 38 - DateTools/DateTools/DTError.m | 72 - DateTools/DateTools/DTTimePeriod.h | 123 -- DateTools/DateTools/DTTimePeriod.m | 642 ------ DateTools/DateTools/DTTimePeriodChain.h | 49 - DateTools/DateTools/DTTimePeriodChain.m | 218 --- DateTools/DateTools/DTTimePeriodCollection.h | 56 - DateTools/DateTools/DTTimePeriodCollection.m | 370 ---- DateTools/DateTools/DTTimePeriodGroup.h | 62 - DateTools/DateTools/DTTimePeriodGroup.m | 234 --- DateTools/DateTools/DateTools.h | 29 - DateTools/DateTools/NSDate+DateTools.h | 187 -- DateTools/DateTools/NSDate+DateTools.m | 1743 ----------------- .../DateTools macOS/DateTools macOS.h | 19 - .../DateTools macOS/Info.plist | 24 - .../DateToolsExample/DateTools/Info.plist | 26 - .../project.pbxproj | 1027 ---------- .../xcschemes/DateTools macOS.xcscheme | 80 - .../xcshareddata/xcschemes/DateTools.xcscheme | 129 -- .../DateToolsExample/AppDelegate.h | 15 - .../DateToolsExample/AppDelegate.m | 78 - .../DateToolsExample/Calendar.png | Bin 1230 -> 0 bytes .../DateToolsExample/Calendar@2x.png | Bin 1151 -> 0 bytes .../DateToolsExample/Calendar_filled.png | Bin 1214 -> 0 bytes .../DateToolsExample/Calendar_filled@2x.png | Bin 1278 -> 0 bytes .../DateToolsExample/Colours.h | 489 ----- .../DateToolsExample/Colours.m | 1303 ------------ .../DateToolsExample-Info.plist | 36 - .../DateToolsExample-Prefix.pch | 16 - .../DateToolsViewController.h | 13 - .../DateToolsViewController.m | 123 -- .../DateToolsViewController.xib | 157 -- .../ExampleNavigationController.h | 13 - .../ExampleNavigationController.m | 50 - .../AppIcon.appiconset/Contents.json | 23 - .../LaunchImage.launchimage/Contents.json | 23 - .../DateToolsExample/Recents.png | Bin 1452 -> 0 bytes .../DateToolsExample/Recents@2x.png | Bin 1654 -> 0 bytes .../DateToolsExample/Recents_filled.png | Bin 1356 -> 0 bytes .../DateToolsExample/Recents_filled@2x.png | Bin 1600 -> 0 bytes .../TimePeriodsViewController.h | 13 - .../TimePeriodsViewController.m | 188 -- .../TimePeriodsViewController.xib | 162 -- .../en.lproj/InfoPlist.strings | 2 - .../DateToolsExample/DateToolsExample/main.m | 18 - .../DateToolsExampleTests-Info.plist | 22 - .../en.lproj/InfoPlist.strings | 2 - .../DateToolsTests.xcodeproj/project.pbxproj | 560 ------ .../xcschemes/DateToolsTests.xcscheme | 96 - .../xcschemes/DateToolsTestsTests.xcscheme | 66 - .../DateToolsTests/AppDelegate.h | 15 - .../DateToolsTests/AppDelegate.m | 46 - .../DateToolsTests/Base.lproj/Main.storyboard | 30 - .../DateToolsTests/DateToolsTests-Info.plist | 40 - .../DateToolsTests/DateToolsTests-Prefix.pch | 16 - .../AppIcon.appiconset/Contents.json | 23 - .../LaunchImage.launchimage/Contents.json | 23 - .../DateToolsTests/ViewController.h | 13 - .../DateToolsTests/ViewController.m | 54 - .../DateToolsTests/en.lproj/InfoPlist.strings | 2 - .../DateToolsTests/es.lproj/InfoPlist.strings | 2 - .../DateToolsTests/es.lproj/Main.strings | 0 .../DateToolsTests/ja.lproj/InfoPlist.strings | 2 - .../DateToolsTests/ja.lproj/Main.strings | 0 .../DateToolsTests/DateToolsTests/main.m | 18 - .../DateToolsTestsTests/DTTimeAgoTests.m | 175 -- .../DTTimePeriodChainTests.m | 183 -- .../DTTimePeriodCollectionTests.m | 359 ---- .../DTTimePeriodGroupTests.m | 106 - .../DateToolsTestsTests/DTTimePeriodTests.m | 634 ------ .../DateToolsTestsTests/DateToolsTests.m | 693 ------- .../DateToolsTestsTests-Info.plist | 22 - .../en.lproj/InfoPlist.strings | 2 - .../es.lproj/InfoPlist.strings | 2 - .../ja.lproj/InfoPlist.strings | 2 - .../am.lproj/DateTools.strings | 89 - .../ar.lproj/DateTools.strings | Bin 3332 -> 0 bytes .../bg.lproj/DateTools.strings | 71 - .../ca.lproj/DateTools.strings | 71 - .../cs.lproj/DateTools.strings | 80 - .../cy.lproj/DateTools.strings | 71 - .../da.lproj/DateTools.strings | 71 - .../de.lproj/DateTools.strings | 80 - .../en.lproj/DateTools.strings | 106 - .../es.lproj/DateTools.strings | 83 - .../eu.lproj/DateTools.strings | 71 - .../fi.lproj/DateTools.strings | 71 - .../fr.lproj/DateTools.strings | 80 - .../gre.lproj/DateTools.strings | Bin 3494 -> 0 bytes .../gu.lproj/DateTools.strings | 89 - .../he.lproj/DateTools.strings | 71 - .../hi.lproj/DateTools.strings | 89 - .../hr.lproj/DateTools.strings | 44 - .../hu.lproj/DateTools.strings | 71 - .../id.lproj/DateTools.strings | 71 - .../is.lproj/DateTools.strings | 71 - .../it.lproj/DateTools.strings | 71 - .../ja.lproj/DateTools.strings | 90 - .../ko.lproj/DateTools.strings | 71 - .../lv.lproj/DateTools.strings | 24 - .../ms.lproj/DateTools.strings | 89 - .../nb.lproj/DateTools.strings | 125 -- .../nl.lproj/DateTools.strings | 71 - .../pl.lproj/DateTools.strings | 71 - .../pt-PT.lproj/DateTools.strings | 71 - .../pt.lproj/DateTools.strings | 71 - .../ro.lproj/DateTools.strings | 80 - .../ru.lproj/DateTools.strings | 125 -- .../sk.lproj/NSDateTimeAgo.strings | 71 - .../sl.lproj/DateTools.strings | 89 - .../sv.lproj/DateTools.strings | Bin 3430 -> 0 bytes .../th.lproj/DateTools.strings | Bin 3462 -> 0 bytes .../tr.lproj/DateTools.strings | 80 - .../uk.lproj/DateTools.strings | 125 -- .../vi.lproj/DateTools.strings | 71 - .../zh-Hans.lproj/DateTools.strings | 97 - .../zh-Hant.lproj/DateTools.strings | 97 - .../contents.xcworkspacedata | 7 - .../DateTools macOS/DateTools macOS.h | 19 - .../DateTools macOS/Info.plist | 24 - .../xcschemes/DateTools macOS.xcscheme | 80 - Package.swift | 23 +- README.md | 455 +---- .../DateToolsSwift}/Constants.swift | 0 .../DateToolsSwift}/Date+Bundle.swift | 0 .../DateToolsSwift}/Date+Comparators.swift | 0 .../DateToolsSwift}/Date+Components.swift | 0 .../DateToolsSwift}/Date+Format.swift | 0 .../DateToolsSwift}/Date+Inits.swift | 0 .../DateToolsSwift}/Date+Manipulations.swift | 0 .../DateToolsSwift}/Date+TimeAgo.swift | 0 .../am.lproj/DateTools.strings | 0 .../ar.lproj/DateTools.strings | Bin .../bg.lproj/DateTools.strings | 0 .../ca.lproj/DateTools.strings | 0 .../cs.lproj/DateTools.strings | 0 .../cy.lproj/DateTools.strings | 0 .../da.lproj/DateTools.strings | 0 .../de.lproj/DateTools.strings | 0 .../en.lproj/DateTools.strings | 0 .../es.lproj/DateTools.strings | 0 .../eu.lproj/DateTools.strings | 0 .../fi.lproj/DateTools.strings | 0 .../fr.lproj/DateTools.strings | 0 .../gre.lproj/DateTools.strings | Bin .../gu.lproj/DateTools.strings | 0 .../he.lproj/DateTools.strings | 0 .../hi.lproj/DateTools.strings | 0 .../hr.lproj/DateTools.strings | 0 .../hu.lproj/DateTools.strings | 0 .../id.lproj/DateTools.strings | 0 .../is.lproj/DateTools.strings | 0 .../it.lproj/DateTools.strings | 0 .../ja.lproj/DateTools.strings | 0 .../ko.lproj/DateTools.strings | 0 .../lv.lproj/DateTools.strings | 0 .../ms.lproj/DateTools.strings | 0 .../nb.lproj/DateTools.strings | 0 .../nl.lproj/DateTools.strings | 0 .../pl.lproj/DateTools.strings | 0 .../pt-PT.lproj/DateTools.strings | 0 .../pt.lproj/DateTools.strings | 0 .../ro.lproj/DateTools.strings | 0 .../ru.lproj/DateTools.strings | 0 .../sk.lproj/NSDateTimeAgo.strings | 0 .../sl.lproj/DateTools.strings | 0 .../sv.lproj/DateTools.strings | Bin .../th.lproj/DateTools.strings | Bin .../tr.lproj/DateTools.strings | 0 .../uk.lproj/DateTools.strings | 0 .../vi.lproj/DateTools.strings | 0 .../zh-Hans.lproj/DateTools.strings | 0 .../zh-Hant.lproj/DateTools.strings | 0 .../DateToolsSwift}/Enums.swift | 0 .../DateToolsSwift}/Integer+DateTools.swift | 0 .../DateToolsSwift}/TimeChunk.swift | 0 .../DateToolsSwift}/TimePeriod.swift | 0 .../DateToolsSwift}/TimePeriodChain.swift | 0 .../TimePeriodCollection.swift | 0 .../DateToolsSwift}/TimePeriodGroup.swift | 0 .../project.pbxproj | 0 .../contents.xcworkspacedata | 0 .../xcshareddata/IDEWorkspaceChecks.plist | 0 .../DateToolsExample/AppDelegate.swift | 0 .../AppIcon.appiconset/Contents.json | 0 .../first.imageset/Contents.json | 0 .../Assets.xcassets/first.imageset/first.pdf | Bin .../second.imageset/Contents.json | 0 .../second.imageset/second.pdf | Bin .../Base.lproj/LaunchScreen.storyboard | 0 .../Base.lproj/Main.storyboard | 0 .../ExtensionsViewController.swift | 0 .../DateToolsExample/Info.plist | 0 .../TimePeriodsViewController.swift | 0 .../DateToolsExampleTests.swift | 0 .../DateToolsExampleTests/Info.plist | 0 .../DateToolsExampleUITests.swift | 0 .../DateToolsExampleUITests/Info.plist | 0 .../DateToolsTests.xcodeproj/project.pbxproj | 0 .../contents.xcworkspacedata | 0 .../DateToolsTests/AppDelegate.swift | 0 .../AppIcon.appiconset/Contents.json | 0 .../Base.lproj/LaunchScreen.storyboard | 0 .../DateToolsTests/Base.lproj/Main.storyboard | 0 .../DateToolsTests/DateToolsTests/Info.plist | 0 .../DateToolsTests/ViewController.swift | 0 .../DateComparatorsExtensionTests.swift | 0 .../DateComponentsExtensionTests.swift | 0 .../DateFormatExtensionTests.swift | 0 .../DateInitsExtensionTests.swift | 0 .../DateManipulationsExtensionTests.swift | 0 .../DateTimeAgoExtensionTests.swift | 0 .../DateToolsTestsTests/Info.plist | 0 .../IntegerExtensionTests.swift | 0 .../DateToolsTestsTests/TimeAgoTests.swift | 0 .../DateToolsTestsTests/TimeChunkTests.swift | 0 .../TimePeriodChainTests.swift | 0 .../TimePeriodCollection.swift | 0 .../TimePeriodCollectionTests.swift | 0 .../TimePeriodGroupTests.swift | 0 .../DateToolsTestsTests/TimePeriodTests.swift | 0 {DateToolsSwift => Sources}/doc_gen.sh | 0 227 files changed, 24 insertions(+), 14848 deletions(-) rename {DateToolsSwift/Tests/DateToolsTests/DateToolsTests.xcodeproj/project.xcworkspace => .swiftpm/xcode/package.xcworkspace}/contents.xcworkspacedata (68%) delete mode 100644 CREDITS.md delete mode 100644 DateTools.podspec delete mode 100644 DateTools/DateTools/DTConstants.h delete mode 100644 DateTools/DateTools/DTConstants.m delete mode 100644 DateTools/DateTools/DTError.h delete mode 100644 DateTools/DateTools/DTError.m delete mode 100644 DateTools/DateTools/DTTimePeriod.h delete mode 100644 DateTools/DateTools/DTTimePeriod.m delete mode 100644 DateTools/DateTools/DTTimePeriodChain.h delete mode 100644 DateTools/DateTools/DTTimePeriodChain.m delete mode 100644 DateTools/DateTools/DTTimePeriodCollection.h delete mode 100644 DateTools/DateTools/DTTimePeriodCollection.m delete mode 100644 DateTools/DateTools/DTTimePeriodGroup.h delete mode 100644 DateTools/DateTools/DTTimePeriodGroup.m delete mode 100644 DateTools/DateTools/DateTools.h delete mode 100644 DateTools/DateTools/NSDate+DateTools.h delete mode 100644 DateTools/DateTools/NSDate+DateTools.m delete mode 100644 DateTools/Examples/DateToolsExample/DateTools macOS/DateTools macOS.h delete mode 100644 DateTools/Examples/DateToolsExample/DateTools macOS/Info.plist delete mode 100644 DateTools/Examples/DateToolsExample/DateTools/Info.plist delete mode 100644 DateTools/Examples/DateToolsExample/DateToolsExample.xcodeproj/project.pbxproj delete mode 100644 DateTools/Examples/DateToolsExample/DateToolsExample.xcodeproj/xcshareddata/xcschemes/DateTools macOS.xcscheme delete mode 100644 DateTools/Examples/DateToolsExample/DateToolsExample.xcodeproj/xcshareddata/xcschemes/DateTools.xcscheme delete mode 100644 DateTools/Examples/DateToolsExample/DateToolsExample/AppDelegate.h delete mode 100644 DateTools/Examples/DateToolsExample/DateToolsExample/AppDelegate.m delete mode 100755 DateTools/Examples/DateToolsExample/DateToolsExample/Calendar.png delete mode 100755 DateTools/Examples/DateToolsExample/DateToolsExample/Calendar@2x.png delete mode 100755 DateTools/Examples/DateToolsExample/DateToolsExample/Calendar_filled.png delete mode 100755 DateTools/Examples/DateToolsExample/DateToolsExample/Calendar_filled@2x.png delete mode 100755 DateTools/Examples/DateToolsExample/DateToolsExample/Colours.h delete mode 100755 DateTools/Examples/DateToolsExample/DateToolsExample/Colours.m delete mode 100644 DateTools/Examples/DateToolsExample/DateToolsExample/DateToolsExample-Info.plist delete mode 100644 DateTools/Examples/DateToolsExample/DateToolsExample/DateToolsExample-Prefix.pch delete mode 100644 DateTools/Examples/DateToolsExample/DateToolsExample/DateToolsViewController.h delete mode 100644 DateTools/Examples/DateToolsExample/DateToolsExample/DateToolsViewController.m delete mode 100644 DateTools/Examples/DateToolsExample/DateToolsExample/DateToolsViewController.xib delete mode 100644 DateTools/Examples/DateToolsExample/DateToolsExample/ExampleNavigationController.h delete mode 100644 DateTools/Examples/DateToolsExample/DateToolsExample/ExampleNavigationController.m delete mode 100644 DateTools/Examples/DateToolsExample/DateToolsExample/Images.xcassets/AppIcon.appiconset/Contents.json delete mode 100644 DateTools/Examples/DateToolsExample/DateToolsExample/Images.xcassets/LaunchImage.launchimage/Contents.json delete mode 100755 DateTools/Examples/DateToolsExample/DateToolsExample/Recents.png delete mode 100755 DateTools/Examples/DateToolsExample/DateToolsExample/Recents@2x.png delete mode 100755 DateTools/Examples/DateToolsExample/DateToolsExample/Recents_filled.png delete mode 100755 DateTools/Examples/DateToolsExample/DateToolsExample/Recents_filled@2x.png delete mode 100644 DateTools/Examples/DateToolsExample/DateToolsExample/TimePeriodsViewController.h delete mode 100644 DateTools/Examples/DateToolsExample/DateToolsExample/TimePeriodsViewController.m delete mode 100644 DateTools/Examples/DateToolsExample/DateToolsExample/TimePeriodsViewController.xib delete mode 100644 DateTools/Examples/DateToolsExample/DateToolsExample/en.lproj/InfoPlist.strings delete mode 100644 DateTools/Examples/DateToolsExample/DateToolsExample/main.m delete mode 100644 DateTools/Examples/DateToolsExample/DateToolsExampleTests/DateToolsExampleTests-Info.plist delete mode 100644 DateTools/Examples/DateToolsExample/DateToolsExampleTests/en.lproj/InfoPlist.strings delete mode 100644 DateTools/Tests/DateToolsTests/DateToolsTests.xcodeproj/project.pbxproj delete mode 100644 DateTools/Tests/DateToolsTests/DateToolsTests.xcodeproj/xcshareddata/xcschemes/DateToolsTests.xcscheme delete mode 100644 DateTools/Tests/DateToolsTests/DateToolsTests.xcodeproj/xcshareddata/xcschemes/DateToolsTestsTests.xcscheme delete mode 100644 DateTools/Tests/DateToolsTests/DateToolsTests/AppDelegate.h delete mode 100644 DateTools/Tests/DateToolsTests/DateToolsTests/AppDelegate.m delete mode 100644 DateTools/Tests/DateToolsTests/DateToolsTests/Base.lproj/Main.storyboard delete mode 100644 DateTools/Tests/DateToolsTests/DateToolsTests/DateToolsTests-Info.plist delete mode 100644 DateTools/Tests/DateToolsTests/DateToolsTests/DateToolsTests-Prefix.pch delete mode 100644 DateTools/Tests/DateToolsTests/DateToolsTests/Images.xcassets/AppIcon.appiconset/Contents.json delete mode 100644 DateTools/Tests/DateToolsTests/DateToolsTests/Images.xcassets/LaunchImage.launchimage/Contents.json delete mode 100644 DateTools/Tests/DateToolsTests/DateToolsTests/ViewController.h delete mode 100644 DateTools/Tests/DateToolsTests/DateToolsTests/ViewController.m delete mode 100644 DateTools/Tests/DateToolsTests/DateToolsTests/en.lproj/InfoPlist.strings delete mode 100644 DateTools/Tests/DateToolsTests/DateToolsTests/es.lproj/InfoPlist.strings delete mode 100644 DateTools/Tests/DateToolsTests/DateToolsTests/es.lproj/Main.strings delete mode 100644 DateTools/Tests/DateToolsTests/DateToolsTests/ja.lproj/InfoPlist.strings delete mode 100644 DateTools/Tests/DateToolsTests/DateToolsTests/ja.lproj/Main.strings delete mode 100644 DateTools/Tests/DateToolsTests/DateToolsTests/main.m delete mode 100644 DateTools/Tests/DateToolsTests/DateToolsTestsTests/DTTimeAgoTests.m delete mode 100644 DateTools/Tests/DateToolsTests/DateToolsTestsTests/DTTimePeriodChainTests.m delete mode 100644 DateTools/Tests/DateToolsTests/DateToolsTestsTests/DTTimePeriodCollectionTests.m delete mode 100644 DateTools/Tests/DateToolsTests/DateToolsTestsTests/DTTimePeriodGroupTests.m delete mode 100644 DateTools/Tests/DateToolsTests/DateToolsTestsTests/DTTimePeriodTests.m delete mode 100644 DateTools/Tests/DateToolsTests/DateToolsTestsTests/DateToolsTests.m delete mode 100644 DateTools/Tests/DateToolsTests/DateToolsTestsTests/DateToolsTestsTests-Info.plist delete mode 100644 DateTools/Tests/DateToolsTests/DateToolsTestsTests/en.lproj/InfoPlist.strings delete mode 100644 DateTools/Tests/DateToolsTests/DateToolsTestsTests/es.lproj/InfoPlist.strings delete mode 100644 DateTools/Tests/DateToolsTests/DateToolsTestsTests/ja.lproj/InfoPlist.strings delete mode 100755 DateToolsSwift/DateTools/DateTools.bundle/am.lproj/DateTools.strings delete mode 100644 DateToolsSwift/DateTools/DateTools.bundle/ar.lproj/DateTools.strings delete mode 100644 DateToolsSwift/DateTools/DateTools.bundle/bg.lproj/DateTools.strings delete mode 100644 DateToolsSwift/DateTools/DateTools.bundle/ca.lproj/DateTools.strings delete mode 100644 DateToolsSwift/DateTools/DateTools.bundle/cs.lproj/DateTools.strings delete mode 100644 DateToolsSwift/DateTools/DateTools.bundle/cy.lproj/DateTools.strings delete mode 100644 DateToolsSwift/DateTools/DateTools.bundle/da.lproj/DateTools.strings delete mode 100644 DateToolsSwift/DateTools/DateTools.bundle/de.lproj/DateTools.strings delete mode 100644 DateToolsSwift/DateTools/DateTools.bundle/en.lproj/DateTools.strings delete mode 100644 DateToolsSwift/DateTools/DateTools.bundle/es.lproj/DateTools.strings delete mode 100644 DateToolsSwift/DateTools/DateTools.bundle/eu.lproj/DateTools.strings delete mode 100644 DateToolsSwift/DateTools/DateTools.bundle/fi.lproj/DateTools.strings delete mode 100644 DateToolsSwift/DateTools/DateTools.bundle/fr.lproj/DateTools.strings delete mode 100644 DateToolsSwift/DateTools/DateTools.bundle/gre.lproj/DateTools.strings delete mode 100644 DateToolsSwift/DateTools/DateTools.bundle/gu.lproj/DateTools.strings delete mode 100755 DateToolsSwift/DateTools/DateTools.bundle/he.lproj/DateTools.strings delete mode 100644 DateToolsSwift/DateTools/DateTools.bundle/hi.lproj/DateTools.strings delete mode 100644 DateToolsSwift/DateTools/DateTools.bundle/hr.lproj/DateTools.strings delete mode 100644 DateToolsSwift/DateTools/DateTools.bundle/hu.lproj/DateTools.strings delete mode 100644 DateToolsSwift/DateTools/DateTools.bundle/id.lproj/DateTools.strings delete mode 100644 DateToolsSwift/DateTools/DateTools.bundle/is.lproj/DateTools.strings delete mode 100644 DateToolsSwift/DateTools/DateTools.bundle/it.lproj/DateTools.strings delete mode 100644 DateToolsSwift/DateTools/DateTools.bundle/ja.lproj/DateTools.strings delete mode 100755 DateToolsSwift/DateTools/DateTools.bundle/ko.lproj/DateTools.strings delete mode 100644 DateToolsSwift/DateTools/DateTools.bundle/lv.lproj/DateTools.strings delete mode 100644 DateToolsSwift/DateTools/DateTools.bundle/ms.lproj/DateTools.strings delete mode 100644 DateToolsSwift/DateTools/DateTools.bundle/nb.lproj/DateTools.strings delete mode 100644 DateToolsSwift/DateTools/DateTools.bundle/nl.lproj/DateTools.strings delete mode 100644 DateToolsSwift/DateTools/DateTools.bundle/pl.lproj/DateTools.strings delete mode 100644 DateToolsSwift/DateTools/DateTools.bundle/pt-PT.lproj/DateTools.strings delete mode 100644 DateToolsSwift/DateTools/DateTools.bundle/pt.lproj/DateTools.strings delete mode 100755 DateToolsSwift/DateTools/DateTools.bundle/ro.lproj/DateTools.strings delete mode 100644 DateToolsSwift/DateTools/DateTools.bundle/ru.lproj/DateTools.strings delete mode 100644 DateToolsSwift/DateTools/DateTools.bundle/sk.lproj/NSDateTimeAgo.strings delete mode 100644 DateToolsSwift/DateTools/DateTools.bundle/sl.lproj/DateTools.strings delete mode 100644 DateToolsSwift/DateTools/DateTools.bundle/sv.lproj/DateTools.strings delete mode 100644 DateToolsSwift/DateTools/DateTools.bundle/th.lproj/DateTools.strings delete mode 100644 DateToolsSwift/DateTools/DateTools.bundle/tr.lproj/DateTools.strings delete mode 100644 DateToolsSwift/DateTools/DateTools.bundle/uk.lproj/DateTools.strings delete mode 100644 DateToolsSwift/DateTools/DateTools.bundle/vi.lproj/DateTools.strings delete mode 100644 DateToolsSwift/DateTools/DateTools.bundle/zh-Hans.lproj/DateTools.strings delete mode 100644 DateToolsSwift/DateTools/DateTools.bundle/zh-Hant.lproj/DateTools.strings delete mode 100644 DateToolsSwift/Examples/DateToolsExample/DateToolsExample.xcodeproj/project.xcworkspace/contents.xcworkspacedata delete mode 100644 Examples/DateToolsExample/DateTools macOS/DateTools macOS.h delete mode 100644 Examples/DateToolsExample/DateTools macOS/Info.plist delete mode 100644 Examples/DateToolsExample/DateToolsExample.xcodeproj/xcshareddata/xcschemes/DateTools macOS.xcscheme rename {DateToolsSwift/DateTools => Sources/DateToolsSwift}/Constants.swift (100%) rename {DateToolsSwift/DateTools => Sources/DateToolsSwift}/Date+Bundle.swift (100%) rename {DateToolsSwift/DateTools => Sources/DateToolsSwift}/Date+Comparators.swift (100%) rename {DateToolsSwift/DateTools => Sources/DateToolsSwift}/Date+Components.swift (100%) rename {DateToolsSwift/DateTools => Sources/DateToolsSwift}/Date+Format.swift (100%) rename {DateToolsSwift/DateTools => Sources/DateToolsSwift}/Date+Inits.swift (100%) rename {DateToolsSwift/DateTools => Sources/DateToolsSwift}/Date+Manipulations.swift (100%) rename {DateToolsSwift/DateTools => Sources/DateToolsSwift}/Date+TimeAgo.swift (100%) rename {DateTools/DateTools => Sources/DateToolsSwift}/DateTools.bundle/am.lproj/DateTools.strings (100%) rename {DateTools/DateTools => Sources/DateToolsSwift}/DateTools.bundle/ar.lproj/DateTools.strings (100%) rename {DateTools/DateTools => Sources/DateToolsSwift}/DateTools.bundle/bg.lproj/DateTools.strings (100%) rename {DateTools/DateTools => Sources/DateToolsSwift}/DateTools.bundle/ca.lproj/DateTools.strings (100%) rename {DateTools/DateTools => Sources/DateToolsSwift}/DateTools.bundle/cs.lproj/DateTools.strings (100%) rename {DateTools/DateTools => Sources/DateToolsSwift}/DateTools.bundle/cy.lproj/DateTools.strings (100%) rename {DateTools/DateTools => Sources/DateToolsSwift}/DateTools.bundle/da.lproj/DateTools.strings (100%) rename {DateTools/DateTools => Sources/DateToolsSwift}/DateTools.bundle/de.lproj/DateTools.strings (100%) rename {DateTools/DateTools => Sources/DateToolsSwift}/DateTools.bundle/en.lproj/DateTools.strings (100%) rename {DateTools/DateTools => Sources/DateToolsSwift}/DateTools.bundle/es.lproj/DateTools.strings (100%) rename {DateTools/DateTools => Sources/DateToolsSwift}/DateTools.bundle/eu.lproj/DateTools.strings (100%) rename {DateTools/DateTools => Sources/DateToolsSwift}/DateTools.bundle/fi.lproj/DateTools.strings (100%) rename {DateTools/DateTools => Sources/DateToolsSwift}/DateTools.bundle/fr.lproj/DateTools.strings (100%) rename {DateTools/DateTools => Sources/DateToolsSwift}/DateTools.bundle/gre.lproj/DateTools.strings (100%) rename {DateTools/DateTools => Sources/DateToolsSwift}/DateTools.bundle/gu.lproj/DateTools.strings (100%) rename {DateTools/DateTools => Sources/DateToolsSwift}/DateTools.bundle/he.lproj/DateTools.strings (100%) rename {DateTools/DateTools => Sources/DateToolsSwift}/DateTools.bundle/hi.lproj/DateTools.strings (100%) rename {DateTools/DateTools => Sources/DateToolsSwift}/DateTools.bundle/hr.lproj/DateTools.strings (100%) rename {DateTools/DateTools => Sources/DateToolsSwift}/DateTools.bundle/hu.lproj/DateTools.strings (100%) rename {DateTools/DateTools => Sources/DateToolsSwift}/DateTools.bundle/id.lproj/DateTools.strings (100%) rename {DateTools/DateTools => Sources/DateToolsSwift}/DateTools.bundle/is.lproj/DateTools.strings (100%) rename {DateTools/DateTools => Sources/DateToolsSwift}/DateTools.bundle/it.lproj/DateTools.strings (100%) rename {DateTools/DateTools => Sources/DateToolsSwift}/DateTools.bundle/ja.lproj/DateTools.strings (100%) rename {DateTools/DateTools => Sources/DateToolsSwift}/DateTools.bundle/ko.lproj/DateTools.strings (100%) rename {DateTools/DateTools => Sources/DateToolsSwift}/DateTools.bundle/lv.lproj/DateTools.strings (100%) rename {DateTools/DateTools => Sources/DateToolsSwift}/DateTools.bundle/ms.lproj/DateTools.strings (100%) rename {DateTools/DateTools => Sources/DateToolsSwift}/DateTools.bundle/nb.lproj/DateTools.strings (100%) rename {DateTools/DateTools => Sources/DateToolsSwift}/DateTools.bundle/nl.lproj/DateTools.strings (100%) rename {DateTools/DateTools => Sources/DateToolsSwift}/DateTools.bundle/pl.lproj/DateTools.strings (100%) rename {DateTools/DateTools => Sources/DateToolsSwift}/DateTools.bundle/pt-PT.lproj/DateTools.strings (100%) rename {DateTools/DateTools => Sources/DateToolsSwift}/DateTools.bundle/pt.lproj/DateTools.strings (100%) rename {DateTools/DateTools => Sources/DateToolsSwift}/DateTools.bundle/ro.lproj/DateTools.strings (100%) rename {DateTools/DateTools => Sources/DateToolsSwift}/DateTools.bundle/ru.lproj/DateTools.strings (100%) rename {DateTools/DateTools => Sources/DateToolsSwift}/DateTools.bundle/sk.lproj/NSDateTimeAgo.strings (100%) rename {DateTools/DateTools => Sources/DateToolsSwift}/DateTools.bundle/sl.lproj/DateTools.strings (100%) rename {DateTools/DateTools => Sources/DateToolsSwift}/DateTools.bundle/sv.lproj/DateTools.strings (100%) rename {DateTools/DateTools => Sources/DateToolsSwift}/DateTools.bundle/th.lproj/DateTools.strings (100%) rename {DateTools/DateTools => Sources/DateToolsSwift}/DateTools.bundle/tr.lproj/DateTools.strings (100%) rename {DateTools/DateTools => Sources/DateToolsSwift}/DateTools.bundle/uk.lproj/DateTools.strings (100%) rename {DateTools/DateTools => Sources/DateToolsSwift}/DateTools.bundle/vi.lproj/DateTools.strings (100%) rename {DateTools/DateTools => Sources/DateToolsSwift}/DateTools.bundle/zh-Hans.lproj/DateTools.strings (100%) rename {DateTools/DateTools => Sources/DateToolsSwift}/DateTools.bundle/zh-Hant.lproj/DateTools.strings (100%) rename {DateToolsSwift/DateTools => Sources/DateToolsSwift}/Enums.swift (100%) rename {DateToolsSwift/DateTools => Sources/DateToolsSwift}/Integer+DateTools.swift (100%) rename {DateToolsSwift/DateTools => Sources/DateToolsSwift}/TimeChunk.swift (100%) rename {DateToolsSwift/DateTools => Sources/DateToolsSwift}/TimePeriod.swift (100%) rename {DateToolsSwift/DateTools => Sources/DateToolsSwift}/TimePeriodChain.swift (100%) rename {DateToolsSwift/DateTools => Sources/DateToolsSwift}/TimePeriodCollection.swift (100%) rename {DateToolsSwift/DateTools => Sources/DateToolsSwift}/TimePeriodGroup.swift (100%) rename {DateToolsSwift => Sources}/Examples/DateToolsExample/DateToolsExample.xcodeproj/project.pbxproj (100%) rename {DateTools => Sources}/Examples/DateToolsExample/DateToolsExample.xcodeproj/project.xcworkspace/contents.xcworkspacedata (100%) rename {DateToolsSwift => Sources}/Examples/DateToolsExample/DateToolsExample.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist (100%) rename {DateToolsSwift => Sources}/Examples/DateToolsExample/DateToolsExample/AppDelegate.swift (100%) rename {DateToolsSwift => Sources}/Examples/DateToolsExample/DateToolsExample/Assets.xcassets/AppIcon.appiconset/Contents.json (100%) rename {DateToolsSwift => Sources}/Examples/DateToolsExample/DateToolsExample/Assets.xcassets/first.imageset/Contents.json (100%) rename {DateToolsSwift => Sources}/Examples/DateToolsExample/DateToolsExample/Assets.xcassets/first.imageset/first.pdf (100%) rename {DateToolsSwift => Sources}/Examples/DateToolsExample/DateToolsExample/Assets.xcassets/second.imageset/Contents.json (100%) rename {DateToolsSwift => Sources}/Examples/DateToolsExample/DateToolsExample/Assets.xcassets/second.imageset/second.pdf (100%) rename {DateToolsSwift => Sources}/Examples/DateToolsExample/DateToolsExample/Base.lproj/LaunchScreen.storyboard (100%) rename {DateToolsSwift => Sources}/Examples/DateToolsExample/DateToolsExample/Base.lproj/Main.storyboard (100%) rename {DateToolsSwift => Sources}/Examples/DateToolsExample/DateToolsExample/ExtensionsViewController.swift (100%) rename {DateToolsSwift => Sources}/Examples/DateToolsExample/DateToolsExample/Info.plist (100%) rename {DateToolsSwift => Sources}/Examples/DateToolsExample/DateToolsExample/TimePeriodsViewController.swift (100%) rename {DateToolsSwift => Sources}/Examples/DateToolsExample/DateToolsExampleTests/DateToolsExampleTests.swift (100%) rename {DateToolsSwift => Sources}/Examples/DateToolsExample/DateToolsExampleTests/Info.plist (100%) rename {DateToolsSwift => Sources}/Examples/DateToolsExample/DateToolsExampleUITests/DateToolsExampleUITests.swift (100%) rename {DateToolsSwift => Sources}/Examples/DateToolsExample/DateToolsExampleUITests/Info.plist (100%) rename {DateToolsSwift => Sources}/Tests/DateToolsTests/DateToolsTests.xcodeproj/project.pbxproj (100%) rename {DateTools => Sources}/Tests/DateToolsTests/DateToolsTests.xcodeproj/project.xcworkspace/contents.xcworkspacedata (100%) rename {DateToolsSwift => Sources}/Tests/DateToolsTests/DateToolsTests/AppDelegate.swift (100%) rename {DateToolsSwift => Sources}/Tests/DateToolsTests/DateToolsTests/Assets.xcassets/AppIcon.appiconset/Contents.json (100%) rename {DateToolsSwift => Sources}/Tests/DateToolsTests/DateToolsTests/Base.lproj/LaunchScreen.storyboard (100%) rename {DateToolsSwift => Sources}/Tests/DateToolsTests/DateToolsTests/Base.lproj/Main.storyboard (100%) rename {DateToolsSwift => Sources}/Tests/DateToolsTests/DateToolsTests/Info.plist (100%) rename {DateToolsSwift => Sources}/Tests/DateToolsTests/DateToolsTests/ViewController.swift (100%) rename {DateToolsSwift => Sources}/Tests/DateToolsTests/DateToolsTestsTests/DateComparatorsExtensionTests.swift (100%) rename {DateToolsSwift => Sources}/Tests/DateToolsTests/DateToolsTestsTests/DateComponentsExtensionTests.swift (100%) rename {DateToolsSwift => Sources}/Tests/DateToolsTests/DateToolsTestsTests/DateFormatExtensionTests.swift (100%) rename {DateToolsSwift => Sources}/Tests/DateToolsTests/DateToolsTestsTests/DateInitsExtensionTests.swift (100%) rename {DateToolsSwift => Sources}/Tests/DateToolsTests/DateToolsTestsTests/DateManipulationsExtensionTests.swift (100%) rename {DateToolsSwift => Sources}/Tests/DateToolsTests/DateToolsTestsTests/DateTimeAgoExtensionTests.swift (100%) rename {DateToolsSwift => Sources}/Tests/DateToolsTests/DateToolsTestsTests/Info.plist (100%) rename {DateToolsSwift => Sources}/Tests/DateToolsTests/DateToolsTestsTests/IntegerExtensionTests.swift (100%) rename {DateToolsSwift => Sources}/Tests/DateToolsTests/DateToolsTestsTests/TimeAgoTests.swift (100%) rename {DateToolsSwift => Sources}/Tests/DateToolsTests/DateToolsTestsTests/TimeChunkTests.swift (100%) rename {DateToolsSwift => Sources}/Tests/DateToolsTests/DateToolsTestsTests/TimePeriodChainTests.swift (100%) rename {DateToolsSwift => Sources}/Tests/DateToolsTests/DateToolsTestsTests/TimePeriodCollection.swift (100%) rename {DateToolsSwift => Sources}/Tests/DateToolsTests/DateToolsTestsTests/TimePeriodCollectionTests.swift (100%) rename {DateToolsSwift => Sources}/Tests/DateToolsTests/DateToolsTestsTests/TimePeriodGroupTests.swift (100%) rename {DateToolsSwift => Sources}/Tests/DateToolsTests/DateToolsTestsTests/TimePeriodTests.swift (100%) rename {DateToolsSwift => Sources}/doc_gen.sh (100%) diff --git a/DateToolsSwift/Tests/DateToolsTests/DateToolsTests.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata similarity index 68% rename from DateToolsSwift/Tests/DateToolsTests/DateToolsTests.xcodeproj/project.xcworkspace/contents.xcworkspacedata rename to .swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata index 366d7c7a..919434a6 100644 --- a/DateToolsSwift/Tests/DateToolsTests/DateToolsTests.xcodeproj/project.xcworkspace/contents.xcworkspacedata +++ b/.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata @@ -2,6 +2,6 @@ + location = "self:"> diff --git a/CREDITS.md b/CREDITS.md deleted file mode 100644 index 6a407f51..00000000 --- a/CREDITS.md +++ /dev/null @@ -1,76 +0,0 @@ -Credits -======= - -Portions from NSDate+TimeAgo Originally based on code Christopher Pickslay posted to Forrst. Used with permission. http://twitter.com/cpickslay - -Ramon Torres began support for internationalization/localization. Added es strings. http://rtorres.me/ - -Dennis Zhuang added zh_Hans Chinese Simplified strings. http://fnil.net/ - -Mozart Petter added pt_BR Brazilian Portuguese strings. http://www.mozartpetter.com/ - -Stéphane Gerardot added fr French strings. - -Marco Sanson added it Italian strings. http://marcosanson.tumblr.com/ - -Almas Adilbek added ru Russian strings. Extended logic to support Russian idioms. http://mixdesign.kz/ - -Mallox51 added de German strings. https://github.com/Mallox51 - -Tieme van Veen added nl Dutch strings. http://www.tiemevanveen.nl - -Árpád Goretity added hu Hungarian strings. http://apaczai.elte.hu/~13akga/ - -Anajavi added fi Finnish strings. https://github.com/anajavi - -Tonydyb added ja Japanese strings. - -Vinhnx added vi Vietnamese strings. http://vinhnx.github.io/ - -Ronail added zh_Hant Traditional Chinese strings. https://github.com/ronail - -SorinAntohi added ro Romanian strings. https://github.com/SorinAntohi - -spookd added da Danish strings. https://github.com/spookd - -Barrett Jacobsen added cs Czech strings. https://github.com/barrettj - -Dmitry Shmidt added nb Norwegian strings. https://github.com/shmidt - -Martins Rudens added lv Latvian strings. https://github.com/rudensm - -Osman Saral added tr Turkish strings. https://github.com/osrl - -analogstyle added ko Korean strings. http://almacreative.net/ - -Flavio Caetano fixed pt Portuguese strings. http://flaviocaetano.com - -kolarski added bg Bulgarian strings. http://github.com/kolarski - -Vladimir Kofman added he Hebrew strings. https://github.com/vladimirkofman - -Viraf Sarkari added ar Arabic, gre Greek, pl Polish, sv Swedish, and th Thai strings. https://github.com/viraf - -Vasyl Skrypii added uk Ukranian strings. https://github.com/medlay - -Maggi Trymbill added is Icelandic strings. https://github.com/grundvollur - -Ikhsan Assaat added id Indonesian strings. http://ikhsan.me - -Marc added ca Catalan strings. http://marcboquet.com/ - -Steffan Harries added cy Welsh strings. https://github.com/Bendihossan - -mjanda added es and cs short format strings https://github.com/mjanda - -Niklas Fahl added the de short format strings https://github.com/fahlout - -Vlad Cacuic added the ro short format strings https://github.com/vrcaciuc - -frin added sl Slovenian strings. http://github.com/frin - -Nikhil Nigade added hi (Hindi) and gu (Gujarati) strings. https://github.com/dezinezync - -Faiz Mokhtar added ms Malay strings. https://github.com/faizmokhtar - -Jakub Olejník (https://github.com/olejnjak) and Jakub Truhlář (https://github.com/kubatru) added sk (Slovak) strings diff --git a/DateTools.podspec b/DateTools.podspec deleted file mode 100644 index 59280884..00000000 --- a/DateTools.podspec +++ /dev/null @@ -1,21 +0,0 @@ -Pod::Spec.new do |s| - s.name = 'DateTools' - s.version = '2.0.0' - s.summary = 'Dates and time made easy in Objective-C' - s.homepage = 'https://github.com/MatthewYork/DateTools' - - s.description = 'DateTools was written to streamline date and time handling in Objective-C.' - - s.license = { :type => 'MIT', :file => 'LICENSE' } - s.author = { "Matthew York" => "my3681@gmail.com" } - - s.source = { :git => "https://github.com/MatthewYork/DateTools.git", - :tag => "v#{s.version.to_s}" } - - s.platforms = { :ios => '7.0', :osx => '10.7' } - - s.requires_arc = true - - s.source_files = 'DateTools/DateTools' - s.resources = 'DateTools/DateTools/DateTools.bundle' -end diff --git a/DateTools/DateTools/DTConstants.h b/DateTools/DateTools/DTConstants.h deleted file mode 100644 index b9fcccf0..00000000 --- a/DateTools/DateTools/DTConstants.h +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright (C) 2014 by Matthew York -// -// Permission is hereby granted, free of charge, to any -// person obtaining a copy of this software and -// associated documentation files (the "Software"), to -// deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the -// Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall -// be included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES -// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS -// BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -#import - -FOUNDATION_EXPORT const long long SECONDS_IN_YEAR; -FOUNDATION_EXPORT const NSInteger SECONDS_IN_MONTH_28; -FOUNDATION_EXPORT const NSInteger SECONDS_IN_MONTH_29; -FOUNDATION_EXPORT const NSInteger SECONDS_IN_MONTH_30; -FOUNDATION_EXPORT const NSInteger SECONDS_IN_MONTH_31; -FOUNDATION_EXPORT const NSInteger SECONDS_IN_WEEK; -FOUNDATION_EXPORT const NSInteger SECONDS_IN_DAY; -FOUNDATION_EXPORT const NSInteger SECONDS_IN_HOUR; -FOUNDATION_EXPORT const NSInteger SECONDS_IN_MINUTE; -FOUNDATION_EXPORT const NSInteger MILLISECONDS_IN_DAY; -#import "DTError.h" \ No newline at end of file diff --git a/DateTools/DateTools/DTConstants.m b/DateTools/DateTools/DTConstants.m deleted file mode 100644 index 2320dea9..00000000 --- a/DateTools/DateTools/DTConstants.m +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright (C) 2014 by Matthew York -// -// Permission is hereby granted, free of charge, to any -// person obtaining a copy of this software and -// associated documentation files (the "Software"), to -// deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the -// Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall -// be included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES -// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS -// BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -#import "DTConstants.h" -const long long SECONDS_IN_YEAR = 31556900; -const NSInteger SECONDS_IN_MONTH_28 = 2419200; -const NSInteger SECONDS_IN_MONTH_29 = 2505600; -const NSInteger SECONDS_IN_MONTH_30 = 2592000; -const NSInteger SECONDS_IN_MONTH_31 = 2678400; -const NSInteger SECONDS_IN_WEEK = 604800; -const NSInteger SECONDS_IN_DAY = 86400; -const NSInteger SECONDS_IN_HOUR = 3600; -const NSInteger SECONDS_IN_MINUTE = 60; -const NSInteger MILLISECONDS_IN_DAY = 86400000; \ No newline at end of file diff --git a/DateTools/DateTools/DTError.h b/DateTools/DateTools/DTError.h deleted file mode 100644 index 0fff9dc6..00000000 --- a/DateTools/DateTools/DTError.h +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright (C) 2014 by Matthew York -// -// Permission is hereby granted, free of charge, to any -// person obtaining a copy of this software and -// associated documentation files (the "Software"), to -// deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the -// Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall -// be included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES -// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS -// BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -#import - -#pragma mark - Domain -extern NSString *const DTErrorDomain; - -#pragma mark - Status Codes -static const NSUInteger DTInsertOutOfBoundsException = 0; -static const NSUInteger DTRemoveOutOfBoundsException = 1; -static const NSUInteger DTBadTypeException = 2; - -@interface DTError : NSObject - -+(void)throwInsertOutOfBoundsException:(NSInteger)index array:(NSArray *)array; -+(void)throwRemoveOutOfBoundsException:(NSInteger)index array:(NSArray *)array; -+(void)throwBadTypeException:(id)obj expectedClass:(Class)classType; -@end diff --git a/DateTools/DateTools/DTError.m b/DateTools/DateTools/DTError.m deleted file mode 100644 index f2b67157..00000000 --- a/DateTools/DateTools/DTError.m +++ /dev/null @@ -1,72 +0,0 @@ -// Copyright (C) 2014 by Matthew York -// -// Permission is hereby granted, free of charge, to any -// person obtaining a copy of this software and -// associated documentation files (the "Software"), to -// deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the -// Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall -// be included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES -// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS -// BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -#import "DTError.h" - -#pragma mark - Domain -NSString *const DTErrorDomain = @"com.mattyork.dateTools"; - -@implementation DTError - -+(void)throwInsertOutOfBoundsException:(NSInteger)index array:(NSArray *)array{ - //Handle possible zero bounds - NSInteger arrayUpperBound = (array.count == 0)? 0:array.count; - - //Create info for error - NSDictionary *userInfo = @{NSLocalizedDescriptionKey: NSLocalizedString(@"Operation was unsuccessful.", nil), NSLocalizedFailureReasonErrorKey: [NSString stringWithFormat:@"Attempted to insert DTTimePeriod at index %ld but the group is of size [0...%ld].", (long)index, (long)arrayUpperBound],NSLocalizedRecoverySuggestionErrorKey: NSLocalizedString(@"Please try an index within the bounds or the group.", nil)}; - - //Handle Error - NSError *error = [NSError errorWithDomain:DTErrorDomain code:DTInsertOutOfBoundsException userInfo:userInfo]; - [self printErrorWithCallStack:error]; -} - -+(void)throwRemoveOutOfBoundsException:(NSInteger)index array:(NSArray *)array{ - //Handle possible zero bounds - NSInteger arrayUpperBound = (array.count == 0)? 0:array.count; - - //Create info for error - NSDictionary *userInfo = @{NSLocalizedDescriptionKey: NSLocalizedString(@"Operation was unsuccessful.", nil), NSLocalizedFailureReasonErrorKey: [NSString stringWithFormat:@"Attempted to remove DTTimePeriod at index %ld but the group is of size [0...%ld].", (long)index, (long)arrayUpperBound],NSLocalizedRecoverySuggestionErrorKey: NSLocalizedString(@"Please try an index within the bounds of the group.", nil)}; - - //Handle Error - NSError *error = [NSError errorWithDomain:DTErrorDomain code:DTRemoveOutOfBoundsException userInfo:userInfo]; - [self printErrorWithCallStack:error]; -} - -+(void)throwBadTypeException:(id)obj expectedClass:(Class)classType{ - //Create info for error - NSDictionary *userInfo = @{NSLocalizedDescriptionKey: NSLocalizedString(@"Operation was unsuccessful.", nil), NSLocalizedFailureReasonErrorKey: [NSString stringWithFormat:@"Attempted to insert object of class %@ when expecting object of class %@.", NSStringFromClass([obj class]), NSStringFromClass(classType)],NSLocalizedRecoverySuggestionErrorKey: NSLocalizedString(@"Please try again by inserting a DTTimePeriod object.", nil)}; - - //Handle Error - NSError *error = [NSError errorWithDomain:DTErrorDomain code:DTBadTypeException userInfo:userInfo]; - [self printErrorWithCallStack:error]; -} - -+(void)printErrorWithCallStack:(NSError *)error{ - //Print error - NSLog(@"%@", error); - - //Print call stack - for (NSString *symbol in [NSThread callStackSymbols]) { - NSLog(@"\n\n %@", symbol); - } -} -@end diff --git a/DateTools/DateTools/DTTimePeriod.h b/DateTools/DateTools/DTTimePeriod.h deleted file mode 100644 index aa1ff8ed..00000000 --- a/DateTools/DateTools/DTTimePeriod.h +++ /dev/null @@ -1,123 +0,0 @@ -// Copyright (C) 2014 by Matthew York -// -// Permission is hereby granted, free of charge, to any -// person obtaining a copy of this software and -// associated documentation files (the "Software"), to -// deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the -// Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall -// be included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES -// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS -// BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -#import - - -typedef NS_ENUM(NSUInteger, DTTimePeriodRelation){ - DTTimePeriodRelationAfter, - DTTimePeriodRelationStartTouching, - DTTimePeriodRelationStartInside, - DTTimePeriodRelationInsideStartTouching, - DTTimePeriodRelationEnclosingStartTouching, - DTTimePeriodRelationEnclosing, - DTTimePeriodRelationEnclosingEndTouching, - DTTimePeriodRelationExactMatch, - DTTimePeriodRelationInside, - DTTimePeriodRelationInsideEndTouching, - DTTimePeriodRelationEndInside, - DTTimePeriodRelationEndTouching, - DTTimePeriodRelationBefore, - DTTimePeriodRelationNone //One or more of the dates does not exist -}; - -typedef NS_ENUM(NSUInteger, DTTimePeriodSize) { - DTTimePeriodSizeSecond, - DTTimePeriodSizeMinute, - DTTimePeriodSizeHour, - DTTimePeriodSizeDay, - DTTimePeriodSizeWeek, - DTTimePeriodSizeMonth, - DTTimePeriodSizeYear -}; - -typedef NS_ENUM(NSUInteger, DTTimePeriodInterval) { - DTTimePeriodIntervalOpen, - DTTimePeriodIntervalClosed -}; - -typedef NS_ENUM(NSUInteger, DTTimePeriodAnchor) { - DTTimePeriodAnchorStart, - DTTimePeriodAnchorCenter, - DTTimePeriodAnchorEnd -}; - -@interface DTTimePeriod : NSObject - -/** - * The start date for a DTTimePeriod representing the starting boundary of the time period - */ -@property (nonatomic,strong) NSDate *StartDate; - -/** - * The end date for a DTTimePeriod representing the ending boundary of the time period - */ -@property (nonatomic,strong) NSDate *EndDate; - -#pragma mark - Custom Init / Factory Methods --(instancetype)initWithStartDate:(NSDate *)startDate endDate:(NSDate *)endDate; -+(instancetype)timePeriodWithStartDate:(NSDate *)startDate endDate:(NSDate *)endDate; -+(instancetype)timePeriodWithSize:(DTTimePeriodSize)size startingAt:(NSDate *)date; -+(instancetype)timePeriodWithSize:(DTTimePeriodSize)size amount:(NSInteger)amount startingAt:(NSDate *)date; -+(instancetype)timePeriodWithSize:(DTTimePeriodSize)size endingAt:(NSDate *)date; -+(instancetype)timePeriodWithSize:(DTTimePeriodSize)size amount:(NSInteger)amount endingAt:(NSDate *)date; -+(instancetype)timePeriodWithAllTime; - -#pragma mark - Time Period Information --(BOOL)hasStartDate; --(BOOL)hasEndDate; --(BOOL)isMoment; --(double)durationInYears; --(double)durationInWeeks; --(double)durationInDays; --(double)durationInHours; --(double)durationInMinutes; --(double)durationInSeconds; - -#pragma mark - Time Period Relationship --(BOOL)isEqualToPeriod:(DTTimePeriod *)period; --(BOOL)isInside:(DTTimePeriod *)period; --(BOOL)contains:(DTTimePeriod *)period; --(BOOL)overlapsWith:(DTTimePeriod *)period; --(BOOL)intersects:(DTTimePeriod *)period; --(DTTimePeriodRelation)relationToPeriod:(DTTimePeriod *)period; --(NSTimeInterval)gapBetween:(DTTimePeriod *)period; - -#pragma mark - Date Relationships --(BOOL)containsDate:(NSDate *)date interval:(DTTimePeriodInterval)interval; - -#pragma mark - Period Manipulation -#pragma mark Shifts --(void)shiftEarlierWithSize:(DTTimePeriodSize)size; --(void)shiftEarlierWithSize:(DTTimePeriodSize)size amount:(NSInteger)amount; --(void)shiftLaterWithSize:(DTTimePeriodSize)size; --(void)shiftLaterWithSize:(DTTimePeriodSize)size amount:(NSInteger)amount; - -#pragma mark Lengthen / Shorten --(void)lengthenWithAnchorDate:(DTTimePeriodAnchor)anchor size:(DTTimePeriodSize)size; --(void)lengthenWithAnchorDate:(DTTimePeriodAnchor)anchor size:(DTTimePeriodSize)size amount:(NSInteger)amount; --(void)shortenWithAnchorDate:(DTTimePeriodAnchor)anchor size:(DTTimePeriodSize)size; --(void)shortenWithAnchorDate:(DTTimePeriodAnchor)anchor size:(DTTimePeriodSize)size amount:(NSInteger)amount; - -#pragma mark - Helper Methods --(DTTimePeriod *)copy; -@end diff --git a/DateTools/DateTools/DTTimePeriod.m b/DateTools/DateTools/DTTimePeriod.m deleted file mode 100644 index 364288fc..00000000 --- a/DateTools/DateTools/DTTimePeriod.m +++ /dev/null @@ -1,642 +0,0 @@ -// Copyright (C) 2014 by Matthew York -// -// Permission is hereby granted, free of charge, to any -// person obtaining a copy of this software and -// associated documentation files (the "Software"), to -// deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the -// Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall -// be included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES -// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS -// BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -#import "DTTimePeriod.h" -#import "NSDate+DateTools.h" - -@interface DTTimePeriod () - -@end - - -@implementation DTTimePeriod - -#pragma mark - Custom Init / Factory Methods -/** - * Initializes an instance of DTTimePeriod from a given start and end date - * - * @param startDate NSDate - Desired start date - * @param endDate NSDate - Desired end date - * - * @return DTTimePeriod - new instance - */ --(instancetype)initWithStartDate:(NSDate *)startDate endDate:(NSDate *)endDate{ - if (self = [super init]) { - self.StartDate = startDate; - self.EndDate = endDate; - } - - return self; -} - -/** - * Returns a new instance of DTTimePeriod from a given start and end date - * - * @param startDate NSDate - Desired start date - * @param endDate NSDate - Desired end date - * - * @return DTTimePeriod - new instance - */ -+(instancetype)timePeriodWithStartDate:(NSDate *)startDate endDate:(NSDate *)endDate{ - return [[self.class alloc] initWithStartDate:startDate endDate:endDate]; -} - -/** - * Returns a new instance of DTTimePeriod that starts on the provided start date - * and is of the size provided - * - * @param size DTTimePeriodSize - Desired size of the new time period - * @param date NSDate - Desired start date of the new time period - * - * @return DTTimePeriod - new instance - */ -+(instancetype)timePeriodWithSize:(DTTimePeriodSize)size startingAt:(NSDate *)date{ - return [[self.class alloc] initWithStartDate:date endDate:[DTTimePeriod dateWithAddedTime:size amount:1 baseDate:date]]; -} - -/** - * Returns a new instance of DTTimePeriod that starts on the provided start date - * and is of the size provided. The amount represents a multipler to the size (e.g. "2 weeks" or "4 years") - * - * @param size DTTimePeriodSize - Desired size of the new time period - * @param amount NSInteger - Desired multiplier of the size provided - * @param date NSDate - Desired start date of the new time period - * - * @return DTTimePeriod - new instance - */ -+(instancetype)timePeriodWithSize:(DTTimePeriodSize)size amount:(NSInteger)amount startingAt:(NSDate *)date{ - return [[self.class alloc] initWithStartDate:date endDate:[DTTimePeriod dateWithAddedTime:size amount:amount baseDate:date]]; -} - -/** - * Returns a new instance of DTTimePeriod that ends on the provided end date - * and is of the size provided - * - * @param size DTTimePeriodSize - Desired size of the new time period - * @param date NSDate - Desired end date of the new time period - * - * @return DTTimePeriod - new instance - */ -+(instancetype)timePeriodWithSize:(DTTimePeriodSize)size endingAt:(NSDate *)date{ - return [[self.class alloc] initWithStartDate:[DTTimePeriod dateWithSubtractedTime:size amount:1 baseDate:date] endDate:date]; -} - -/** - * Returns a new instance of DTTimePeriod that ends on the provided end date - * and is of the size provided. The amount represents a multipler to the size (e.g. "2 weeks" or "4 years") - * - * @param size DTTimePeriodSize - Desired size of the new time period - * @param amount NSInteger - Desired multiplier of the size provided - * @param date NSDate - Desired end date of the new time period - * - * @return DTTimePeriod - new instance - */ -+(instancetype)timePeriodWithSize:(DTTimePeriodSize)size amount:(NSInteger)amount endingAt:(NSDate *)date{ - return [[self.class alloc] initWithStartDate:[DTTimePeriod dateWithSubtractedTime:size amount:amount baseDate:date] endDate:date]; -} - -/** - * Returns a new instance of DTTimePeriod that represents the largest time period available. - * The start date is in the distant past and the end date is in the distant future. - * - * @return DTTimePeriod - new instance - */ -+(instancetype)timePeriodWithAllTime{ - return [[self.class alloc] initWithStartDate:[NSDate distantPast] endDate:[NSDate distantFuture]]; -} - -/** - * Method serving the various factory methods as well as a few others. - * Returns a date with time added to a given base date. Includes multiplier amount. - * - * @param size DTTimePeriodSize - Desired size of the new time period - * @param amount NSInteger - Desired multiplier of the size provided - * @param date NSDate - Desired end date of the new time period - * - * @return NSDate - new instance - */ -+(NSDate *)dateWithAddedTime:(DTTimePeriodSize)size amount:(NSInteger)amount baseDate:(NSDate *)date{ - switch (size) { - case DTTimePeriodSizeSecond: - return [date dateByAddingSeconds:amount]; - break; - case DTTimePeriodSizeMinute: - return [date dateByAddingMinutes:amount]; - break; - case DTTimePeriodSizeHour: - return [date dateByAddingHours:amount]; - break; - case DTTimePeriodSizeDay: - return [date dateByAddingDays:amount]; - break; - case DTTimePeriodSizeWeek: - return [date dateByAddingWeeks:amount]; - break; - case DTTimePeriodSizeMonth: - return [date dateByAddingMonths:amount]; - break; - case DTTimePeriodSizeYear: - return [date dateByAddingYears:amount]; - break; - default: - break; - } - - return date; -} - -/** - * Method serving the various factory methods as well as a few others. - * Returns a date with time subtracted from a given base date. Includes multiplier amount. - * - * @param size DTTimePeriodSize - Desired size of the new time period - * @param amount NSInteger - Desired multiplier of the size provided - * @param date NSDate - Desired end date of the new time period - * - * @return NSDate - new instance - */ -+(NSDate *)dateWithSubtractedTime:(DTTimePeriodSize)size amount:(NSInteger)amount baseDate:(NSDate *)date{ - switch (size) { - case DTTimePeriodSizeSecond: - return [date dateBySubtractingSeconds:amount]; - break; - case DTTimePeriodSizeMinute: - return [date dateBySubtractingMinutes:amount]; - break; - case DTTimePeriodSizeHour: - return [date dateBySubtractingHours:amount]; - break; - case DTTimePeriodSizeDay: - return [date dateBySubtractingDays:amount]; - break; - case DTTimePeriodSizeWeek: - return [date dateBySubtractingWeeks:amount]; - break; - case DTTimePeriodSizeMonth: - return [date dateBySubtractingMonths:amount]; - break; - case DTTimePeriodSizeYear: - return [date dateBySubtractingYears:amount]; - break; - default: - break; - } - - return date; -} - -#pragma mark - Time Period Information -/** - * Returns a boolean representing whether the receiver's StartDate exists - * Returns YES if StartDate is not nil, otherwise NO - * - * @return BOOL - */ --(BOOL)hasStartDate { - return (self.StartDate)? YES:NO; -} - -/** - * Returns a boolean representing whether the receiver's EndDate exists - * Returns YES if EndDate is not nil, otherwise NO - * - * @return BOOL - */ --(BOOL)hasEndDate { - return (self.EndDate)? YES:NO; -} - -/** - * Returns a boolean representing whether the receiver is a "moment", that is the start and end dates are the same. - * Returns YES if receiver is a moment, otherwise NO - * - * @return BOOL - */ --(BOOL)isMoment{ - if (self.StartDate && self.EndDate) { - if ([self.StartDate isEqualToDate:self.EndDate]) { - return YES; - } - } - - return NO; -} - -/** - * Returns the duration of the receiver in years - * - * @return NSInteger - */ --(double)durationInYears { - if (self.StartDate && self.EndDate) { - return [self.StartDate yearsEarlierThan:self.EndDate]; - } - - return 0; -} - -/** - * Returns the duration of the receiver in weeks - * - * @return double - */ --(double)durationInWeeks { - if (self.StartDate && self.EndDate) { - return [self.StartDate weeksEarlierThan:self.EndDate]; - } - - return 0; -} - -/** - * Returns the duration of the receiver in days - * - * @return double - */ --(double)durationInDays { - if (self.StartDate && self.EndDate) { - return [self.StartDate daysEarlierThan:self.EndDate]; - } - - return 0; -} - -/** - * Returns the duration of the receiver in hours - * - * @return double - */ --(double)durationInHours { - if (self.StartDate && self.EndDate) { - return [self.StartDate hoursEarlierThan:self.EndDate]; - } - - return 0; -} - -/** - * Returns the duration of the receiver in minutes - * - * @return double - */ --(double)durationInMinutes { - if (self.StartDate && self.EndDate) { - return [self.StartDate minutesEarlierThan:self.EndDate]; - } - - return 0; -} - -/** - * Returns the duration of the receiver in seconds - * - * @return double - */ --(double)durationInSeconds { - if (self.StartDate && self.EndDate) { - return [self.StartDate secondsEarlierThan:self.EndDate]; - } - - return 0; -} - -#pragma mark - Time Period Relationship -/** - * Returns a BOOL representing whether the receiver's start and end dates exatcly match a given time period - * Returns YES if the two periods are the same, otherwise NO - * - * @param period DTTimePeriod - Time period to compare to receiver - * - * @return BOOL - */ --(BOOL)isEqualToPeriod:(DTTimePeriod *)period{ - if ([self.StartDate isEqualToDate:period.StartDate] && [self.EndDate isEqualToDate:period.EndDate]) { - return YES; - } - return NO; -} - -/** - * Returns a BOOL representing whether the receiver's start and end dates exatcly match a given time period or is contained within them - * Returns YES if the receiver is inside the given time period, otherwise NO - * - * @param period DTTimePeriod - Time period to compare to receiver - * - * @return BOOL - */ --(BOOL)isInside:(DTTimePeriod *)period{ - if ([period.StartDate isEarlierThanOrEqualTo:self.StartDate] && [period.EndDate isLaterThanOrEqualTo:self.EndDate]) { - return YES; - } - return NO; -} - -/** - * Returns a BOOL representing whether the given time period's start and end dates exatcly match the receivers' or is contained within them - * Returns YES if the receiver is inside the given time period, otherwise NO - * - * @param period DTTimePeriod - Time period to compare to receiver - * - * @return BOOL - */ --(BOOL)contains:(DTTimePeriod *)period{ - if ([self.StartDate isEarlierThanOrEqualTo:period.StartDate] && [self.EndDate isLaterThanOrEqualTo:period.EndDate]) { - return YES; - } - return NO; -} - -/** - * Returns a BOOL representing whether the receiver and the given time period overlap. - * This covers all space they share, minus instantaneous space (i.e. one's start date equals another's end date) - * Returns YES if they overlap, otherwise NO - * - * @param period DTTimePeriod - Time period to compare to receiver - * - * @return BOOL - */ --(BOOL)overlapsWith:(DTTimePeriod *)period{ - //Outside -> Inside - if ([period.StartDate isEarlierThan:self.StartDate] && [period.EndDate isLaterThan:self.StartDate]) { - return YES; - } - //Enclosing - else if ([period.StartDate isLaterThanOrEqualTo:self.StartDate] && [period.EndDate isEarlierThanOrEqualTo:self.EndDate]){ - return YES; - } - //Inside -> Out - else if([period.StartDate isEarlierThan:self.EndDate] && [period.EndDate isLaterThan:self.EndDate]){ - return YES; - } - return NO; -} - -/** - * Returns a BOOL representing whether the receiver and the given time period overlap. - * This covers all space they share, including instantaneous space (i.e. one's start date equals another's end date) - * Returns YES if they overlap, otherwise NO - * - * @param period DTTimePeriod - Time period to compare to receiver - * - * @return BOOL - */ --(BOOL)intersects:(DTTimePeriod *)period{ - //Outside -> Inside - if ([period.StartDate isEarlierThan:self.StartDate] && [period.EndDate isLaterThanOrEqualTo:self.StartDate]) { - return YES; - } - //Enclosing - else if ([period.StartDate isLaterThanOrEqualTo:self.StartDate] && [period.EndDate isEarlierThanOrEqualTo:self.EndDate]){ - return YES; - } - //Inside -> Out - else if([period.StartDate isEarlierThanOrEqualTo:self.EndDate] && [period.EndDate isLaterThan:self.EndDate]){ - return YES; - } - return NO; -} - -/** - * Returns the relationship of the receiver to a given time period - * - * @param period DTTimePeriod - Time period to compare to receiver - * - * @return DTTimePeriodRelation - */ --(DTTimePeriodRelation)relationToPeriod:(DTTimePeriod *)period{ - - //Make sure that all start and end points exist for comparison - if (self.StartDate && self.EndDate && period.StartDate && period.EndDate) { - //Make sure time periods are of positive durations - if ([self.StartDate isEarlierThan:self.EndDate] && [period.StartDate isEarlierThan:period.EndDate]) { - - //Make comparisons - if ([period.EndDate isEarlierThan:self.StartDate]) { - return DTTimePeriodRelationAfter; - } - else if ([period.EndDate isEqualToDate:self.StartDate]){ - return DTTimePeriodRelationStartTouching; - } - else if ([period.StartDate isEarlierThan:self.StartDate] && [period.EndDate isEarlierThan:self.EndDate]){ - return DTTimePeriodRelationStartInside; - } - else if ([period.StartDate isEqualToDate:self.StartDate] && [period.EndDate isLaterThan:self.EndDate]){ - return DTTimePeriodRelationInsideStartTouching; - } - else if ([period.StartDate isEqualToDate:self.StartDate] && [period.EndDate isEarlierThan:self.EndDate]){ - return DTTimePeriodRelationEnclosingStartTouching; - } - else if ([period.StartDate isLaterThan:self.StartDate] && [period.EndDate isEarlierThan:self.EndDate]){ - return DTTimePeriodRelationEnclosing; - } - else if ([period.StartDate isLaterThan:self.StartDate] && [period.EndDate isEqualToDate:self.EndDate]){ - return DTTimePeriodRelationEnclosingEndTouching; - } - else if ([period.StartDate isEqualToDate:self.StartDate] && [period.EndDate isEqualToDate:self.EndDate]){ - return DTTimePeriodRelationExactMatch; - } - else if ([period.StartDate isEarlierThan:self.StartDate] && [period.EndDate isLaterThan:self.EndDate]){ - return DTTimePeriodRelationInside; - } - else if ([period.StartDate isEarlierThan:self.StartDate] && [period.EndDate isEqualToDate:self.EndDate]){ - return DTTimePeriodRelationInsideEndTouching; - } - else if ([period.StartDate isEarlierThan:self.EndDate] && [period.EndDate isLaterThan:self.EndDate]){ - return DTTimePeriodRelationEndInside; - } - else if ([period.StartDate isEqualToDate:self.EndDate] && [period.EndDate isLaterThan:self.EndDate]){ - return DTTimePeriodRelationEndTouching; - } - else if ([period.StartDate isLaterThan:self.EndDate]){ - return DTTimePeriodRelationBefore; - } - } - } - - return DTTimePeriodRelationNone; -} - -/** - * Returns the gap in seconds between the receiver and provided time period - * Returns 0 if the time periods intersect, otherwise returns the gap between. - * - * @param period <#period description#> - * - * @return <#return value description#> - */ --(NSTimeInterval)gapBetween:(DTTimePeriod *)period{ - if ([self.EndDate isEarlierThan:period.StartDate]) { - return ABS([self.EndDate timeIntervalSinceDate:period.StartDate]); - } - else if ([period.EndDate isEarlierThan:self.StartDate]){ - return ABS([period.EndDate timeIntervalSinceDate:self.StartDate]); - } - - return 0; -} - -#pragma mark - Date Relationships -/** - * Returns a BOOL representing whether the provided date is contained in the receiver. - * - * @param date NSDate - Date to evaluate - * @param interval DTTimePeriodInterval representing evaluation type (Closed includes StartDate and EndDate in evaluation, Open does not) - * - * @return <#return value description#> - */ --(BOOL)containsDate:(NSDate *)date interval:(DTTimePeriodInterval)interval{ - if (interval == DTTimePeriodIntervalOpen) { - if ([self.StartDate isEarlierThan:date] && [self.EndDate isLaterThan:date]) { - return YES; - } - else { - return NO; - } - } - else if (interval == DTTimePeriodIntervalClosed){ - if ([self.StartDate isEarlierThanOrEqualTo:date] && [self.EndDate isLaterThanOrEqualTo:date]) { - return YES; - } - else { - return NO; - } - } - - return NO; -} - -#pragma mark - Period Manipulation -/** - * Shifts the StartDate and EndDate earlier by a given size amount - * - * @param size DTTimePeriodSize - Desired shift size - */ --(void)shiftEarlierWithSize:(DTTimePeriodSize)size{ - [self shiftEarlierWithSize:size amount:1]; -} - -/** - * Shifts the StartDate and EndDate earlier by a given size amount. Amount multiplies size. - * - * @param size DTTimePeriodSize - Desired shift size - * @param amount NSInteger - Multiplier of size (i.e. "2 weeks" or "4 years") - */ --(void)shiftEarlierWithSize:(DTTimePeriodSize)size amount:(NSInteger)amount{ - self.StartDate = [DTTimePeriod dateWithSubtractedTime:size amount:amount baseDate:self.StartDate]; - self.EndDate = [DTTimePeriod dateWithSubtractedTime:size amount:amount baseDate:self.EndDate]; -} - -/** - * Shifts the StartDate and EndDate later by a given size amount - * - * @param size DTTimePeriodSize - Desired shift size - */ --(void)shiftLaterWithSize:(DTTimePeriodSize)size{ - [self shiftLaterWithSize:size amount:1]; -} - -/** - * Shifts the StartDate and EndDate later by a given size amount. Amount multiplies size. - * - * @param size DTTimePeriodSize - Desired shift size - * @param amount NSInteger - Multiplier of size (i.e. "2 weeks" or "4 years") - */ --(void)shiftLaterWithSize:(DTTimePeriodSize)size amount:(NSInteger)amount{ - self.StartDate = [DTTimePeriod dateWithAddedTime:size amount:amount baseDate:self.StartDate]; - self.EndDate = [DTTimePeriod dateWithAddedTime:size amount:amount baseDate:self.EndDate]; -} - -#pragma mark Lengthen / Shorten -/** - * Lengthens the receiver by a given amount, anchored by a provided point - * - * @param anchor DTTimePeriodAnchor - Anchor point for the lengthen (the date that stays the same) - * @param size DTTimePeriodSize - Desired lenghtening size - */ --(void)lengthenWithAnchorDate:(DTTimePeriodAnchor)anchor size:(DTTimePeriodSize)size{ - [self lengthenWithAnchorDate:anchor size:size amount:1]; -} -/** - * Lengthens the receiver by a given amount, anchored by a provided point. Amount multiplies size. - * - * @param anchor DTTimePeriodAnchor - Anchor point for the lengthen (the date that stays the same) - * @param size DTTimePeriodSize - Desired lenghtening size - * @param amount NSInteger - Multiplier of size (i.e. "2 weeks" or "4 years") - */ --(void)lengthenWithAnchorDate:(DTTimePeriodAnchor)anchor size:(DTTimePeriodSize)size amount:(NSInteger)amount{ - switch (anchor) { - case DTTimePeriodAnchorStart: - self.EndDate = [DTTimePeriod dateWithAddedTime:size amount:amount baseDate:self.EndDate]; - break; - case DTTimePeriodAnchorCenter: - self.StartDate = [DTTimePeriod dateWithSubtractedTime:size amount:amount/2 baseDate:self.StartDate]; - self.EndDate = [DTTimePeriod dateWithAddedTime:size amount:amount/2 baseDate:self.EndDate]; - break; - case DTTimePeriodAnchorEnd: - self.StartDate = [DTTimePeriod dateWithSubtractedTime:size amount:amount baseDate:self.StartDate]; - break; - default: - break; - } -} - -/** - * Shortens the receiver by a given amount, anchored by a provided point - * - * @param anchor DTTimePeriodAnchor - Anchor point for the shorten (the date that stays the same) - * @param size DTTimePeriodSize - Desired shortening size - */ --(void)shortenWithAnchorDate:(DTTimePeriodAnchor)anchor size:(DTTimePeriodSize)size{ - [self shortenWithAnchorDate:anchor size:size amount:1]; -} - -/** - * Shortens the receiver by a given amount, anchored by a provided point. Amount multiplies size. - * - * @param anchor DTTimePeriodAnchor - Anchor point for the shorten (the date that stays the same) - * @param size DTTimePeriodSize - Desired shortening size - * @param amount NSInteger - Multiplier of size (i.e. "2 weeks" or "4 years") - */ --(void)shortenWithAnchorDate:(DTTimePeriodAnchor)anchor size:(DTTimePeriodSize)size amount:(NSInteger)amount{ - switch (anchor) { - case DTTimePeriodAnchorStart: - self.EndDate = [DTTimePeriod dateWithSubtractedTime:size amount:amount baseDate:self.EndDate]; - break; - case DTTimePeriodAnchorCenter: - self.StartDate = [DTTimePeriod dateWithAddedTime:size amount:amount/2 baseDate:self.StartDate]; - self.EndDate = [DTTimePeriod dateWithSubtractedTime:size amount:amount/2 baseDate:self.EndDate]; - break; - case DTTimePeriodAnchorEnd: - self.StartDate = [DTTimePeriod dateWithAddedTime:size amount:amount baseDate:self.StartDate]; - break; - default: - break; - } -} - -#pragma mark - Helper Methods --(DTTimePeriod *)copy{ - DTTimePeriod *period = [DTTimePeriod timePeriodWithStartDate:[NSDate dateWithTimeIntervalSince1970:self.StartDate.timeIntervalSince1970] endDate:[NSDate dateWithTimeIntervalSince1970:self.EndDate.timeIntervalSince1970]]; - return period; -} - -@end diff --git a/DateTools/DateTools/DTTimePeriodChain.h b/DateTools/DateTools/DTTimePeriodChain.h deleted file mode 100644 index 21ef0b8c..00000000 --- a/DateTools/DateTools/DTTimePeriodChain.h +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright (C) 2014 by Matthew York -// -// Permission is hereby granted, free of charge, to any -// person obtaining a copy of this software and -// associated documentation files (the "Software"), to -// deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the -// Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall -// be included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES -// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS -// BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -#import -#import "DTTimePeriodGroup.h" - -@interface DTTimePeriodChain : DTTimePeriodGroup { - DTTimePeriod *First; - DTTimePeriod *Last; -} - -@property (nonatomic, readonly) DTTimePeriod *First; -@property (nonatomic, readonly) DTTimePeriod *Last; - -#pragma mark - Custom Init / Factory Chain -+(DTTimePeriodChain *)chain; - -#pragma mark - Chain Existence Manipulation --(void)addTimePeriod:(DTTimePeriod *)period; --(void)insertTimePeriod:(DTTimePeriod *)period atInedx:(NSInteger)index; --(void)removeTimePeriodAtIndex:(NSInteger)index; --(void)removeLatestTimePeriod; --(void)removeEarliestTimePeriod; - -#pragma mark - Chain Relationship --(BOOL)isEqualToChain:(DTTimePeriodChain *)chain; - -#pragma mark - Updates --(void)updateVariables; -@end diff --git a/DateTools/DateTools/DTTimePeriodChain.m b/DateTools/DateTools/DTTimePeriodChain.m deleted file mode 100644 index c33dae06..00000000 --- a/DateTools/DateTools/DTTimePeriodChain.m +++ /dev/null @@ -1,218 +0,0 @@ -// Copyright (C) 2014 by Matthew York -// -// Permission is hereby granted, free of charge, to any -// person obtaining a copy of this software and -// associated documentation files (the "Software"), to -// deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the -// Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall -// be included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES -// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS -// BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -#import "DTTimePeriodChain.h" -#import "DTError.h" - -@interface DTTimePeriodChain () - -@end - -@implementation DTTimePeriodChain - -#pragma mark - Custom Init / Factory Chain -+(DTTimePeriodChain *)chain{ - return [[DTTimePeriodChain alloc] init]; -} - -#pragma mark - Chain Existence Manipulation --(void)addTimePeriod:(DTTimePeriod *)period{ - if ([period class] != [DTTimePeriod class]) { - [DTError throwBadTypeException:period expectedClass:[DTTimePeriod class]]; - return; - } - - if (periods) { - if (periods.count > 0) { - //Create a modified period to be added based on size of passed in period - DTTimePeriod *modifiedPeriod = [DTTimePeriod timePeriodWithSize:DTTimePeriodSizeSecond amount:period.durationInSeconds startingAt:[periods[periods.count - 1] EndDate]]; - - //Add object to periods array - [periods addObject:modifiedPeriod]; - } - else { - //Add object to periods array - [periods addObject:period]; - } - } - else { - //Create new periods array - periods = [NSMutableArray array]; - - //Add object to periods array - [periods addObject:period]; - } - - //Set object's variables with updated array values - [self updateVariables]; -} - --(void)insertTimePeriod:(DTTimePeriod *)period atInedx:(NSInteger)index{ - if ([period class] != [DTTimePeriod class]) { - [DTError throwBadTypeException:period expectedClass:[DTTimePeriod class]]; - return; - } - - //Make sure the index is within the operable bounds of the periods array - if (index == 0) { - //Update bounds of period to make it fit in chain - DTTimePeriod *modifiedPeriod = [DTTimePeriod timePeriodWithSize:DTTimePeriodSizeSecond amount:period.durationInSeconds endingAt:[periods[0] EndDate]]; - - //Insert the updated object at the beginning of the periods array - [periods insertObject:modifiedPeriod atIndex:0]; - } - else if (index > 0 && index < periods.count) { - - //Shift time periods later if they fall after new period - [periods enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) { - //Shift later - if (idx >= index) { - [((DTTimePeriod *) obj) shiftLaterWithSize:DTTimePeriodSizeSecond amount:period.durationInSeconds]; - } - }]; - - //Update bounds of period to make it fit in chain - DTTimePeriod *modifiedPeriod = [DTTimePeriod timePeriodWithSize:DTTimePeriodSizeSecond amount:period.durationInSeconds startingAt:[periods[index - 1] EndDate]]; - - //Insert the updated object at the beginning of the periods array - [periods insertObject:modifiedPeriod atIndex:index]; - - //Set object's variables with updated array values - [self updateVariables]; - } - else { - [DTError throwInsertOutOfBoundsException:index array:periods]; - } -} - --(void)removeTimePeriodAtIndex:(NSInteger)index{ - //Make sure the index is within the operable bounds of the periods array - if (index >= 0 && index < periods.count) { - DTTimePeriod *period = periods[index]; - - //Shift time periods later if they fall after new period - [periods enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) { - //Shift earlier - if (idx > index) { - [((DTTimePeriod *) obj) shiftEarlierWithSize:DTTimePeriodSizeSecond amount:period.durationInSeconds]; - } - }]; - - //Remove object - [periods removeObjectAtIndex:index]; - - //Set object's variables with updated array values - [self updateVariables]; - } - else { - [DTError throwRemoveOutOfBoundsException:index array:periods]; - } -} --(void)removeLatestTimePeriod{ - if (periods.count > 0) { - [periods removeLastObject]; - - //Update the object variables - if (periods.count > 0) { - //Set object's variables with updated array values - [self updateVariables]; - } - else { - [self setVariablesNil]; - } - } -} --(void)removeEarliestTimePeriod{ - if (periods > 0) { - //Shift time periods earlier - [periods enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) { - //Shift earlier to account for removal of first element in periods array - [((DTTimePeriod *) obj) shiftEarlierWithSize:DTTimePeriodSizeSecond amount:[periods[0] durationInSeconds]]; - }]; - - //Remove first period - [periods removeObjectAtIndex:0]; - - //Update the object variables - if (periods.count > 0) { - //Set object's variables with updated array values - [self updateVariables]; - } - else { - [self setVariablesNil]; - } - } -} - -#pragma mark - Chain Relationship --(BOOL)isEqualToChain:(DTTimePeriodChain *)chain{ - //Check class - if ([chain class] != [DTTimePeriodChain class]) { - [DTError throwBadTypeException:chain expectedClass:[DTTimePeriodChain class]]; - return NO; - } - - //Check group level characteristics for speed - if (![self hasSameCharacteristicsAs:chain]) { - return NO; - } - - //Check whole chain - __block BOOL isEqual = YES; - [periods enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) { - if (![chain[idx] isEqualToPeriod:obj]) { - isEqual = NO; - *stop = YES; - } - }]; - return isEqual; -} - -#pragma mark - Getters - --(DTTimePeriod *)First{ - return First; -} - --(DTTimePeriod *)Last{ - return Last; -} - -#pragma mark - Helper Methods - --(void)updateVariables{ - //Set helper variables - StartDate = [periods[0] StartDate]; - EndDate = [periods[periods.count - 1] EndDate]; - First = periods[0]; - Last = periods[periods.count -1]; -} - --(void)setVariablesNil{ - //Set helper variables - StartDate = nil; - EndDate = nil; - First = nil; - Last = nil; -} - -@end diff --git a/DateTools/DateTools/DTTimePeriodCollection.h b/DateTools/DateTools/DTTimePeriodCollection.h deleted file mode 100644 index f3d47377..00000000 --- a/DateTools/DateTools/DTTimePeriodCollection.h +++ /dev/null @@ -1,56 +0,0 @@ -// Copyright (C) 2014 by Matthew York -// -// Permission is hereby granted, free of charge, to any -// person obtaining a copy of this software and -// associated documentation files (the "Software"), to -// deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the -// Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall -// be included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES -// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS -// BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -#import -#import "DTTimePeriodGroup.h" - -@interface DTTimePeriodCollection : DTTimePeriodGroup - -#pragma mark - Custom Init / Factory Methods -+(DTTimePeriodCollection *)collection; - -#pragma mark - Collection Manipulation --(void)addTimePeriod:(DTTimePeriod *)period; --(void)insertTimePeriod:(DTTimePeriod *)period atIndex:(NSInteger)index; --(void)removeTimePeriodAtIndex:(NSInteger)index; - -#pragma mark - Sorting --(void)sortByStartAscending; --(void)sortByStartDescending; --(void)sortByEndAscending; --(void)sortByEndDescending; --(void)sortByDurationAscending; --(void)sortByDurationDescending; - -#pragma mark - Collection Relationship --(DTTimePeriodCollection *)periodsInside:(DTTimePeriod *)period; --(DTTimePeriodCollection *)periodsIntersectedByDate:(NSDate *)date; --(DTTimePeriodCollection *)periodsIntersectedByPeriod:(DTTimePeriod *)period; --(DTTimePeriodCollection *)periodsOverlappedByPeriod:(DTTimePeriod *)period; --(BOOL)isEqualToCollection:(DTTimePeriodCollection *)collection considerOrder:(BOOL)considerOrder; - -#pragma mark - Helper Methods --(DTTimePeriodCollection *)copy; - -#pragma mark - Updates --(void)updateVariables; -@end diff --git a/DateTools/DateTools/DTTimePeriodCollection.m b/DateTools/DateTools/DTTimePeriodCollection.m deleted file mode 100644 index ff621759..00000000 --- a/DateTools/DateTools/DTTimePeriodCollection.m +++ /dev/null @@ -1,370 +0,0 @@ -// Copyright (C) 2014 by Matthew York -// -// Permission is hereby granted, free of charge, to any -// person obtaining a copy of this software and -// associated documentation files (the "Software"), to -// deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the -// Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall -// be included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES -// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS -// BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -#import "DTTimePeriodCollection.h" -#import "DTError.h" -#import "NSDate+DateTools.h" - -@implementation DTTimePeriodCollection - -#pragma mark - Custom Init / Factory Methods -/** - * Initializes a new instance of DTTimePeriodCollection - * - * @return DTTimePeriodCollection - */ -+(DTTimePeriodCollection *)collection{ - return [[DTTimePeriodCollection alloc] init]; -} - -#pragma mark - Collection Manipulation -/** - * Adds a time period to the reciever. - * - * @param period DTTimePeriod - The time period to add to the collection - */ --(void)addTimePeriod:(DTTimePeriod *)period{ - if ([period isKindOfClass:[DTTimePeriod class]]) { - [periods addObject:period]; - - //Set object's variables with updated array values - [self updateVariables]; - } - else { - [DTError throwBadTypeException:period expectedClass:[DTTimePeriod class]]; - } -} - -/** - * Inserts a time period to the receiver at a given index. - * - * @param period DTTimePeriod - The time period to insert into the collection - * @param index NSInteger - The index in the collection the time period is to be added at - */ --(void)insertTimePeriod:(DTTimePeriod *)period atIndex:(NSInteger)index{ - if ([period class] != [DTTimePeriod class]) { - [DTError throwBadTypeException:period expectedClass:[DTTimePeriod class]]; - return; - } - - if (index >= 0 && index < periods.count) { - [periods insertObject:period atIndex:index]; - - //Set object's variables with updated array values - [self updateVariables]; - } - else { - [DTError throwInsertOutOfBoundsException:index array:periods]; - } -} - -/** - * Removes the time period at a given index from the collection - * - * @param index NSInteger - The index in the collection the time period is to be removed from - */ --(void)removeTimePeriodAtIndex:(NSInteger)index{ - if (index >= 0 && index < periods.count) { - [periods removeObjectAtIndex:index]; - - //Update the object variables - if (periods.count > 0) { - //Set object's variables with updated array values - [self updateVariables]; - } - else { - [self setVariablesNil]; - } - } - else { - [DTError throwRemoveOutOfBoundsException:index array:periods]; - } -} - - - -#pragma mark - Sorting -/** - * Sorts the time periods in the collection by earliest start date to latest start date. - */ --(void)sortByStartAscending{ - [periods sortUsingComparator:^NSComparisonResult(id obj1, id obj2) { - return [((DTTimePeriod *) obj1).StartDate compare:((DTTimePeriod *) obj2).StartDate]; - }]; -} - -/** - * Sorts the time periods in the collection by latest start date to earliest start date. - */ --(void)sortByStartDescending{ - [periods sortUsingComparator:^NSComparisonResult(id obj1, id obj2) { - return [((DTTimePeriod *) obj2).StartDate compare:((DTTimePeriod *) obj1).StartDate]; - }]; -} - -/** - * Sorts the time periods in the collection by earliest end date to latest end date. - */ --(void)sortByEndAscending{ - [periods sortUsingComparator:^NSComparisonResult(id obj1, id obj2) { - return [((DTTimePeriod *) obj1).EndDate compare:((DTTimePeriod *) obj2).EndDate]; - }]; -} - -/** - * Sorts the time periods in the collection by latest end date to earliest end date. - */ --(void)sortByEndDescending{ - [periods sortUsingComparator:^NSComparisonResult(id obj1, id obj2) { - return [((DTTimePeriod *) obj2).EndDate compare:((DTTimePeriod *) obj1).EndDate]; - }]; -} - -/** - * Sorts the time periods in the collection by how much time they span. Sorts smallest durations to longest. - */ --(void)sortByDurationAscending{ - [periods sortUsingComparator:^NSComparisonResult(id obj1, id obj2) { - if (((DTTimePeriod *) obj1).durationInSeconds < ((DTTimePeriod *) obj2).durationInSeconds) { - return NSOrderedAscending; - } - else { - return NSOrderedDescending; - } - return NSOrderedSame; - }]; -} - -/** - * Sorts the time periods in the collection by how much time they span. Sorts longest durations to smallest. - */ --(void)sortByDurationDescending{ - [periods sortUsingComparator:^NSComparisonResult(id obj1, id obj2) { - if (((DTTimePeriod *) obj1).durationInSeconds > ((DTTimePeriod *) obj2).durationInSeconds) { - return NSOrderedAscending; - } - else { - return NSOrderedDescending; - } - return NSOrderedSame; - }]; -} - -#pragma mark - Collection Relationship -/** - * Returns an instance of DTTimePeriodCollection with all the time periods in the receiver that fall inside a given time period. - * Time periods of the receiver must have a start date and end date within the closed interval of the period provided to be included. - * - * @param period DTTimePeriod - The time period to check against the receiver's time periods. - * - * @return DTTimePeriodCollection - */ --(DTTimePeriodCollection *)periodsInside:(DTTimePeriod *)period{ - DTTimePeriodCollection *collection = [[DTTimePeriodCollection alloc] init]; - - if ([period isKindOfClass:[DTTimePeriod class]]) { - [periods enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) { - if ([((DTTimePeriod *) obj) isInside:period]) { - [collection addTimePeriod:obj]; - } - }]; - } - else { - [DTError throwBadTypeException:period expectedClass:[DTTimePeriod class]]; - } - - return collection; -} - -/** - * Returns an instance of DTTimePeriodCollection with all the time periods in the receiver that intersect a given date. - * Time periods of the receiver must have a start date earlier than or equal to the comparison date and an end date later than or equal to the comparison date to be included - * - * @param date NSDate - The date to check against the receiver's time periods - * - * @return DTTimePeriodCollection - */ --(DTTimePeriodCollection *)periodsIntersectedByDate:(NSDate *)date{ - DTTimePeriodCollection *collection = [[DTTimePeriodCollection alloc] init]; - - if ([date isKindOfClass:[NSDate class]]) { - [periods enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) { - if ([((DTTimePeriod *) obj) containsDate:date interval:DTTimePeriodIntervalClosed]) { - [collection addTimePeriod:obj]; - } - }]; - } - else { - [DTError throwBadTypeException:date expectedClass:[NSDate class]]; - } - - return collection; -} - -/** - * Returns an instance of DTTimePeriodCollection with all the time periods in the receiver that intersect a given time period. - * Intersection with the given time period includes other time periods that simply touch it. (i.e. one's start date is equal to another's end date) - * - * @param period DTTimePeriod - The time period to check against the receiver's time periods. - * - * @return DTTimePeriodCollection - */ --(DTTimePeriodCollection *)periodsIntersectedByPeriod:(DTTimePeriod *)period{ - DTTimePeriodCollection *collection = [[DTTimePeriodCollection alloc] init]; - - if ([period isKindOfClass:[DTTimePeriod class]]) { - [periods enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) { - if ([((DTTimePeriod *) obj) intersects:period]) { - [collection addTimePeriod:obj]; - } - }]; - } - else { - [DTError throwBadTypeException:period expectedClass:[DTTimePeriod class]]; - } - - return collection; -} - -/** - * Returns an instance of DTTimePeriodCollection with all the time periods in the receiver that overlap a given time period. - * Overlap with the given time period does NOT include other time periods that simply touch it. (i.e. one's start date is equal to another's end date) - * - * @param period DTTimePeriod - The time period to check against the receiver's time periods. - * - * @return DTTimePeriodCollection - */ --(DTTimePeriodCollection *)periodsOverlappedByPeriod:(DTTimePeriod *)period{ - DTTimePeriodCollection *collection = [[DTTimePeriodCollection alloc] init]; - - [periods enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) { - if ([((DTTimePeriod *) obj) overlapsWith:period]) { - [collection addTimePeriod:obj]; - } - }]; - - return collection; -} - -/** - * Returns a BOOL representing whether the receiver is equal to a given DTTimePeriodCollection. Equality requires the start and end dates to be the same, and all time periods to be the same. - * - * If you would like to take the order of the time periods in two collections into consideration, you may do so with the considerOrder BOOL - * - * @param collection DTTimePeriodCollection - The collection to compare with the receiver - * @param considerOrder BOOL - Option for whether to account for the time periods order in the test for equality. YES considers order, NO does not. - * - * @return BOOL - */ --(BOOL)isEqualToCollection:(DTTimePeriodCollection *)collection considerOrder:(BOOL)considerOrder{ - //Check class - if ([collection class] != [DTTimePeriodCollection class]) { - [DTError throwBadTypeException:collection expectedClass:[DTTimePeriodCollection class]]; - return NO; - } - - //Check group level characteristics for speed - if (![self hasSameCharacteristicsAs:collection]) { - return NO; - } - - //Default to equality and look for inequality - __block BOOL isEqual = YES; - if (considerOrder) { - - [periods enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) { - if (![collection[idx] isEqualToPeriod:obj]) { - isEqual = NO; - *stop = YES; - } - }]; - } - else { - __block DTTimePeriodCollection *collectionCopy = [collection copy]; - - [periods enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) { - __block BOOL innerMatch = NO; - __block NSInteger matchIndex = 0; //We will remove matches to account for duplicates and to help speed - for (int ii = 0; ii < collectionCopy.count; ii++) { - if ([obj isEqualToPeriod:collectionCopy[ii]]) { - innerMatch = YES; - matchIndex = ii; - break; - } - } - - //If there was a match found, stop - if (!innerMatch) { - isEqual = NO; - *stop = YES; - } - else { - [collectionCopy removeTimePeriodAtIndex:matchIndex]; - } - }]; - } - - return isEqual; -} - -#pragma mark - Helper Methods - --(void)updateVariables{ - //Set helper variables - __block NSDate *startDate = [NSDate distantFuture]; - __block NSDate *endDate = [NSDate distantPast]; - [periods enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) { - if ([((DTTimePeriod *) obj).StartDate isEarlierThan:startDate]) { - startDate = ((DTTimePeriod *) obj).StartDate; - } - if ([((DTTimePeriod *) obj).EndDate isLaterThan:endDate]) { - endDate = ((DTTimePeriod *) obj).EndDate; - } - }]; - - //Make assignments after evaluation - StartDate = startDate; - EndDate = endDate; -} - --(void)setVariablesNil{ - //Set helper variables - StartDate = nil; - EndDate = nil; -} - -/** - * Returns a new instance of DTTimePeriodCollection that is an exact copy of the receiver, but with differnt memory references, etc. - * - * @return DTTimePeriodCollection - */ --(DTTimePeriodCollection *)copy{ - DTTimePeriodCollection *collection = [DTTimePeriodCollection collection]; - - [periods enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) { - [collection addTimePeriod:[obj copy]]; - }]; - - return collection; -} - -@end diff --git a/DateTools/DateTools/DTTimePeriodGroup.h b/DateTools/DateTools/DTTimePeriodGroup.h deleted file mode 100644 index ac8f528a..00000000 --- a/DateTools/DateTools/DTTimePeriodGroup.h +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright (C) 2014 by Matthew York -// -// Permission is hereby granted, free of charge, to any -// person obtaining a copy of this software and -// associated documentation files (the "Software"), to -// deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the -// Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall -// be included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES -// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS -// BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -#import -#import "DTTimePeriod.h" - -@interface DTTimePeriodGroup : NSObject { -@protected - NSMutableArray *periods; - NSDate *StartDate; - NSDate *EndDate; -} - -@property (nonatomic, readonly) NSDate *StartDate; -@property (nonatomic, readonly) NSDate *EndDate; - -//Here we will use object subscripting to help create the illusion of an array -- (id)objectAtIndexedSubscript:(NSUInteger)index; //getter -- (void)setObject:(id)obj atIndexedSubscript:(NSUInteger)index; //setter - -#pragma mark - Group Info --(double)durationInYears; --(double)durationInWeeks; --(double)durationInDays; --(double)durationInHours; --(double)durationInMinutes; --(double)durationInSeconds; --(NSDate *)StartDate; --(NSDate *)EndDate; --(NSInteger)count; - -#pragma mark - Chain Time Manipulation --(void)shiftEarlierWithSize:(DTTimePeriodSize)size; --(void)shiftEarlierWithSize:(DTTimePeriodSize)size amount:(NSInteger)amount; --(void)shiftLaterWithSize:(DTTimePeriodSize)size; --(void)shiftLaterWithSize:(DTTimePeriodSize)size amount:(NSInteger)amount; - -#pragma mark - Comparison --(BOOL)hasSameCharacteristicsAs:(DTTimePeriodGroup *)group; - -#pragma mark - Updates --(void)updateVariables; -@end diff --git a/DateTools/DateTools/DTTimePeriodGroup.m b/DateTools/DateTools/DTTimePeriodGroup.m deleted file mode 100644 index cdf0bdd1..00000000 --- a/DateTools/DateTools/DTTimePeriodGroup.m +++ /dev/null @@ -1,234 +0,0 @@ -// Copyright (C) 2014 by Matthew York -// -// Permission is hereby granted, free of charge, to any -// person obtaining a copy of this software and -// associated documentation files (the "Software"), to -// deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the -// Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall -// be included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES -// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS -// BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -#import "DTTimePeriodGroup.h" -#import "NSDate+DateTools.h" - -@interface DTTimePeriodGroup () - -@end - -@implementation DTTimePeriodGroup - --(id) init -{ - if (self = [super init]) { - periods = [[NSMutableArray alloc] init]; - } - - return self; -} - -- (id)objectAtIndexedSubscript:(NSUInteger)index -{ - return periods[index]; -} - -- (void)setObject:(id)obj atIndexedSubscript:(NSUInteger)index { - periods[index] = obj; -} - -#pragma mark - Group Info -/** - * Returns the duration of the receiver in years - * - * @return NSInteger - */ --(double)durationInYears { - if (self.StartDate && self.EndDate) { - return [self.StartDate yearsEarlierThan:self.EndDate]; - } - - return 0; -} - -/** - * Returns the duration of the receiver in weeks - * - * @return double - */ --(double)durationInWeeks { - if (self.StartDate && self.EndDate) { - return [self.StartDate weeksEarlierThan:self.EndDate]; - } - - return 0; -} - -/** - * Returns the duration of the receiver in days - * - * @return double - */ --(double)durationInDays { - if (self.StartDate && self.EndDate) { - return [self.StartDate daysEarlierThan:self.EndDate]; - } - - return 0; -} - -/** - * Returns the duration of the receiver in hours - * - * @return double - */ --(double)durationInHours { - if (self.StartDate && self.EndDate) { - return [self.StartDate hoursEarlierThan:self.EndDate]; - } - - return 0; -} - -/** - * Returns the duration of the receiver in minutes - * - * @return double - */ --(double)durationInMinutes { - if (self.StartDate && self.EndDate) { - return [self.StartDate minutesEarlierThan:self.EndDate]; - } - - return 0; -} - -/** - * Returns the duration of the receiver in seconds - * - * @return double - */ --(double)durationInSeconds { - if (self.StartDate && self.EndDate) { - return [self.StartDate secondsEarlierThan:self.EndDate]; - } - - return 0; -} - -/** - * Returns the NSDate representing the earliest date in the DTTimePeriodGroup (or subclass) - * - * @return NSDate - */ --(NSDate *)StartDate{ - return StartDate; -} - -/** - * Returns the NSDate representing the latest date in the DTTimePeriodGroup (or subclass) - * - * @return NSDate - */ --(NSDate *)EndDate{ - return EndDate; -} - -/** - * The total number of DTTimePeriods in the group - * - * @return NSInteger - */ --(NSInteger)count{ - return periods.count; -} - -/** - * Returns a BOOL if the receiver and the comparison group have the same metadata (i.e. number of periods, start & end date, etc.) - * Returns YES if they share the same characteristics, otherwise NO - * - * @param group The group to compare with the receiver - * - * @return BOOL - */ --(BOOL)hasSameCharacteristicsAs:(DTTimePeriodGroup *)group{ - //Check characteristics first for speed - if (group.count != self.count) { - return NO; - } - else if (!group.StartDate && !group.EndDate && !self.StartDate && !self.EndDate){ - return YES; - } - else if (![group.StartDate isEqualToDate:self.StartDate] || ![group.EndDate isEqualToDate:self.EndDate]){ - return NO; - } - - return YES; -} - -#pragma mark - Chain Time Manipulation -/** - * Shifts all the time periods in the collection to an earlier date by the given size - * - * @param size DTTimePeriodSize - The desired size of the shift - */ --(void)shiftEarlierWithSize:(DTTimePeriodSize)size{ - [self shiftEarlierWithSize:size amount:1]; -} - -/** - * Shifts all the time periods in the collection to an earlier date by the given size and amount. - * The amount acts as a multiplier to the size (i.e. "2 weeks" or "4 years") - * - * @param size DTTimePeriodSize - The desired size of the shift - * @param amount NSInteger - Multiplier for the size - */ --(void)shiftEarlierWithSize:(DTTimePeriodSize)size amount:(NSInteger)amount{ - if (periods) { - [periods enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) { - [((DTTimePeriod *)obj) shiftEarlierWithSize:size amount:amount]; - }]; - - [self updateVariables]; - } -} - -/** - * Shifts all the time periods in the collection to a later date by the given size - * - * @param size DTTimePeriodSize - The desired size of the shift - */ --(void)shiftLaterWithSize:(DTTimePeriodSize)size{ - [self shiftLaterWithSize:size amount:1]; -} - -/** - * Shifts all the time periods in the collection to an later date by the given size and amount. - * The amount acts as a multiplier to the size (i.e. "2 weeks" or "4 years") - * - * @param size DTTimePeriodSize - The desired size of the shift - * @param amount NSInteger - Multiplier for the size - */ --(void)shiftLaterWithSize:(DTTimePeriodSize)size amount:(NSInteger)amount{ - if (periods) { - [periods enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) { - [((DTTimePeriod *)obj) shiftLaterWithSize:size amount:amount]; - }]; - - [self updateVariables]; - } -} - -#pragma mark - Updates --(void)updateVariables{} -@end diff --git a/DateTools/DateTools/DateTools.h b/DateTools/DateTools/DateTools.h deleted file mode 100644 index 406ab421..00000000 --- a/DateTools/DateTools/DateTools.h +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright (C) 2014 by Matthew York -// -// Permission is hereby granted, free of charge, to any -// person obtaining a copy of this software and -// associated documentation files (the "Software"), to -// deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the -// Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall -// be included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES -// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS -// BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -#import "DTConstants.h" -#import "DTError.h" -#import "NSDate+DateTools.h" -#import "DTTimePeriod.h" -#import "DTTimePeriodGroup.h" -#import "DTTimePeriodCollection.h" -#import "DTTimePeriodChain.h" \ No newline at end of file diff --git a/DateTools/DateTools/NSDate+DateTools.h b/DateTools/DateTools/NSDate+DateTools.h deleted file mode 100644 index 94231a75..00000000 --- a/DateTools/DateTools/NSDate+DateTools.h +++ /dev/null @@ -1,187 +0,0 @@ -// Copyright (C) 2014 by Matthew York -// -// Permission is hereby granted, free of charge, to any -// person obtaining a copy of this software and -// associated documentation files (the "Software"), to -// deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the -// Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall -// be included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES -// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS -// BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -#ifndef DateToolsLocalizedStrings -#define DateToolsLocalizedStrings(key) \ -NSLocalizedStringFromTableInBundle(key, @"DateTools", [NSBundle bundleWithPath:[[[NSBundle bundleForClass:[DTError class]] resourcePath] stringByAppendingPathComponent:@"DateTools.bundle"]], nil) -#endif - -#import -#import "DTConstants.h" - -@interface NSDate (DateTools) - -#pragma mark - Time Ago -+ (NSString*)timeAgoSinceDate:(NSDate*)date; -+ (NSString*)shortTimeAgoSinceDate:(NSDate*)date; -+ (NSString *)weekTimeAgoSinceDate:(NSDate *)date; - -- (NSString*)timeAgoSinceNow; -- (NSString *)shortTimeAgoSinceNow; -- (NSString *)weekTimeAgoSinceNow; - -- (NSString *)timeAgoSinceDate:(NSDate *)date; -- (NSString *)timeAgoSinceDate:(NSDate *)date numericDates:(BOOL)useNumericDates; -- (NSString *)timeAgoSinceDate:(NSDate *)date numericDates:(BOOL)useNumericDates numericTimes:(BOOL)useNumericTimes; - - -- (NSString *)shortTimeAgoSinceDate:(NSDate *)date; -- (NSString *)weekTimeAgoSinceDate:(NSDate *)date; - - -#pragma mark - Date Components Without Calendar -- (NSInteger)era; -- (NSInteger)year; -- (NSInteger)month; -- (NSInteger)day; -- (NSInteger)hour; -- (NSInteger)minute; -- (NSInteger)second; -- (NSInteger)weekday; -- (NSInteger)weekdayOrdinal; -- (NSInteger)quarter; -- (NSInteger)weekOfMonth; -- (NSInteger)weekOfYear; -- (NSInteger)yearForWeekOfYear; -- (NSInteger)daysInMonth; -- (NSInteger)dayOfYear; --(NSInteger)daysInYear; --(BOOL)isInLeapYear; -- (BOOL)isToday; -- (BOOL)isTomorrow; --(BOOL)isYesterday; -- (BOOL)isWeekend; --(BOOL)isSameDay:(NSDate *)date; -+ (BOOL)isSameDay:(NSDate *)date asDate:(NSDate *)compareDate; - -#pragma mark - Date Components With Calendar - - -- (NSInteger)eraWithCalendar:(NSCalendar *)calendar; -- (NSInteger)yearWithCalendar:(NSCalendar *)calendar; -- (NSInteger)monthWithCalendar:(NSCalendar *)calendar; -- (NSInteger)dayWithCalendar:(NSCalendar *)calendar; -- (NSInteger)hourWithCalendar:(NSCalendar *)calendar; -- (NSInteger)minuteWithCalendar:(NSCalendar *)calendar; -- (NSInteger)secondWithCalendar:(NSCalendar *)calendar; -- (NSInteger)weekdayWithCalendar:(NSCalendar *)calendar; -- (NSInteger)weekdayOrdinalWithCalendar:(NSCalendar *)calendar; -- (NSInteger)quarterWithCalendar:(NSCalendar *)calendar; -- (NSInteger)weekOfMonthWithCalendar:(NSCalendar *)calendar; -- (NSInteger)weekOfYearWithCalendar:(NSCalendar *)calendar; -- (NSInteger)yearForWeekOfYearWithCalendar:(NSCalendar *)calendar; - - -#pragma mark - Date Creating -+ (NSDate *)dateWithYear:(NSInteger)year month:(NSInteger)month day:(NSInteger)day; -+ (NSDate *)dateWithYear:(NSInteger)year month:(NSInteger)month day:(NSInteger)day hour:(NSInteger)hour minute:(NSInteger)minute second:(NSInteger)second; -+ (NSDate *)dateWithString:(NSString *)dateString formatString:(NSString *)formatString; -+ (NSDate *)dateWithString:(NSString *)dateString formatString:(NSString *)formatString timeZone:(NSTimeZone *)timeZone; - - -#pragma mark - Date Editing -#pragma mark Date By Adding -- (NSDate *)dateByAddingYears:(NSInteger)years; -- (NSDate *)dateByAddingMonths:(NSInteger)months; -- (NSDate *)dateByAddingWeeks:(NSInteger)weeks; -- (NSDate *)dateByAddingDays:(NSInteger)days; -- (NSDate *)dateByAddingHours:(NSInteger)hours; -- (NSDate *)dateByAddingMinutes:(NSInteger)minutes; -- (NSDate *)dateByAddingSeconds:(NSInteger)seconds; -#pragma mark Date By Subtracting -- (NSDate *)dateBySubtractingYears:(NSInteger)years; -- (NSDate *)dateBySubtractingMonths:(NSInteger)months; -- (NSDate *)dateBySubtractingWeeks:(NSInteger)weeks; -- (NSDate *)dateBySubtractingDays:(NSInteger)days; -- (NSDate *)dateBySubtractingHours:(NSInteger)hours; -- (NSDate *)dateBySubtractingMinutes:(NSInteger)minutes; -- (NSDate *)dateBySubtractingSeconds:(NSInteger)seconds; - -#pragma mark - Date Comparison -#pragma mark Time From --(NSInteger)yearsFrom:(NSDate *)date; --(NSInteger)monthsFrom:(NSDate *)date; --(NSInteger)weeksFrom:(NSDate *)date; --(NSInteger)daysFrom:(NSDate *)date; --(double)hoursFrom:(NSDate *)date; --(double)minutesFrom:(NSDate *)date; --(double)secondsFrom:(NSDate *)date; -#pragma mark Time From With Calendar --(NSInteger)yearsFrom:(NSDate *)date calendar:(NSCalendar *)calendar; --(NSInteger)monthsFrom:(NSDate *)date calendar:(NSCalendar *)calendar; --(NSInteger)weeksFrom:(NSDate *)date calendar:(NSCalendar *)calendar; --(NSInteger)daysFrom:(NSDate *)date calendar:(NSCalendar *)calendar; - -#pragma mark Time Until --(NSInteger)yearsUntil; --(NSInteger)monthsUntil; --(NSInteger)weeksUntil; --(NSInteger)daysUntil; --(double)hoursUntil; --(double)minutesUntil; --(double)secondsUntil; -#pragma mark Time Ago --(NSInteger)yearsAgo; --(NSInteger)monthsAgo; --(NSInteger)weeksAgo; --(NSInteger)daysAgo; --(double)hoursAgo; --(double)minutesAgo; --(double)secondsAgo; -#pragma mark Earlier Than --(NSInteger)yearsEarlierThan:(NSDate *)date; --(NSInteger)monthsEarlierThan:(NSDate *)date; --(NSInteger)weeksEarlierThan:(NSDate *)date; --(NSInteger)daysEarlierThan:(NSDate *)date; --(double)hoursEarlierThan:(NSDate *)date; --(double)minutesEarlierThan:(NSDate *)date; --(double)secondsEarlierThan:(NSDate *)date; -#pragma mark Later Than --(NSInteger)yearsLaterThan:(NSDate *)date; --(NSInteger)monthsLaterThan:(NSDate *)date; --(NSInteger)weeksLaterThan:(NSDate *)date; --(NSInteger)daysLaterThan:(NSDate *)date; --(double)hoursLaterThan:(NSDate *)date; --(double)minutesLaterThan:(NSDate *)date; --(double)secondsLaterThan:(NSDate *)date; -#pragma mark Comparators --(BOOL)isEarlierThan:(NSDate *)date; --(BOOL)isLaterThan:(NSDate *)date; --(BOOL)isEarlierThanOrEqualTo:(NSDate *)date; --(BOOL)isLaterThanOrEqualTo:(NSDate *)date; - -#pragma mark - Formatted Dates -#pragma mark Formatted With Style --(NSString *)formattedDateWithStyle:(NSDateFormatterStyle)style; --(NSString *)formattedDateWithStyle:(NSDateFormatterStyle)style timeZone:(NSTimeZone *)timeZone; --(NSString *)formattedDateWithStyle:(NSDateFormatterStyle)style locale:(NSLocale *)locale; --(NSString *)formattedDateWithStyle:(NSDateFormatterStyle)style timeZone:(NSTimeZone *)timeZone locale:(NSLocale *)locale; -#pragma mark Formatted With Format --(NSString *)formattedDateWithFormat:(NSString *)format; --(NSString *)formattedDateWithFormat:(NSString *)format timeZone:(NSTimeZone *)timeZone; --(NSString *)formattedDateWithFormat:(NSString *)format locale:(NSLocale *)locale; --(NSString *)formattedDateWithFormat:(NSString *)format timeZone:(NSTimeZone *)timeZone locale:(NSLocale *)locale; - -#pragma mark - Helpers -+(NSString *)defaultCalendarIdentifier; -+ (void)setDefaultCalendarIdentifier:(NSString *)identifier; -@end diff --git a/DateTools/DateTools/NSDate+DateTools.m b/DateTools/DateTools/NSDate+DateTools.m deleted file mode 100644 index 63d16a85..00000000 --- a/DateTools/DateTools/NSDate+DateTools.m +++ /dev/null @@ -1,1743 +0,0 @@ -// Copyright (C) 2014 by Matthew York -// -// Permission is hereby granted, free of charge, to any -// person obtaining a copy of this software and -// associated documentation files (the "Software"), to -// deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the -// Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall -// be included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES -// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS -// BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -#import "NSDate+DateTools.h" - -typedef NS_ENUM(NSUInteger, DTDateComponent){ - DTDateComponentEra, - DTDateComponentYear, - DTDateComponentMonth, - DTDateComponentDay, - DTDateComponentHour, - DTDateComponentMinute, - DTDateComponentSecond, - DTDateComponentWeekday, - DTDateComponentWeekdayOrdinal, - DTDateComponentQuarter, - DTDateComponentWeekOfMonth, - DTDateComponentWeekOfYear, - DTDateComponentYearForWeekOfYear, - DTDateComponentDayOfYear -}; - -typedef NS_ENUM(NSUInteger, DateAgoFormat){ - DateAgoLong, - DateAgoLongUsingNumericDatesAndTimes, - DateAgoLongUsingNumericDates, - DateAgoLongUsingNumericTimes, - DateAgoShort, - DateAgoWeek, -}; - -typedef NS_ENUM(NSUInteger, DateAgoValues){ - YearsAgo, - MonthsAgo, - WeeksAgo, - DaysAgo, - HoursAgo, - MinutesAgo, - SecondsAgo -}; - -static const unsigned int allCalendarUnitFlags = NSCalendarUnitYear | NSCalendarUnitQuarter | NSCalendarUnitMonth | NSCalendarUnitWeekOfYear | NSCalendarUnitWeekOfMonth | NSCalendarUnitDay | NSCalendarUnitHour | NSCalendarUnitMinute | NSCalendarUnitSecond | NSCalendarUnitEra | NSCalendarUnitWeekday | NSCalendarUnitWeekdayOrdinal | NSCalendarUnitWeekOfYear; - -static NSString *defaultCalendarIdentifier = nil; -static NSCalendar *implicitCalendar = nil; - -@implementation NSDate (DateTools) - -+ (void)load { - [self setDefaultCalendarIdentifier:NSCalendarIdentifierGregorian]; -} - -#pragma mark - Time Ago - - -/** - * Takes in a date and returns a string with the most convenient unit of time representing - * how far in the past that date is from now. - * - * @param date - Date to be measured from now - * - * @return NSString - Formatted return string - */ -+ (NSString*)timeAgoSinceDate:(NSDate*)date{ - return [date timeAgoSinceDate:[NSDate date]]; -} - -/** - * Takes in a date and returns a shortened string with the most convenient unit of time representing - * how far in the past that date is from now. - * - * @param date - Date to be measured from now - * - * @return NSString - Formatted return string - */ -+ (NSString*)shortTimeAgoSinceDate:(NSDate*)date{ - return [date shortTimeAgoSinceDate:[NSDate date]]; -} - -+ (NSString*)weekTimeAgoSinceDate:(NSDate*)date{ - return [date weekTimeAgoSinceDate:[NSDate date]]; -} - -/** - * Returns a string with the most convenient unit of time representing - * how far in the past that date is from now. - * - * @return NSString - Formatted return string - */ -- (NSString*)timeAgoSinceNow{ - return [self timeAgoSinceDate:[NSDate date]]; -} - -/** - * Returns a shortened string with the most convenient unit of time representing - * how far in the past that date is from now. - * - * @return NSString - Formatted return string - */ -- (NSString *)shortTimeAgoSinceNow{ - return [self shortTimeAgoSinceDate:[NSDate date]]; -} - -- (NSString *)weekTimeAgoSinceNow{ - return [self weekTimeAgoSinceDate:[NSDate date]]; -} - -- (NSString *)timeAgoSinceDate:(NSDate *)date{ - return [self timeAgoSinceDate:date numericDates:NO]; -} - -- (NSString *)timeAgoSinceDate:(NSDate *)date numericDates:(BOOL)useNumericDates{ - return [self timeAgoSinceDate:date numericDates:useNumericDates numericTimes:NO]; -} - -- (NSString *)timeAgoSinceDate:(NSDate *)date numericDates:(BOOL)useNumericDates numericTimes:(BOOL)useNumericTimes{ - if (useNumericDates && useNumericTimes) { - return [self timeAgoSinceDate:date format:DateAgoLongUsingNumericDatesAndTimes]; - } else if (useNumericDates) { - return [self timeAgoSinceDate:date format:DateAgoLongUsingNumericDates]; - } else if (useNumericTimes) { - return [self timeAgoSinceDate:date format:DateAgoLongUsingNumericDates]; - } else { - return [self timeAgoSinceDate:date format:DateAgoLong]; - } -} - -- (NSString *)shortTimeAgoSinceDate:(NSDate *)date{ - return [self timeAgoSinceDate:date format:DateAgoShort]; -} - -- (NSString *)weekTimeAgoSinceDate:(NSDate *)date{ - return [self timeAgoSinceDate:date format:DateAgoWeek]; -} - -- (NSString *)timeAgoSinceDate:(NSDate *)date format:(DateAgoFormat)format { - - NSCalendar *calendar = [NSCalendar currentCalendar]; - NSDate *earliest = [self earlierDate:date]; - NSDate *latest = (earliest == self) ? date : self; - - // if timeAgo < 24h => compare DateTime else compare Date only - NSUInteger upToHours = NSCalendarUnitSecond | NSCalendarUnitMinute | NSCalendarUnitHour; - NSDateComponents *difference = [calendar components:upToHours fromDate:earliest toDate:latest options:0]; - - if (difference.hour < 24) { - if (difference.hour >= 1) { - return [self localizedStringFor:format valueType:HoursAgo value:difference.hour]; - } else if (difference.minute >= 1) { - return [self localizedStringFor:format valueType:MinutesAgo value:difference.minute]; - } else { - return [self localizedStringFor:format valueType:SecondsAgo value:difference.second]; - } - - } else { - NSUInteger bigUnits = NSCalendarUnitTimeZone | NSCalendarUnitDay | NSCalendarUnitWeekOfYear | NSCalendarUnitMonth | NSCalendarUnitYear; - - NSDateComponents *components = [calendar components:bigUnits fromDate:earliest]; - earliest = [calendar dateFromComponents:components]; - - components = [calendar components:bigUnits fromDate:latest]; - latest = [calendar dateFromComponents:components]; - - difference = [calendar components:bigUnits fromDate:earliest toDate:latest options:0]; - - if (difference.year >= 1) { - return [self localizedStringFor:format valueType:YearsAgo value:difference.year]; - } else if (difference.month >= 1) { - return [self localizedStringFor:format valueType:MonthsAgo value:difference.month]; - } else if (difference.weekOfYear >= 1) { - return [self localizedStringFor:format valueType:WeeksAgo value:difference.weekOfYear]; - } else { - return [self localizedStringFor:format valueType:DaysAgo value:difference.day]; - } - } -} - -- (NSString *)localizedStringFor:(DateAgoFormat)format valueType:(DateAgoValues)valueType value:(NSInteger)value { - BOOL isShort = format == DateAgoShort; - BOOL isNumericDate = format == DateAgoLongUsingNumericDates || format == DateAgoLongUsingNumericDatesAndTimes; - BOOL isNumericTime = format == DateAgoLongUsingNumericTimes || format == DateAgoLongUsingNumericDatesAndTimes; - BOOL isWeek = format == DateAgoWeek; - - switch (valueType) { - case YearsAgo: - if (isShort) { - return [self logicLocalizedStringFromFormat:@"%%d%@y" withValue:value]; - } else if (value >= 2) { - return [self logicLocalizedStringFromFormat:@"%%d %@years ago" withValue:value]; - } else if (isNumericDate) { - return DateToolsLocalizedStrings(@"1 year ago"); - } else { - return DateToolsLocalizedStrings(@"Last year"); - } - case MonthsAgo: - if (isShort) { - return [self logicLocalizedStringFromFormat:@"%%d%@M" withValue:value]; - } else if (value >= 2) { - return [self logicLocalizedStringFromFormat:@"%%d %@months ago" withValue:value]; - } else if (isNumericDate) { - return DateToolsLocalizedStrings(@"1 month ago"); - } else { - return DateToolsLocalizedStrings(@"Last month"); - } - case WeeksAgo: - if (isShort) { - return [self logicLocalizedStringFromFormat:@"%%d%@w" withValue:value]; - } else if (value >= 2) { - return [self logicLocalizedStringFromFormat:@"%%d %@weeks ago" withValue:value]; - } else if (isNumericDate) { - return DateToolsLocalizedStrings(@"1 week ago"); - } else { - return DateToolsLocalizedStrings(@"Last week"); - } - case DaysAgo: - if (isShort) { - return [self logicLocalizedStringFromFormat:@"%%d%@d" withValue:value]; - } else if (value >= 2) { - if (isWeek && value <= 7) { - NSDateFormatter *dayDateFormatter = [[NSDateFormatter alloc]init]; - dayDateFormatter.dateFormat = @"EEE"; - NSString *eee = [dayDateFormatter stringFromDate:self]; - - return DateToolsLocalizedStrings(eee); - } - - return [self logicLocalizedStringFromFormat:@"%%d %@days ago" withValue:value]; - } else if (isNumericDate) { - return DateToolsLocalizedStrings(@"1 day ago"); - } else { - return DateToolsLocalizedStrings(@"Yesterday"); - } - case HoursAgo: - if (isShort) { - return [self logicLocalizedStringFromFormat:@"%%d%@h" withValue:value]; - } else if (value >= 2) { - return [self logicLocalizedStringFromFormat:@"%%d %@hours ago" withValue:value]; - } else if (isNumericTime) { - return DateToolsLocalizedStrings(@"1 hour ago"); - } else { - return DateToolsLocalizedStrings(@"An hour ago"); - } - case MinutesAgo: - if (isShort) { - return [self logicLocalizedStringFromFormat:@"%%d%@m" withValue:value]; - } else if (value >= 2) { - return [self logicLocalizedStringFromFormat:@"%%d %@minutes ago" withValue:value]; - } else if (isNumericTime) { - return DateToolsLocalizedStrings(@"1 minute ago"); - } else { - return DateToolsLocalizedStrings(@"A minute ago"); - } - case SecondsAgo: - if (isShort) { - return [self logicLocalizedStringFromFormat:@"%%d%@s" withValue:value]; - } else if (value >= 2) { - return [self logicLocalizedStringFromFormat:@"%%d %@seconds ago" withValue:value]; - } else if (isNumericTime) { - return DateToolsLocalizedStrings(@"1 second ago"); - } else { - return DateToolsLocalizedStrings(@"Just now"); - } - } - return nil; -} - -- (NSString *) logicLocalizedStringFromFormat:(NSString *)format withValue:(NSInteger)value{ - NSString * localeFormat = [NSString stringWithFormat:format, [self getLocaleFormatUnderscoresWithValue:value]]; - return [NSString stringWithFormat:DateToolsLocalizedStrings(localeFormat), value]; -} - -- (NSString *)getLocaleFormatUnderscoresWithValue:(double)value{ - NSString *localeCode = [[[NSBundle mainBundle] preferredLocalizations] objectAtIndex:0]; - - // Russian (ru) and Ukrainian (uk) - if([localeCode isEqualToString:@"ru-RU"] || [localeCode isEqualToString:@"uk"]) { - int XY = (int)floor(value) % 100; - int Y = (int)floor(value) % 10; - - if(Y == 0 || Y > 4 || (XY > 10 && XY < 15)) { - return @""; - } - - if(Y > 1 && Y < 5 && (XY < 10 || XY > 20)) { - return @"_"; - } - - if(Y == 1 && XY != 11) { - return @"__"; - } - } - - // Add more languages here, which are have specific translation rules... - - return @""; -} - -#pragma mark - Date Components Without Calendar -/** - * Returns the era of the receiver. (0 for BC, 1 for AD for Gregorian) - * - * @return NSInteger - */ -- (NSInteger)era{ - return [self componentForDate:self type:DTDateComponentEra calendar:nil]; -} - -/** - * Returns the year of the receiver. - * - * @return NSInteger - */ -- (NSInteger)year{ - return [self componentForDate:self type:DTDateComponentYear calendar:nil]; -} - -/** - * Returns the month of the year of the receiver. - * - * @return NSInteger - */ -- (NSInteger)month{ - return [self componentForDate:self type:DTDateComponentMonth calendar:nil]; -} - -/** - * Returns the day of the month of the receiver. - * - * @return NSInteger - */ -- (NSInteger)day{ - return [self componentForDate:self type:DTDateComponentDay calendar:nil]; -} - -/** - * Returns the hour of the day of the receiver. (0-24) - * - * @return NSInteger - */ -- (NSInteger)hour{ - return [self componentForDate:self type:DTDateComponentHour calendar:nil]; -} - -/** - * Returns the minute of the receiver. (0-59) - * - * @return NSInteger - */ -- (NSInteger)minute{ - return [self componentForDate:self type:DTDateComponentMinute calendar:nil]; -} - -/** - * Returns the second of the receiver. (0-59) - * - * @return NSInteger - */ -- (NSInteger)second{ - return [self componentForDate:self type:DTDateComponentSecond calendar:nil]; -} - -/** - * Returns the day of the week of the receiver. - * - * @return NSInteger - */ -- (NSInteger)weekday{ - return [self componentForDate:self type:DTDateComponentWeekday calendar:nil]; -} - -/** - * Returns the ordinal for the day of the week of the receiver. - * - * @return NSInteger - */ -- (NSInteger)weekdayOrdinal{ - return [self componentForDate:self type:DTDateComponentWeekdayOrdinal calendar:nil]; -} - -/** - * Returns the quarter of the receiver. - * - * @return NSInteger - */ -- (NSInteger)quarter{ - return [self componentForDate:self type:DTDateComponentQuarter calendar:nil]; -} - -/** - * Returns the week of the month of the receiver. - * - * @return NSInteger - */ -- (NSInteger)weekOfMonth{ - return [self componentForDate:self type:DTDateComponentWeekOfMonth calendar:nil]; -} - -/** - * Returns the week of the year of the receiver. - * - * @return NSInteger - */ -- (NSInteger)weekOfYear{ - return [self componentForDate:self type:DTDateComponentWeekOfYear calendar:nil]; -} - -/** - * I honestly don't know much about this value... - * - * @return NSInteger - */ -- (NSInteger)yearForWeekOfYear{ - return [self componentForDate:self type:DTDateComponentYearForWeekOfYear calendar:nil]; -} - -/** - * Returns how many days are in the month of the receiver. - * - * @return NSInteger - */ -- (NSInteger)daysInMonth{ - NSCalendar *calendar = [NSCalendar currentCalendar]; - NSRange days = [calendar rangeOfUnit:NSCalendarUnitDay - inUnit:NSCalendarUnitMonth - forDate:self]; - return days.length; -} - -/** - * Returns the day of the year of the receiver. (1-365 or 1-366 for leap year) - * - * @return NSInteger - */ -- (NSInteger)dayOfYear{ - return [self componentForDate:self type:DTDateComponentDayOfYear calendar:nil]; -} - -/** - * Returns how many days are in the year of the receiver. - * - * @return NSInteger - */ --(NSInteger)daysInYear{ - if (self.isInLeapYear) { - return 366; - } - - return 365; -} - -/** - * Returns whether the receiver falls in a leap year. - * - * @return NSInteger - */ --(BOOL)isInLeapYear{ - NSCalendar *calendar = [[self class] implicitCalendar]; - NSDateComponents *dateComponents = [calendar components:allCalendarUnitFlags fromDate:self]; - - if (dateComponents.year%400 == 0){ - return YES; - } - else if (dateComponents.year%100 == 0){ - return NO; - } - else if (dateComponents.year%4 == 0){ - return YES; - } - - return NO; -} - -- (BOOL)isToday { - NSCalendar *cal = [NSCalendar currentCalendar]; - NSDateComponents *components = [cal components:(NSCalendarUnitEra|NSCalendarUnitYear|NSCalendarUnitMonth|NSCalendarUnitDay) fromDate:[NSDate date]]; - NSDate *today = [cal dateFromComponents:components]; - components = [cal components:(NSCalendarUnitEra|NSCalendarUnitYear|NSCalendarUnitMonth|NSCalendarUnitDay) fromDate:self]; - NSDate *otherDate = [cal dateFromComponents:components]; - - return [today isEqualToDate:otherDate]; -} - -- (BOOL)isTomorrow { - NSCalendar *cal = [NSCalendar currentCalendar]; - NSDateComponents *components = [cal components:(NSCalendarUnitEra|NSCalendarUnitYear|NSCalendarUnitMonth|NSCalendarUnitDay) fromDate:[[NSDate date] dateByAddingDays:1]]; - NSDate *tomorrow = [cal dateFromComponents:components]; - components = [cal components:(NSCalendarUnitEra|NSCalendarUnitYear|NSCalendarUnitMonth|NSCalendarUnitDay) fromDate:self]; - NSDate *otherDate = [cal dateFromComponents:components]; - - return [tomorrow isEqualToDate:otherDate]; -} - --(BOOL)isYesterday{ - NSCalendar *cal = [NSCalendar currentCalendar]; - NSDateComponents *components = [cal components:(NSCalendarUnitEra|NSCalendarUnitYear|NSCalendarUnitMonth|NSCalendarUnitDay) fromDate:[[NSDate date] dateBySubtractingDays:1]]; - NSDate *tomorrow = [cal dateFromComponents:components]; - components = [cal components:(NSCalendarUnitEra|NSCalendarUnitYear|NSCalendarUnitMonth|NSCalendarUnitDay) fromDate:self]; - NSDate *otherDate = [cal dateFromComponents:components]; - - return [tomorrow isEqualToDate:otherDate]; -} - -- (BOOL)isWeekend { - NSCalendar *calendar = [NSCalendar currentCalendar]; - NSRange weekdayRange = [calendar maximumRangeOfUnit:NSCalendarUnitWeekday]; - NSDateComponents *components = [calendar components:NSCalendarUnitWeekday - fromDate:self]; - NSUInteger weekdayOfSomeDate = [components weekday]; - - BOOL result = NO; - - if (weekdayOfSomeDate == weekdayRange.location || weekdayOfSomeDate == weekdayRange.length) - result = YES; - - return result; -} - - -/** - * Returns whether two dates fall on the same day. - * - * @param date NSDate - Date to compare with sender - * @return BOOL - YES if both paramter dates fall on the same day, NO otherwise - */ --(BOOL)isSameDay:(NSDate *)date { - return [NSDate isSameDay:self asDate:date]; -} - -/** - * Returns whether two dates fall on the same day. - * - * @param date NSDate - First date to compare - * @param compareDate NSDate - Second date to compare - * @return BOOL - YES if both paramter dates fall on the same day, NO otherwise - */ -+ (BOOL)isSameDay:(NSDate *)date asDate:(NSDate *)compareDate -{ - NSCalendar *cal = [NSCalendar currentCalendar]; - - NSDateComponents *components = [cal components:(NSCalendarUnitEra|NSCalendarUnitYear|NSCalendarUnitMonth|NSCalendarUnitDay) fromDate:date]; - NSDate *dateOne = [cal dateFromComponents:components]; - - components = [cal components:(NSCalendarUnitEra|NSCalendarUnitYear|NSCalendarUnitMonth|NSCalendarUnitDay) fromDate:compareDate]; - NSDate *dateTwo = [cal dateFromComponents:components]; - - return [dateOne isEqualToDate:dateTwo]; -} - -#pragma mark - Date Components With Calendar -/** - * Returns the era of the receiver from a given calendar - * - * @param calendar NSCalendar - The calendar to be used in the calculation - * - * @return NSInteger - represents the era (0 for BC, 1 for AD for Gregorian) - */ -- (NSInteger)eraWithCalendar:(NSCalendar *)calendar{ - return [self componentForDate:self type:DTDateComponentEra calendar:calendar]; -} - -/** - * Returns the year of the receiver from a given calendar - * - * @param calendar NSCalendar - The calendar to be used in the calculation - * - * @return NSInteger - represents the year as an integer - */ -- (NSInteger)yearWithCalendar:(NSCalendar *)calendar{ - return [self componentForDate:self type:DTDateComponentYear calendar:calendar]; -} - -/** - * Returns the month of the receiver from a given calendar - * - * @param calendar NSCalendar - The calendar to be used in the calculation - * - * @return NSInteger - represents the month as an integer - */ -- (NSInteger)monthWithCalendar:(NSCalendar *)calendar{ - return [self componentForDate:self type:DTDateComponentMonth calendar:calendar]; -} - -/** - * Returns the day of the month of the receiver from a given calendar - * - * @param calendar NSCalendar - The calendar to be used in the calculation - * - * @return NSInteger - represents the day of the month as an integer - */ -- (NSInteger)dayWithCalendar:(NSCalendar *)calendar{ - return [self componentForDate:self type:DTDateComponentDay calendar:calendar]; -} - -/** - * Returns the hour of the day of the receiver from a given calendar - * - * @param calendar NSCalendar - The calendar to be used in the calculation - * - * @return NSInteger - represents the hour of the day as an integer - */ -- (NSInteger)hourWithCalendar:(NSCalendar *)calendar{ - return [self componentForDate:self type:DTDateComponentHour calendar:calendar]; -} - -/** - * Returns the minute of the hour of the receiver from a given calendar - * - * @param calendar NSCalendar - The calendar to be used in the calculation - * - * @return NSInteger - represents the minute of the hour as an integer - */ -- (NSInteger)minuteWithCalendar:(NSCalendar *)calendar{ - return [self componentForDate:self type:DTDateComponentMinute calendar:calendar]; -} - -/** - * Returns the second of the receiver from a given calendar - * - * @param calendar NSCalendar - The calendar to be used in the calculation - * - * @return NSInteger - represents the second as an integer - */ -- (NSInteger)secondWithCalendar:(NSCalendar *)calendar{ - return [self componentForDate:self type:DTDateComponentSecond calendar:calendar]; -} - -/** - * Returns the weekday of the receiver from a given calendar - * - * @param calendar NSCalendar - The calendar to be used in the calculation - * - * @return NSInteger - represents the weekday as an integer - */ -- (NSInteger)weekdayWithCalendar:(NSCalendar *)calendar{ - return [self componentForDate:self type:DTDateComponentWeekday calendar:calendar]; -} - -/** - * Returns the weekday ordinal of the receiver from a given calendar - * - * @param calendar NSCalendar - The calendar to be used in the calculation - * - * @return NSInteger - represents the weekday ordinal as an integer - */ -- (NSInteger)weekdayOrdinalWithCalendar:(NSCalendar *)calendar{ - return [self componentForDate:self type:DTDateComponentWeekdayOrdinal calendar:calendar]; -} - -/** - * Returns the quarter of the receiver from a given calendar - * - * @param calendar NSCalendar - The calendar to be used in the calculation - * - * @return NSInteger - represents the quarter as an integer - */ -- (NSInteger)quarterWithCalendar:(NSCalendar *)calendar{ - return [self componentForDate:self type:DTDateComponentQuarter calendar:calendar]; -} - -/** - * Returns the week of the month of the receiver from a given calendar - * - * @param calendar NSCalendar - The calendar to be used in the calculation - * - * @return NSInteger - represents the week of the month as an integer - */ -- (NSInteger)weekOfMonthWithCalendar:(NSCalendar *)calendar{ - return [self componentForDate:self type:DTDateComponentWeekOfMonth calendar:calendar]; -} - -/** - * Returns the week of the year of the receiver from a given calendar - * - * @param calendar NSCalendar - The calendar to be used in the calculation - * - * @return NSInteger - represents the week of the year as an integer - */ -- (NSInteger)weekOfYearWithCalendar:(NSCalendar *)calendar{ - return [self componentForDate:self type:DTDateComponentWeekOfYear calendar:calendar]; -} - -/** - * Returns the year for week of the year (???) of the receiver from a given calendar - * - * @param calendar NSCalendar - The calendar to be used in the calculation - * - * @return NSInteger - represents the year for week of the year as an integer - */ -- (NSInteger)yearForWeekOfYearWithCalendar:(NSCalendar *)calendar{ - return [self componentForDate:self type:DTDateComponentYearForWeekOfYear calendar:calendar]; -} - - -/** - * Returns the day of the year of the receiver from a given calendar - * - * @param calendar NSCalendar - The calendar to be used in the calculation - * - * @return NSInteger - represents the day of the year as an integer - */ -- (NSInteger)dayOfYearWithCalendar:(NSCalendar *)calendar{ - return [self componentForDate:self type:DTDateComponentDayOfYear calendar:calendar]; -} - -/** - * Takes in a date, calendar and desired date component and returns the desired NSInteger - * representation for that component - * - * @param date NSDate - The date to be be mined for a desired component - * @param component DTDateComponent - The desired component (i.e. year, day, week, etc) - * @param calendar NSCalendar - The calendar to be used in the processing (Defaults to Gregorian) - * - * @return NSInteger - */ --(NSInteger)componentForDate:(NSDate *)date type:(DTDateComponent)component calendar:(NSCalendar *)calendar{ - if (!calendar) { - calendar = [[self class] implicitCalendar]; - } - - unsigned int unitFlags = 0; - - if (component == DTDateComponentYearForWeekOfYear) { - unitFlags = NSCalendarUnitYear | NSCalendarUnitQuarter | NSCalendarUnitMonth | NSCalendarUnitWeekOfYear | NSCalendarUnitWeekOfMonth | NSCalendarUnitDay | NSCalendarUnitHour | NSCalendarUnitMinute | NSCalendarUnitSecond | NSCalendarUnitEra | NSCalendarUnitWeekday | NSCalendarUnitWeekdayOrdinal | NSCalendarUnitWeekOfYear | NSCalendarUnitYearForWeekOfYear; - } - else { - unitFlags = allCalendarUnitFlags; - } - - NSDateComponents *dateComponents = [calendar components:unitFlags fromDate:date]; - - switch (component) { - case DTDateComponentEra: - return [dateComponents era]; - case DTDateComponentYear: - return [dateComponents year]; - case DTDateComponentMonth: - return [dateComponents month]; - case DTDateComponentDay: - return [dateComponents day]; - case DTDateComponentHour: - return [dateComponents hour]; - case DTDateComponentMinute: - return [dateComponents minute]; - case DTDateComponentSecond: - return [dateComponents second]; - case DTDateComponentWeekday: - return [dateComponents weekday]; - case DTDateComponentWeekdayOrdinal: - return [dateComponents weekdayOrdinal]; - case DTDateComponentQuarter: - return [dateComponents quarter]; - case DTDateComponentWeekOfMonth: - return [dateComponents weekOfMonth]; - case DTDateComponentWeekOfYear: - return [dateComponents weekOfYear]; - case DTDateComponentYearForWeekOfYear: - return [dateComponents yearForWeekOfYear]; - case DTDateComponentDayOfYear: - return [calendar ordinalityOfUnit:NSCalendarUnitDay inUnit:NSCalendarUnitYear forDate:date]; - default: - break; - } - - return 0; -} - -#pragma mark - Date Creating -+ (NSDate *)dateWithYear:(NSInteger)year month:(NSInteger)month day:(NSInteger)day { - - return [self dateWithYear:year month:month day:day hour:0 minute:0 second:0]; -} - -+ (NSDate *)dateWithYear:(NSInteger)year month:(NSInteger)month day:(NSInteger)day hour:(NSInteger)hour minute:(NSInteger)minute second:(NSInteger)second { - - NSDate *nsDate = nil; - NSDateComponents *components = [[NSDateComponents alloc] init]; - - components.year = year; - components.month = month; - components.day = day; - components.hour = hour; - components.minute = minute; - components.second = second; - - nsDate = [[[self class] implicitCalendar] dateFromComponents:components]; - - return nsDate; -} - -+ (NSDate *)dateWithString:(NSString *)dateString formatString:(NSString *)formatString { - - return [self dateWithString:dateString formatString:formatString timeZone:[NSTimeZone systemTimeZone]]; -} - -+ (NSDate *)dateWithString:(NSString *)dateString formatString:(NSString *)formatString timeZone:(NSTimeZone *)timeZone { - - static NSDateFormatter *parser = nil; - static dispatch_once_t onceToken; - dispatch_once(&onceToken, ^{ - parser = [[NSDateFormatter alloc] init]; - }); - - parser.dateStyle = NSDateFormatterNoStyle; - parser.timeStyle = NSDateFormatterNoStyle; - parser.timeZone = timeZone; - parser.dateFormat = formatString; - - return [parser dateFromString:dateString]; -} - - -#pragma mark - Date Editing -#pragma mark Date By Adding -/** - * Returns a date representing the receivers date shifted later by the provided number of years. - * - * @param years NSInteger - Number of years to add - * - * @return NSDate - Date modified by the number of desired years - */ -- (NSDate *)dateByAddingYears:(NSInteger)years{ - NSCalendar *calendar = [[self class] implicitCalendar]; - NSDateComponents *components = [[NSDateComponents alloc] init]; - [components setYear:years]; - - return [calendar dateByAddingComponents:components toDate:self options:0]; -} - -/** - * Returns a date representing the receivers date shifted later by the provided number of months. - * - * @param months NSInteger - Number of months to add - * - * @return NSDate - Date modified by the number of desired months - */ -- (NSDate *)dateByAddingMonths:(NSInteger)months{ - NSCalendar *calendar = [[self class] implicitCalendar]; - NSDateComponents *components = [[NSDateComponents alloc] init]; - [components setMonth:months]; - - return [calendar dateByAddingComponents:components toDate:self options:0]; -} - -/** - * Returns a date representing the receivers date shifted later by the provided number of weeks. - * - * @param weeks NSInteger - Number of weeks to add - * - * @return NSDate - Date modified by the number of desired weeks - */ -- (NSDate *)dateByAddingWeeks:(NSInteger)weeks{ - NSCalendar *calendar = [[self class] implicitCalendar]; - NSDateComponents *components = [[NSDateComponents alloc] init]; - [components setWeekOfYear:weeks]; - - return [calendar dateByAddingComponents:components toDate:self options:0]; -} - -/** - * Returns a date representing the receivers date shifted later by the provided number of days. - * - * @param days NSInteger - Number of days to add - * - * @return NSDate - Date modified by the number of desired days - */ -- (NSDate *)dateByAddingDays:(NSInteger)days{ - NSCalendar *calendar = [[self class] implicitCalendar]; - NSDateComponents *components = [[NSDateComponents alloc] init]; - [components setDay:days]; - - return [calendar dateByAddingComponents:components toDate:self options:0]; -} - -/** - * Returns a date representing the receivers date shifted later by the provided number of hours. - * - * @param hours NSInteger - Number of hours to add - * - * @return NSDate - Date modified by the number of desired hours - */ -- (NSDate *)dateByAddingHours:(NSInteger)hours{ - NSCalendar *calendar = [[self class] implicitCalendar]; - NSDateComponents *components = [[NSDateComponents alloc] init]; - [components setHour:hours]; - - return [calendar dateByAddingComponents:components toDate:self options:0]; -} - -/** - * Returns a date representing the receivers date shifted later by the provided number of minutes. - * - * @param minutes NSInteger - Number of minutes to add - * - * @return NSDate - Date modified by the number of desired minutes - */ -- (NSDate *)dateByAddingMinutes:(NSInteger)minutes{ - NSCalendar *calendar = [[self class] implicitCalendar]; - NSDateComponents *components = [[NSDateComponents alloc] init]; - [components setMinute:minutes]; - - return [calendar dateByAddingComponents:components toDate:self options:0]; -} - -/** - * Returns a date representing the receivers date shifted later by the provided number of seconds. - * - * @param seconds NSInteger - Number of seconds to add - * - * @return NSDate - Date modified by the number of desired seconds - */ -- (NSDate *)dateByAddingSeconds:(NSInteger)seconds{ - NSCalendar *calendar = [[self class] implicitCalendar]; - NSDateComponents *components = [[NSDateComponents alloc] init]; - [components setSecond:seconds]; - - return [calendar dateByAddingComponents:components toDate:self options:0]; -} - -#pragma mark Date By Subtracting -/** - * Returns a date representing the receivers date shifted earlier by the provided number of years. - * - * @param years NSInteger - Number of years to subtract - * - * @return NSDate - Date modified by the number of desired years - */ -- (NSDate *)dateBySubtractingYears:(NSInteger)years{ - NSCalendar *calendar = [[self class] implicitCalendar]; - NSDateComponents *components = [[NSDateComponents alloc] init]; - [components setYear:-1*years]; - - return [calendar dateByAddingComponents:components toDate:self options:0]; -} - -/** - * Returns a date representing the receivers date shifted earlier by the provided number of months. - * - * @param months NSInteger - Number of months to subtract - * - * @return NSDate - Date modified by the number of desired months - */ -- (NSDate *)dateBySubtractingMonths:(NSInteger)months{ - NSCalendar *calendar = [[self class] implicitCalendar]; - NSDateComponents *components = [[NSDateComponents alloc] init]; - [components setMonth:-1*months]; - - return [calendar dateByAddingComponents:components toDate:self options:0]; -} - -/** - * Returns a date representing the receivers date shifted earlier by the provided number of weeks. - * - * @param weeks NSInteger - Number of weeks to subtract - * - * @return NSDate - Date modified by the number of desired weeks - */ -- (NSDate *)dateBySubtractingWeeks:(NSInteger)weeks{ - NSCalendar *calendar = [[self class] implicitCalendar]; - NSDateComponents *components = [[NSDateComponents alloc] init]; - [components setWeekOfYear:-1*weeks]; - - return [calendar dateByAddingComponents:components toDate:self options:0]; -} - -/** - * Returns a date representing the receivers date shifted earlier by the provided number of days. - * - * @param days NSInteger - Number of days to subtract - * - * @return NSDate - Date modified by the number of desired days - */ -- (NSDate *)dateBySubtractingDays:(NSInteger)days{ - NSCalendar *calendar = [[self class] implicitCalendar]; - NSDateComponents *components = [[NSDateComponents alloc] init]; - [components setDay:-1*days]; - - return [calendar dateByAddingComponents:components toDate:self options:0]; -} - -/** - * Returns a date representing the receivers date shifted earlier by the provided number of hours. - * - * @param hours NSInteger - Number of hours to subtract - * - * @return NSDate - Date modified by the number of desired hours - */ -- (NSDate *)dateBySubtractingHours:(NSInteger)hours{ - NSCalendar *calendar = [[self class] implicitCalendar]; - NSDateComponents *components = [[NSDateComponents alloc] init]; - [components setHour:-1*hours]; - - return [calendar dateByAddingComponents:components toDate:self options:0]; -} - -/** - * Returns a date representing the receivers date shifted earlier by the provided number of minutes. - * - * @param minutes NSInteger - Number of minutes to subtract - * - * @return NSDate - Date modified by the number of desired minutes - */ -- (NSDate *)dateBySubtractingMinutes:(NSInteger)minutes{ - NSCalendar *calendar = [[self class] implicitCalendar]; - NSDateComponents *components = [[NSDateComponents alloc] init]; - [components setMinute:-1*minutes]; - - return [calendar dateByAddingComponents:components toDate:self options:0]; -} - -/** - * Returns a date representing the receivers date shifted earlier by the provided number of seconds. - * - * @param seconds NSInteger - Number of seconds to subtract - * - * @return NSDate - Date modified by the number of desired seconds - */ -- (NSDate *)dateBySubtractingSeconds:(NSInteger)seconds{ - NSCalendar *calendar = [[self class] implicitCalendar]; - NSDateComponents *components = [[NSDateComponents alloc] init]; - [components setSecond:-1*seconds]; - - return [calendar dateByAddingComponents:components toDate:self options:0]; -} - -#pragma mark - Date Comparison -#pragma mark Time From -/** - * Returns an NSInteger representing the amount of time in years between the receiver and the provided date. - * If the receiver is earlier than the provided date, the returned value will be negative. - * Uses the default Gregorian calendar - * - * @param date NSDate - The provided date for comparison - * - * @return NSInteger - The NSInteger representation of the years between receiver and provided date - */ --(NSInteger)yearsFrom:(NSDate *)date{ - return [self yearsFrom:date calendar:nil]; -} - -/** - * Returns an NSInteger representing the amount of time in months between the receiver and the provided date. - * If the receiver is earlier than the provided date, the returned value will be negative. - * Uses the default Gregorian calendar - * - * @param date NSDate - The provided date for comparison - * - * @return NSInteger - The NSInteger representation of the years between receiver and provided date - */ --(NSInteger)monthsFrom:(NSDate *)date{ - return [self monthsFrom:date calendar:nil]; -} - -/** - * Returns an NSInteger representing the amount of time in weeks between the receiver and the provided date. - * If the receiver is earlier than the provided date, the returned value will be negative. - * Uses the default Gregorian calendar - * - * @param date NSDate - The provided date for comparison - * - * @return NSInteger - The double representation of the weeks between receiver and provided date - */ --(NSInteger)weeksFrom:(NSDate *)date{ - return [self weeksFrom:date calendar:nil]; -} - -/** - * Returns an NSInteger representing the amount of time in days between the receiver and the provided date. - * If the receiver is earlier than the provided date, the returned value will be negative. - * Uses the default Gregorian calendar - * - * @param date NSDate - The provided date for comparison - * - * @return NSInteger - The double representation of the days between receiver and provided date - */ --(NSInteger)daysFrom:(NSDate *)date{ - return [self daysFrom:date calendar:nil]; -} - -/** - * Returns an NSInteger representing the amount of time in hours between the receiver and the provided date. - * If the receiver is earlier than the provided date, the returned value will be negative. - * - * @param date NSDate - The provided date for comparison - * - * @return double - The double representation of the hours between receiver and provided date - */ --(double)hoursFrom:(NSDate *)date{ - return ([self timeIntervalSinceDate:date])/SECONDS_IN_HOUR; -} - -/** - * Returns an NSInteger representing the amount of time in minutes between the receiver and the provided date. - * If the receiver is earlier than the provided date, the returned value will be negative. - * - * @param date NSDate - The provided date for comparison - * - * @return double - The double representation of the minutes between receiver and provided date - */ --(double)minutesFrom:(NSDate *)date{ - return ([self timeIntervalSinceDate:date])/SECONDS_IN_MINUTE; -} - -/** - * Returns an NSInteger representing the amount of time in seconds between the receiver and the provided date. - * If the receiver is earlier than the provided date, the returned value will be negative. - * - * @param date NSDate - The provided date for comparison - * - * @return double - The double representation of the seconds between receiver and provided date - */ --(double)secondsFrom:(NSDate *)date{ - return [self timeIntervalSinceDate:date]; -} - -#pragma mark Time From With Calendar -/** - * Returns an NSInteger representing the amount of time in years between the receiver and the provided date. - * If the receiver is earlier than the provided date, the returned value will be negative. - * - * @param date NSDate - The provided date for comparison - * @param calendar NSCalendar - The calendar to be used in the calculation - * - * @return NSInteger - The double representation of the years between receiver and provided date - */ --(NSInteger)yearsFrom:(NSDate *)date calendar:(NSCalendar *)calendar{ - if (!calendar) { - calendar = [[self class] implicitCalendar]; - } - - NSDate *earliest = [self earlierDate:date]; - NSDate *latest = (earliest == self) ? date : self; - NSInteger multiplier = (earliest == self) ? -1 : 1; - NSDateComponents *components = [calendar components:NSCalendarUnitYear fromDate:earliest toDate:latest options:0]; - return multiplier*components.year; -} - -/** - * Returns an NSInteger representing the amount of time in months between the receiver and the provided date. - * If the receiver is earlier than the provided date, the returned value will be negative. - * - * @param date NSDate - The provided date for comparison - * @param calendar NSCalendar - The calendar to be used in the calculation - * - * @return NSInteger - The double representation of the months between receiver and provided date - */ --(NSInteger)monthsFrom:(NSDate *)date calendar:(NSCalendar *)calendar{ - if (!calendar) { - calendar = [[self class] implicitCalendar]; - } - - NSDate *earliest = [self earlierDate:date]; - NSDate *latest = (earliest == self) ? date : self; - NSInteger multiplier = (earliest == self) ? -1 : 1; - NSDateComponents *components = [calendar components:allCalendarUnitFlags fromDate:earliest toDate:latest options:0]; - return multiplier*(components.month + 12*components.year); -} - -/** - * Returns an NSInteger representing the amount of time in weeks between the receiver and the provided date. - * If the receiver is earlier than the provided date, the returned value will be negative. - * - * @param date NSDate - The provided date for comparison - * @param calendar NSCalendar - The calendar to be used in the calculation - * - * @return NSInteger - The double representation of the weeks between receiver and provided date - */ --(NSInteger)weeksFrom:(NSDate *)date calendar:(NSCalendar *)calendar{ - if (!calendar) { - calendar = [[self class] implicitCalendar]; - } - - NSDate *earliest = [self earlierDate:date]; - NSDate *latest = (earliest == self) ? date : self; - NSInteger multiplier = (earliest == self) ? -1 : 1; - NSDateComponents *components = [calendar components:NSCalendarUnitWeekOfYear fromDate:earliest toDate:latest options:0]; - return multiplier*components.weekOfYear; -} - -/** - * Returns an NSInteger representing the amount of time in days between the receiver and the provided date. - * If the receiver is earlier than the provided date, the returned value will be negative. - * - * @param date NSDate - The provided date for comparison - * @param calendar NSCalendar - The calendar to be used in the calculation - * - * @return NSInteger - The double representation of the days between receiver and provided date - */ --(NSInteger)daysFrom:(NSDate *)date calendar:(NSCalendar *)calendar{ - if (!calendar) { - calendar = [[self class] implicitCalendar]; - } - - NSDate *earliest = [self earlierDate:date]; - NSDate *latest = (earliest == self) ? date : self; - NSInteger multiplier = (earliest == self) ? -1 : 1; - NSDateComponents *components = [calendar components:NSCalendarUnitDay fromDate:earliest toDate:latest options:0]; - return multiplier*components.day; -} - -#pragma mark Time Until -/** - * Returns the number of years until the receiver's date. Returns 0 if the receiver is the same or earlier than now. - * - * @return NSInteger representiation of years - */ --(NSInteger)yearsUntil{ - return [self yearsLaterThan:[NSDate date]]; -} - -/** - * Returns the number of months until the receiver's date. Returns 0 if the receiver is the same or earlier than now. - * - * @return NSInteger representiation of months - */ --(NSInteger)monthsUntil{ - return [self monthsLaterThan:[NSDate date]]; -} - -/** - * Returns the number of weeks until the receiver's date. Returns 0 if the receiver is the same or earlier than now. - * - * @return NSInteger representiation of weeks - */ --(NSInteger)weeksUntil{ - return [self weeksLaterThan:[NSDate date]]; -} - -/** - * Returns the number of days until the receiver's date. Returns 0 if the receiver is the same or earlier than now. - * - * @return NSInteger representiation of days - */ --(NSInteger)daysUntil{ - return [self daysLaterThan:[NSDate date]]; -} - -/** - * Returns the number of hours until the receiver's date. Returns 0 if the receiver is the same or earlier than now. - * - * @return double representiation of hours - */ --(double)hoursUntil{ - return [self hoursLaterThan:[NSDate date]]; -} - -/** - * Returns the number of minutes until the receiver's date. Returns 0 if the receiver is the same or earlier than now. - * - * @return double representiation of minutes - */ --(double)minutesUntil{ - return [self minutesLaterThan:[NSDate date]]; -} - -/** - * Returns the number of seconds until the receiver's date. Returns 0 if the receiver is the same or earlier than now. - * - * @return double representiation of seconds - */ --(double)secondsUntil{ - return [self secondsLaterThan:[NSDate date]]; -} - -#pragma mark Time Ago -/** - * Returns the number of years the receiver's date is earlier than now. Returns 0 if the receiver is the same or later than now. - * - * @return NSInteger representiation of years - */ --(NSInteger)yearsAgo{ - return [self yearsEarlierThan:[NSDate date]]; -} - -/** - * Returns the number of months the receiver's date is earlier than now. Returns 0 if the receiver is the same or later than now. - * - * @return NSInteger representiation of months - */ --(NSInteger)monthsAgo{ - return [self monthsEarlierThan:[NSDate date]]; -} - -/** - * Returns the number of weeks the receiver's date is earlier than now. Returns 0 if the receiver is the same or later than now. - * - * @return NSInteger representiation of weeks - */ --(NSInteger)weeksAgo{ - return [self weeksEarlierThan:[NSDate date]]; -} - -/** - * Returns the number of days the receiver's date is earlier than now. Returns 0 if the receiver is the same or later than now. - * - * @return NSInteger representiation of days - */ --(NSInteger)daysAgo{ - return [self daysEarlierThan:[NSDate date]]; -} - -/** - * Returns the number of hours the receiver's date is earlier than now. Returns 0 if the receiver is the same or later than now. - * - * @return double representiation of hours - */ --(double)hoursAgo{ - return [self hoursEarlierThan:[NSDate date]]; -} - -/** - * Returns the number of minutes the receiver's date is earlier than now. Returns 0 if the receiver is the same or later than now. - * - * @return double representiation of minutes - */ --(double)minutesAgo{ - return [self minutesEarlierThan:[NSDate date]]; -} - -/** - * Returns the number of seconds the receiver's date is earlier than now. Returns 0 if the receiver is the same or later than now. - * - * @return double representiation of seconds - */ --(double)secondsAgo{ - return [self secondsEarlierThan:[NSDate date]]; -} - -#pragma mark Earlier Than -/** - * Returns the number of years the receiver's date is earlier than the provided comparison date. - * Returns 0 if the receiver's date is later than or equal to the provided comparison date. - * - * @param date NSDate - Provided date for comparison - * - * @return NSInteger representing the number of years - */ --(NSInteger)yearsEarlierThan:(NSDate *)date{ - return ABS(MIN([self yearsFrom:date], 0)); -} - -/** - * Returns the number of months the receiver's date is earlier than the provided comparison date. - * Returns 0 if the receiver's date is later than or equal to the provided comparison date. - * - * @param date NSDate - Provided date for comparison - * - * @return NSInteger representing the number of months - */ --(NSInteger)monthsEarlierThan:(NSDate *)date{ - return ABS(MIN([self monthsFrom:date], 0)); -} - -/** - * Returns the number of weeks the receiver's date is earlier than the provided comparison date. - * Returns 0 if the receiver's date is later than or equal to the provided comparison date. - * - * @param date NSDate - Provided date for comparison - * - * @return NSInteger representing the number of weeks - */ --(NSInteger)weeksEarlierThan:(NSDate *)date{ - return ABS(MIN([self weeksFrom:date], 0)); -} - -/** - * Returns the number of days the receiver's date is earlier than the provided comparison date. - * Returns 0 if the receiver's date is later than or equal to the provided comparison date. - * - * @param date NSDate - Provided date for comparison - * - * @return NSInteger representing the number of days - */ --(NSInteger)daysEarlierThan:(NSDate *)date{ - return ABS(MIN([self daysFrom:date], 0)); -} - -/** - * Returns the number of hours the receiver's date is earlier than the provided comparison date. - * Returns 0 if the receiver's date is later than or equal to the provided comparison date. - * - * @param date NSDate - Provided date for comparison - * - * @return double representing the number of hours - */ --(double)hoursEarlierThan:(NSDate *)date{ - return ABS(MIN([self hoursFrom:date], 0)); -} - -/** - * Returns the number of minutes the receiver's date is earlier than the provided comparison date. - * Returns 0 if the receiver's date is later than or equal to the provided comparison date. - * - * @param date NSDate - Provided date for comparison - * - * @return double representing the number of minutes - */ --(double)minutesEarlierThan:(NSDate *)date{ - return ABS(MIN([self minutesFrom:date], 0)); -} - -/** - * Returns the number of seconds the receiver's date is earlier than the provided comparison date. - * Returns 0 if the receiver's date is later than or equal to the provided comparison date. - * - * @param date NSDate - Provided date for comparison - * - * @return double representing the number of seconds - */ --(double)secondsEarlierThan:(NSDate *)date{ - return ABS(MIN([self secondsFrom:date], 0)); -} - -#pragma mark Later Than -/** - * Returns the number of years the receiver's date is later than the provided comparison date. - * Returns 0 if the receiver's date is earlier than or equal to the provided comparison date. - * - * @param date NSDate - Provided date for comparison - * - * @return NSInteger representing the number of years - */ --(NSInteger)yearsLaterThan:(NSDate *)date{ - return MAX([self yearsFrom:date], 0); -} - -/** - * Returns the number of months the receiver's date is later than the provided comparison date. - * Returns 0 if the receiver's date is earlier than or equal to the provided comparison date. - * - * @param date NSDate - Provided date for comparison - * - * @return NSInteger representing the number of months - */ --(NSInteger)monthsLaterThan:(NSDate *)date{ - return MAX([self monthsFrom:date], 0); -} - -/** - * Returns the number of weeks the receiver's date is later than the provided comparison date. - * Returns 0 if the receiver's date is earlier than or equal to the provided comparison date. - * - * @param date NSDate - Provided date for comparison - * - * @return NSInteger representing the number of weeks - */ --(NSInteger)weeksLaterThan:(NSDate *)date{ - return MAX([self weeksFrom:date], 0); -} - -/** - * Returns the number of days the receiver's date is later than the provided comparison date. - * Returns 0 if the receiver's date is earlier than or equal to the provided comparison date. - * - * @param date NSDate - Provided date for comparison - * - * @return NSInteger representing the number of days - */ --(NSInteger)daysLaterThan:(NSDate *)date{ - return MAX([self daysFrom:date], 0); -} - -/** - * Returns the number of hours the receiver's date is later than the provided comparison date. - * Returns 0 if the receiver's date is earlier than or equal to the provided comparison date. - * - * @param date NSDate - Provided date for comparison - * - * @return double representing the number of hours - */ --(double)hoursLaterThan:(NSDate *)date{ - return MAX([self hoursFrom:date], 0); -} - -/** - * Returns the number of minutes the receiver's date is later than the provided comparison date. - * Returns 0 if the receiver's date is earlier than or equal to the provided comparison date. - * - * @param date NSDate - Provided date for comparison - * - * @return double representing the number of minutes - */ --(double)minutesLaterThan:(NSDate *)date{ - return MAX([self minutesFrom:date], 0); -} - -/** - * Returns the number of seconds the receiver's date is later than the provided comparison date. - * Returns 0 if the receiver's date is earlier than or equal to the provided comparison date. - * - * @param date NSDate - Provided date for comparison - * - * @return double representing the number of seconds - */ --(double)secondsLaterThan:(NSDate *)date{ - return MAX([self secondsFrom:date], 0); -} - - -#pragma mark Comparators -/** - * Returns a YES if receiver is earlier than provided comparison date, otherwise returns NO - * - * @param date NSDate - Provided date for comparison - * - * @return BOOL representing comparison result - */ --(BOOL)isEarlierThan:(NSDate *)date{ - if (self.timeIntervalSince1970 < date.timeIntervalSince1970) { - return YES; - } - return NO; -} - -/** - * Returns a YES if receiver is later than provided comparison date, otherwise returns NO - * - * @param date NSDate - Provided date for comparison - * - * @return BOOL representing comparison result - */ --(BOOL)isLaterThan:(NSDate *)date{ - if (self.timeIntervalSince1970 > date.timeIntervalSince1970) { - return YES; - } - return NO; -} - -/** - * Returns a YES if receiver is earlier than or equal to the provided comparison date, otherwise returns NO - * - * @param date NSDate - Provided date for comparison - * - * @return BOOL representing comparison result - */ --(BOOL)isEarlierThanOrEqualTo:(NSDate *)date{ - if (self.timeIntervalSince1970 <= date.timeIntervalSince1970) { - return YES; - } - return NO; -} - -/** - * Returns a YES if receiver is later than or equal to provided comparison date, otherwise returns NO - * - * @param date NSDate - Provided date for comparison - * - * @return BOOL representing comparison result - */ --(BOOL)isLaterThanOrEqualTo:(NSDate *)date{ - if (self.timeIntervalSince1970 >= date.timeIntervalSince1970) { - return YES; - } - return NO; -} - -#pragma mark - Formatted Dates -#pragma mark Formatted With Style -/** - * Convenience method that returns a formatted string representing the receiver's date formatted to a given style - * - * @param style NSDateFormatterStyle - Desired date formatting style - * - * @return NSString representing the formatted date string - */ --(NSString *)formattedDateWithStyle:(NSDateFormatterStyle)style{ - return [self formattedDateWithStyle:style timeZone:[NSTimeZone systemTimeZone] locale:[NSLocale autoupdatingCurrentLocale]]; -} - -/** - * Convenience method that returns a formatted string representing the receiver's date formatted to a given style and time zone - * - * @param style NSDateFormatterStyle - Desired date formatting style - * @param timeZone NSTimeZone - Desired time zone - * - * @return NSString representing the formatted date string - */ --(NSString *)formattedDateWithStyle:(NSDateFormatterStyle)style timeZone:(NSTimeZone *)timeZone{ - return [self formattedDateWithStyle:style timeZone:timeZone locale:[NSLocale autoupdatingCurrentLocale]]; -} - -/** - * Convenience method that returns a formatted string representing the receiver's date formatted to a given style and locale - * - * @param style NSDateFormatterStyle - Desired date formatting style - * @param locale NSLocale - Desired locale - * - * @return NSString representing the formatted date string - */ --(NSString *)formattedDateWithStyle:(NSDateFormatterStyle)style locale:(NSLocale *)locale{ - return [self formattedDateWithStyle:style timeZone:[NSTimeZone systemTimeZone] locale:locale]; -} - -/** - * Convenience method that returns a formatted string representing the receiver's date formatted to a given style, time zone and locale - * - * @param style NSDateFormatterStyle - Desired date formatting style - * @param timeZone NSTimeZone - Desired time zone - * @param locale NSLocale - Desired locale - * - * @return NSString representing the formatted date string - */ --(NSString *)formattedDateWithStyle:(NSDateFormatterStyle)style timeZone:(NSTimeZone *)timeZone locale:(NSLocale *)locale{ - static NSDateFormatter *formatter = nil; - static dispatch_once_t onceToken; - dispatch_once(&onceToken, ^{ - formatter = [[NSDateFormatter alloc] init]; - }); - - [formatter setDateStyle:style]; - [formatter setTimeZone:timeZone]; - [formatter setLocale:locale]; - return [formatter stringFromDate:self]; -} - -#pragma mark Formatted With Format -/** - * Convenience method that returns a formatted string representing the receiver's date formatted to a given date format - * - * @param format NSString - String representing the desired date format - * - * @return NSString representing the formatted date string - */ --(NSString *)formattedDateWithFormat:(NSString *)format{ - return [self formattedDateWithFormat:format timeZone:[NSTimeZone systemTimeZone] locale:[NSLocale autoupdatingCurrentLocale]]; -} - -/** - * Convenience method that returns a formatted string representing the receiver's date formatted to a given date format and time zone - * - * @param format NSString - String representing the desired date format - * @param timeZone NSTimeZone - Desired time zone - * - * @return NSString representing the formatted date string - */ --(NSString *)formattedDateWithFormat:(NSString *)format timeZone:(NSTimeZone *)timeZone{ - return [self formattedDateWithFormat:format timeZone:timeZone locale:[NSLocale autoupdatingCurrentLocale]]; -} - -/** - * Convenience method that returns a formatted string representing the receiver's date formatted to a given date format and locale - * - * @param format NSString - String representing the desired date format - * @param locale NSLocale - Desired locale - * - * @return NSString representing the formatted date string - */ --(NSString *)formattedDateWithFormat:(NSString *)format locale:(NSLocale *)locale{ - return [self formattedDateWithFormat:format timeZone:[NSTimeZone systemTimeZone] locale:locale]; -} - -/** - * Convenience method that returns a formatted string representing the receiver's date formatted to a given date format, time zone and locale - * - * @param format NSString - String representing the desired date format - * @param timeZone NSTimeZone - Desired time zone - * @param locale NSLocale - Desired locale - * - * @return NSString representing the formatted date string - */ --(NSString *)formattedDateWithFormat:(NSString *)format timeZone:(NSTimeZone *)timeZone locale:(NSLocale *)locale{ - static NSDateFormatter *formatter = nil; - static dispatch_once_t onceToken; - dispatch_once(&onceToken, ^{ - formatter = [[NSDateFormatter alloc] init]; - }); - - [formatter setDateFormat:format]; - [formatter setTimeZone:timeZone]; - [formatter setLocale:locale]; - return [formatter stringFromDate:self]; -} - -#pragma mark - Helpers -/** - * Class method that returns whether the given year is a leap year for the Gregorian Calendar - * Returns YES if year is a leap year, otherwise returns NO - * - * @param year NSInteger - Year to evaluate - * - * @return BOOL evaluation of year - */ -+(BOOL)isLeapYear:(NSInteger)year{ - if (year%400){ - return YES; - } - else if (year%100){ - return NO; - } - else if (year%4){ - return YES; - } - - return NO; -} - -/** - * Retrieves the default calendar identifier used for all non-calendar-specified operations - * - * @return NSString - NSCalendarIdentifier - */ -+(NSString *)defaultCalendarIdentifier { - return defaultCalendarIdentifier; -} - -/** - * Sets the default calendar identifier used for all non-calendar-specified operations - * - * @param identifier NSString - NSCalendarIdentifier - */ -+ (void)setDefaultCalendarIdentifier:(NSString *)identifier { - defaultCalendarIdentifier = [identifier copy]; - implicitCalendar = [[NSCalendar alloc] initWithCalendarIdentifier:defaultCalendarIdentifier ?: NSCalendarIdentifierGregorian]; -} - -/** - * Retrieves a default NSCalendar instance, based on the value of defaultCalendarSetting - * - * @return NSCalendar The current implicit calendar - */ -+ (NSCalendar *)implicitCalendar { - return implicitCalendar; -} - -@end diff --git a/DateTools/Examples/DateToolsExample/DateTools macOS/DateTools macOS.h b/DateTools/Examples/DateToolsExample/DateTools macOS/DateTools macOS.h deleted file mode 100644 index 5d913b53..00000000 --- a/DateTools/Examples/DateToolsExample/DateTools macOS/DateTools macOS.h +++ /dev/null @@ -1,19 +0,0 @@ -// -// DateTools macOS.h -// DateTools macOS -// -// Created by Tom Baranes on 22/09/2016. -// -// - -#import - -//! Project version number for DateTools macOS. -FOUNDATION_EXPORT double DateTools_macOSVersionNumber; - -//! Project version string for DateTools macOS. -FOUNDATION_EXPORT const unsigned char DateTools_macOSVersionString[]; - -// In this header, you should import all the public headers of your framework using statements like #import - - diff --git a/DateTools/Examples/DateToolsExample/DateTools macOS/Info.plist b/DateTools/Examples/DateToolsExample/DateTools macOS/Info.plist deleted file mode 100644 index fbe1e6b3..00000000 --- a/DateTools/Examples/DateToolsExample/DateTools macOS/Info.plist +++ /dev/null @@ -1,24 +0,0 @@ - - - - - CFBundleDevelopmentRegion - en - CFBundleExecutable - $(EXECUTABLE_NAME) - CFBundleIdentifier - $(PRODUCT_BUNDLE_IDENTIFIER) - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - $(PRODUCT_NAME) - CFBundlePackageType - FMWK - CFBundleShortVersionString - 1.0 - CFBundleVersion - $(CURRENT_PROJECT_VERSION) - NSPrincipalClass - - - diff --git a/DateTools/Examples/DateToolsExample/DateTools/Info.plist b/DateTools/Examples/DateToolsExample/DateTools/Info.plist deleted file mode 100644 index d3de8eef..00000000 --- a/DateTools/Examples/DateToolsExample/DateTools/Info.plist +++ /dev/null @@ -1,26 +0,0 @@ - - - - - CFBundleDevelopmentRegion - en - CFBundleExecutable - $(EXECUTABLE_NAME) - CFBundleIdentifier - $(PRODUCT_BUNDLE_IDENTIFIER) - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - $(PRODUCT_NAME) - CFBundlePackageType - FMWK - CFBundleShortVersionString - 1.0 - CFBundleSignature - ???? - CFBundleVersion - $(CURRENT_PROJECT_VERSION) - NSPrincipalClass - - - diff --git a/DateTools/Examples/DateToolsExample/DateToolsExample.xcodeproj/project.pbxproj b/DateTools/Examples/DateToolsExample/DateToolsExample.xcodeproj/project.pbxproj deleted file mode 100644 index 0a249df2..00000000 --- a/DateTools/Examples/DateToolsExample/DateToolsExample.xcodeproj/project.pbxproj +++ /dev/null @@ -1,1027 +0,0 @@ -// !$*UTF8*$! -{ - archiveVersion = 1; - classes = { - }; - objectVersion = 46; - objects = { - -/* Begin PBXBuildFile section */ - 0AFD486518F0BBC0004D0FE1 /* DateTools.bundle in Resources */ = {isa = PBXBuildFile; fileRef = 0AFD486418F0BBC0004D0FE1 /* DateTools.bundle */; }; - 901CF0E31B6CA9FE00F6414B /* DateTools.bundle in Resources */ = {isa = PBXBuildFile; fileRef = 901CF0D31B6CA9FE00F6414B /* DateTools.bundle */; }; - 901CF0E41B6CA9FE00F6414B /* DateTools.h in Headers */ = {isa = PBXBuildFile; fileRef = 901CF0D41B6CA9FE00F6414B /* DateTools.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 901CF0E51B6CA9FE00F6414B /* DTConstants.h in Headers */ = {isa = PBXBuildFile; fileRef = 901CF0D51B6CA9FE00F6414B /* DTConstants.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 901CF0E61B6CA9FE00F6414B /* DTConstants.m in Sources */ = {isa = PBXBuildFile; fileRef = 901CF0D61B6CA9FE00F6414B /* DTConstants.m */; }; - 901CF0E71B6CA9FE00F6414B /* DTError.h in Headers */ = {isa = PBXBuildFile; fileRef = 901CF0D71B6CA9FE00F6414B /* DTError.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 901CF0E81B6CA9FE00F6414B /* DTError.m in Sources */ = {isa = PBXBuildFile; fileRef = 901CF0D81B6CA9FE00F6414B /* DTError.m */; }; - 901CF0E91B6CA9FE00F6414B /* DTTimePeriod.h in Headers */ = {isa = PBXBuildFile; fileRef = 901CF0D91B6CA9FE00F6414B /* DTTimePeriod.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 901CF0EA1B6CA9FE00F6414B /* DTTimePeriod.m in Sources */ = {isa = PBXBuildFile; fileRef = 901CF0DA1B6CA9FE00F6414B /* DTTimePeriod.m */; }; - 901CF0EB1B6CA9FE00F6414B /* DTTimePeriodChain.h in Headers */ = {isa = PBXBuildFile; fileRef = 901CF0DB1B6CA9FE00F6414B /* DTTimePeriodChain.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 901CF0EC1B6CA9FE00F6414B /* DTTimePeriodChain.m in Sources */ = {isa = PBXBuildFile; fileRef = 901CF0DC1B6CA9FE00F6414B /* DTTimePeriodChain.m */; }; - 901CF0ED1B6CA9FE00F6414B /* DTTimePeriodCollection.h in Headers */ = {isa = PBXBuildFile; fileRef = 901CF0DD1B6CA9FE00F6414B /* DTTimePeriodCollection.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 901CF0EE1B6CA9FE00F6414B /* DTTimePeriodCollection.m in Sources */ = {isa = PBXBuildFile; fileRef = 901CF0DE1B6CA9FE00F6414B /* DTTimePeriodCollection.m */; }; - 901CF0EF1B6CA9FE00F6414B /* DTTimePeriodGroup.h in Headers */ = {isa = PBXBuildFile; fileRef = 901CF0DF1B6CA9FE00F6414B /* DTTimePeriodGroup.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 901CF0F01B6CA9FE00F6414B /* DTTimePeriodGroup.m in Sources */ = {isa = PBXBuildFile; fileRef = 901CF0E01B6CA9FE00F6414B /* DTTimePeriodGroup.m */; }; - 901CF0F11B6CA9FE00F6414B /* NSDate+DateTools.h in Headers */ = {isa = PBXBuildFile; fileRef = 901CF0E11B6CA9FE00F6414B /* NSDate+DateTools.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 901CF0F21B6CA9FE00F6414B /* NSDate+DateTools.m in Sources */ = {isa = PBXBuildFile; fileRef = 901CF0E21B6CA9FE00F6414B /* NSDate+DateTools.m */; }; - D935DB441B567FBD00BAA4F0 /* DTConstants.m in Sources */ = {isa = PBXBuildFile; fileRef = D935DB431B567FBD00BAA4F0 /* DTConstants.m */; }; - E2A14E631D9415BC00645D6B /* DTConstants.m in Sources */ = {isa = PBXBuildFile; fileRef = 901CF0D61B6CA9FE00F6414B /* DTConstants.m */; }; - E2A14E641D9415BC00645D6B /* DTError.m in Sources */ = {isa = PBXBuildFile; fileRef = 901CF0D81B6CA9FE00F6414B /* DTError.m */; }; - E2A14E651D9415BC00645D6B /* DTTimePeriod.m in Sources */ = {isa = PBXBuildFile; fileRef = 901CF0DA1B6CA9FE00F6414B /* DTTimePeriod.m */; }; - E2A14E661D9415BC00645D6B /* DTTimePeriodChain.m in Sources */ = {isa = PBXBuildFile; fileRef = 901CF0DC1B6CA9FE00F6414B /* DTTimePeriodChain.m */; }; - E2A14E671D9415BC00645D6B /* DTTimePeriodCollection.m in Sources */ = {isa = PBXBuildFile; fileRef = 901CF0DE1B6CA9FE00F6414B /* DTTimePeriodCollection.m */; }; - E2A14E681D9415BC00645D6B /* DTTimePeriodGroup.m in Sources */ = {isa = PBXBuildFile; fileRef = 901CF0E01B6CA9FE00F6414B /* DTTimePeriodGroup.m */; }; - E2A14E691D9415BC00645D6B /* NSDate+DateTools.m in Sources */ = {isa = PBXBuildFile; fileRef = 901CF0E21B6CA9FE00F6414B /* NSDate+DateTools.m */; }; - E2A14E6A1D9415C000645D6B /* DateTools.bundle in Resources */ = {isa = PBXBuildFile; fileRef = 901CF0D31B6CA9FE00F6414B /* DateTools.bundle */; }; - E2A14E6B1D9415C300645D6B /* DateTools.h in Headers */ = {isa = PBXBuildFile; fileRef = 901CF0D41B6CA9FE00F6414B /* DateTools.h */; settings = {ATTRIBUTES = (Public, ); }; }; - E2A14E6C1D9415D700645D6B /* DTConstants.h in Headers */ = {isa = PBXBuildFile; fileRef = 901CF0D51B6CA9FE00F6414B /* DTConstants.h */; settings = {ATTRIBUTES = (Public, ); }; }; - E2A14E6D1D9415D700645D6B /* DTError.h in Headers */ = {isa = PBXBuildFile; fileRef = 901CF0D71B6CA9FE00F6414B /* DTError.h */; settings = {ATTRIBUTES = (Public, ); }; }; - E2A14E6E1D9415D700645D6B /* DTTimePeriod.h in Headers */ = {isa = PBXBuildFile; fileRef = 901CF0D91B6CA9FE00F6414B /* DTTimePeriod.h */; settings = {ATTRIBUTES = (Public, ); }; }; - E2A14E6F1D9415D700645D6B /* DTTimePeriodChain.h in Headers */ = {isa = PBXBuildFile; fileRef = 901CF0DB1B6CA9FE00F6414B /* DTTimePeriodChain.h */; settings = {ATTRIBUTES = (Public, ); }; }; - E2A14E701D9415D700645D6B /* DTTimePeriodCollection.h in Headers */ = {isa = PBXBuildFile; fileRef = 901CF0DD1B6CA9FE00F6414B /* DTTimePeriodCollection.h */; settings = {ATTRIBUTES = (Public, ); }; }; - E2A14E711D9415D700645D6B /* DTTimePeriodGroup.h in Headers */ = {isa = PBXBuildFile; fileRef = 901CF0DF1B6CA9FE00F6414B /* DTTimePeriodGroup.h */; settings = {ATTRIBUTES = (Public, ); }; }; - E2A14E721D9415D700645D6B /* NSDate+DateTools.h in Headers */ = {isa = PBXBuildFile; fileRef = 901CF0E11B6CA9FE00F6414B /* NSDate+DateTools.h */; settings = {ATTRIBUTES = (Public, ); }; }; - F007632018DE5F5E00A99075 /* DateToolsViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = F007631E18DE5F5E00A99075 /* DateToolsViewController.m */; }; - F007632118DE5F5E00A99075 /* DateToolsViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = F007631F18DE5F5E00A99075 /* DateToolsViewController.xib */; }; - F007632518DE5FE300A99075 /* Colours.m in Sources */ = {isa = PBXBuildFile; fileRef = F007632418DE5FE300A99075 /* Colours.m */; }; - F007632C18DE61EE00A99075 /* Calendar_filled.png in Resources */ = {isa = PBXBuildFile; fileRef = F007632818DE61EE00A99075 /* Calendar_filled.png */; }; - F007632D18DE61EE00A99075 /* Calendar_filled@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = F007632918DE61EE00A99075 /* Calendar_filled@2x.png */; }; - F007632E18DE61EE00A99075 /* Calendar.png in Resources */ = {isa = PBXBuildFile; fileRef = F007632A18DE61EE00A99075 /* Calendar.png */; }; - F007632F18DE61EE00A99075 /* Calendar@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = F007632B18DE61EE00A99075 /* Calendar@2x.png */; }; - F007633418DE628900A99075 /* ExampleNavigationController.m in Sources */ = {isa = PBXBuildFile; fileRef = F007633318DE628900A99075 /* ExampleNavigationController.m */; }; - F007633918DE63C400A99075 /* TimePeriodsViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = F007633718DE63C400A99075 /* TimePeriodsViewController.m */; }; - F007633A18DE63C400A99075 /* TimePeriodsViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = F007633818DE63C400A99075 /* TimePeriodsViewController.xib */; }; - F007633F18DE647600A99075 /* Recents_filled.png in Resources */ = {isa = PBXBuildFile; fileRef = F007633B18DE647600A99075 /* Recents_filled.png */; }; - F007634018DE647600A99075 /* Recents_filled@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = F007633C18DE647600A99075 /* Recents_filled@2x.png */; }; - F007634118DE647600A99075 /* Recents.png in Resources */ = {isa = PBXBuildFile; fileRef = F007633D18DE647600A99075 /* Recents.png */; }; - F007634218DE647600A99075 /* Recents@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = F007633E18DE647600A99075 /* Recents@2x.png */; }; - F07A1A0818DCC76500B3E9FF /* DTTimePeriodCollection.m in Sources */ = {isa = PBXBuildFile; fileRef = F07A1A0718DCC76500B3E9FF /* DTTimePeriodCollection.m */; }; - F0A426D618D9FDB500E236C0 /* DTTimePeriod.m in Sources */ = {isa = PBXBuildFile; fileRef = F0A426D518D9FDB500E236C0 /* DTTimePeriod.m */; }; - F0EE17E718DEB1A10010FAD8 /* DTError.m in Sources */ = {isa = PBXBuildFile; fileRef = F0EE17E218DEB1A10010FAD8 /* DTError.m */; }; - F0EE17E818DEB1A10010FAD8 /* DTError.m in Sources */ = {isa = PBXBuildFile; fileRef = F0EE17E218DEB1A10010FAD8 /* DTError.m */; }; - F0EE17E918DEB1A10010FAD8 /* DTTimePeriodChain.m in Sources */ = {isa = PBXBuildFile; fileRef = F0EE17E418DEB1A10010FAD8 /* DTTimePeriodChain.m */; }; - F0EE17EA18DEB1A10010FAD8 /* DTTimePeriodChain.m in Sources */ = {isa = PBXBuildFile; fileRef = F0EE17E418DEB1A10010FAD8 /* DTTimePeriodChain.m */; }; - F0EE17EB18DEB1A10010FAD8 /* DTTimePeriodGroup.m in Sources */ = {isa = PBXBuildFile; fileRef = F0EE17E618DEB1A10010FAD8 /* DTTimePeriodGroup.m */; }; - F0EE17EC18DEB1A10010FAD8 /* DTTimePeriodGroup.m in Sources */ = {isa = PBXBuildFile; fileRef = F0EE17E618DEB1A10010FAD8 /* DTTimePeriodGroup.m */; }; - F0F08D9F18D9E80E00214C6B /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F0F08D9E18D9E80E00214C6B /* Foundation.framework */; }; - F0F08DA118D9E80E00214C6B /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F0F08DA018D9E80E00214C6B /* CoreGraphics.framework */; }; - F0F08DA318D9E80E00214C6B /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F0F08DA218D9E80E00214C6B /* UIKit.framework */; }; - F0F08DA918D9E80E00214C6B /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = F0F08DA718D9E80E00214C6B /* InfoPlist.strings */; }; - F0F08DAB18D9E80E00214C6B /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = F0F08DAA18D9E80E00214C6B /* main.m */; }; - F0F08DAF18D9E80E00214C6B /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = F0F08DAE18D9E80E00214C6B /* AppDelegate.m */; }; - F0F08DB718D9E80E00214C6B /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = F0F08DB618D9E80E00214C6B /* Images.xcassets */; }; - F0F08DBE18D9E80E00214C6B /* XCTest.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F0F08DBD18D9E80E00214C6B /* XCTest.framework */; }; - F0F08DBF18D9E80E00214C6B /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F0F08D9E18D9E80E00214C6B /* Foundation.framework */; }; - F0F08DC018D9E80E00214C6B /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F0F08DA218D9E80E00214C6B /* UIKit.framework */; }; - F0F08DC818D9E80E00214C6B /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = F0F08DC618D9E80E00214C6B /* InfoPlist.strings */; }; - F0F08DD918D9E94F00214C6B /* NSDate+DateTools.m in Sources */ = {isa = PBXBuildFile; fileRef = F0F08DD818D9E94F00214C6B /* NSDate+DateTools.m */; }; -/* End PBXBuildFile section */ - -/* Begin PBXContainerItemProxy section */ - F0F08DC118D9E80E00214C6B /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = F0F08D9318D9E80E00214C6B /* Project object */; - proxyType = 1; - remoteGlobalIDString = F0F08D9A18D9E80E00214C6B; - remoteInfo = DateToolsExample; - }; -/* End PBXContainerItemProxy section */ - -/* Begin PBXFileReference section */ - 0AFD486418F0BBC0004D0FE1 /* DateTools.bundle */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.plug-in"; name = DateTools.bundle; path = ../../../DateTools/DateTools.bundle; sourceTree = ""; }; - 901CF0D31B6CA9FE00F6414B /* DateTools.bundle */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.plug-in"; path = DateTools.bundle; sourceTree = ""; }; - 901CF0D41B6CA9FE00F6414B /* DateTools.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DateTools.h; sourceTree = ""; }; - 901CF0D51B6CA9FE00F6414B /* DTConstants.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DTConstants.h; sourceTree = ""; }; - 901CF0D61B6CA9FE00F6414B /* DTConstants.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DTConstants.m; sourceTree = ""; }; - 901CF0D71B6CA9FE00F6414B /* DTError.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DTError.h; sourceTree = ""; }; - 901CF0D81B6CA9FE00F6414B /* DTError.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DTError.m; sourceTree = ""; }; - 901CF0D91B6CA9FE00F6414B /* DTTimePeriod.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DTTimePeriod.h; sourceTree = ""; }; - 901CF0DA1B6CA9FE00F6414B /* DTTimePeriod.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DTTimePeriod.m; sourceTree = ""; }; - 901CF0DB1B6CA9FE00F6414B /* DTTimePeriodChain.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DTTimePeriodChain.h; sourceTree = ""; }; - 901CF0DC1B6CA9FE00F6414B /* DTTimePeriodChain.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DTTimePeriodChain.m; sourceTree = ""; }; - 901CF0DD1B6CA9FE00F6414B /* DTTimePeriodCollection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DTTimePeriodCollection.h; sourceTree = ""; }; - 901CF0DE1B6CA9FE00F6414B /* DTTimePeriodCollection.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DTTimePeriodCollection.m; sourceTree = ""; }; - 901CF0DF1B6CA9FE00F6414B /* DTTimePeriodGroup.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DTTimePeriodGroup.h; sourceTree = ""; }; - 901CF0E01B6CA9FE00F6414B /* DTTimePeriodGroup.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DTTimePeriodGroup.m; sourceTree = ""; }; - 901CF0E11B6CA9FE00F6414B /* NSDate+DateTools.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSDate+DateTools.h"; sourceTree = ""; }; - 901CF0E21B6CA9FE00F6414B /* NSDate+DateTools.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSDate+DateTools.m"; sourceTree = ""; }; - 908837C91B637C240063096B /* DateTools.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = DateTools.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - 908837CC1B637C240063096B /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - D935DB431B567FBD00BAA4F0 /* DTConstants.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = DTConstants.m; path = ../../../DateTools/DTConstants.m; sourceTree = ""; }; - E2A14E5B1D94155D00645D6B /* DateTools.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = DateTools.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - E2A14E5E1D94155E00645D6B /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - F007631D18DE5F5E00A99075 /* DateToolsViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DateToolsViewController.h; sourceTree = ""; }; - F007631E18DE5F5E00A99075 /* DateToolsViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DateToolsViewController.m; sourceTree = ""; }; - F007631F18DE5F5E00A99075 /* DateToolsViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = DateToolsViewController.xib; sourceTree = ""; }; - F007632318DE5FE300A99075 /* Colours.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Colours.h; sourceTree = ""; }; - F007632418DE5FE300A99075 /* Colours.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Colours.m; sourceTree = ""; }; - F007632818DE61EE00A99075 /* Calendar_filled.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = Calendar_filled.png; sourceTree = ""; }; - F007632918DE61EE00A99075 /* Calendar_filled@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Calendar_filled@2x.png"; sourceTree = ""; }; - F007632A18DE61EE00A99075 /* Calendar.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = Calendar.png; sourceTree = ""; }; - F007632B18DE61EE00A99075 /* Calendar@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Calendar@2x.png"; sourceTree = ""; }; - F007633218DE628900A99075 /* ExampleNavigationController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ExampleNavigationController.h; sourceTree = ""; }; - F007633318DE628900A99075 /* ExampleNavigationController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ExampleNavigationController.m; sourceTree = ""; }; - F007633618DE63C400A99075 /* TimePeriodsViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TimePeriodsViewController.h; sourceTree = ""; }; - F007633718DE63C400A99075 /* TimePeriodsViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TimePeriodsViewController.m; sourceTree = ""; }; - F007633818DE63C400A99075 /* TimePeriodsViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = TimePeriodsViewController.xib; sourceTree = ""; }; - F007633B18DE647600A99075 /* Recents_filled.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = Recents_filled.png; sourceTree = ""; }; - F007633C18DE647600A99075 /* Recents_filled@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Recents_filled@2x.png"; sourceTree = ""; }; - F007633D18DE647600A99075 /* Recents.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = Recents.png; sourceTree = ""; }; - F007633E18DE647600A99075 /* Recents@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Recents@2x.png"; sourceTree = ""; }; - F07A1A0618DCC76500B3E9FF /* DTTimePeriodCollection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DTTimePeriodCollection.h; path = ../../../DateTools/DTTimePeriodCollection.h; sourceTree = ""; }; - F07A1A0718DCC76500B3E9FF /* DTTimePeriodCollection.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = DTTimePeriodCollection.m; path = ../../../DateTools/DTTimePeriodCollection.m; sourceTree = ""; }; - F0A426D418D9FDB500E236C0 /* DTTimePeriod.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DTTimePeriod.h; path = ../../../DateTools/DTTimePeriod.h; sourceTree = ""; }; - F0A426D518D9FDB500E236C0 /* DTTimePeriod.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = DTTimePeriod.m; path = ../../../DateTools/DTTimePeriod.m; sourceTree = ""; }; - F0A426D918DA358C00E236C0 /* DTConstants.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DTConstants.h; path = ../../../DateTools/DTConstants.h; sourceTree = ""; }; - F0EE17E018DEAE190010FAD8 /* DateTools.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = DateTools.h; path = ../../../DateTools/DateTools.h; sourceTree = ""; }; - F0EE17E118DEB1A10010FAD8 /* DTError.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DTError.h; path = ../../../DateTools/DTError.h; sourceTree = ""; }; - F0EE17E218DEB1A10010FAD8 /* DTError.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = DTError.m; path = ../../../DateTools/DTError.m; sourceTree = ""; }; - F0EE17E318DEB1A10010FAD8 /* DTTimePeriodChain.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DTTimePeriodChain.h; path = ../../../DateTools/DTTimePeriodChain.h; sourceTree = ""; }; - F0EE17E418DEB1A10010FAD8 /* DTTimePeriodChain.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = DTTimePeriodChain.m; path = ../../../DateTools/DTTimePeriodChain.m; sourceTree = ""; }; - F0EE17E518DEB1A10010FAD8 /* DTTimePeriodGroup.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DTTimePeriodGroup.h; path = ../../../DateTools/DTTimePeriodGroup.h; sourceTree = ""; }; - F0EE17E618DEB1A10010FAD8 /* DTTimePeriodGroup.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = DTTimePeriodGroup.m; path = ../../../DateTools/DTTimePeriodGroup.m; sourceTree = ""; }; - F0F08D9B18D9E80E00214C6B /* DateToolsExample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = DateToolsExample.app; sourceTree = BUILT_PRODUCTS_DIR; }; - F0F08D9E18D9E80E00214C6B /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; - F0F08DA018D9E80E00214C6B /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; - F0F08DA218D9E80E00214C6B /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; }; - F0F08DA618D9E80E00214C6B /* DateToolsExample-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "DateToolsExample-Info.plist"; sourceTree = ""; }; - F0F08DA818D9E80E00214C6B /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; - F0F08DAA18D9E80E00214C6B /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; - F0F08DAC18D9E80E00214C6B /* DateToolsExample-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "DateToolsExample-Prefix.pch"; sourceTree = ""; }; - F0F08DAD18D9E80E00214C6B /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; - F0F08DAE18D9E80E00214C6B /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; - F0F08DB618D9E80E00214C6B /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; - F0F08DBC18D9E80E00214C6B /* DateToolsExampleTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = DateToolsExampleTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; - F0F08DBD18D9E80E00214C6B /* XCTest.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = XCTest.framework; path = Library/Frameworks/XCTest.framework; sourceTree = DEVELOPER_DIR; }; - F0F08DC518D9E80E00214C6B /* DateToolsExampleTests-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "DateToolsExampleTests-Info.plist"; sourceTree = ""; }; - F0F08DC718D9E80E00214C6B /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; - F0F08DD718D9E94F00214C6B /* NSDate+DateTools.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "NSDate+DateTools.h"; path = "../../../DateTools/NSDate+DateTools.h"; sourceTree = ""; }; - F0F08DD818D9E94F00214C6B /* NSDate+DateTools.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = "NSDate+DateTools.m"; path = "../../../DateTools/NSDate+DateTools.m"; sourceTree = ""; }; -/* End PBXFileReference section */ - -/* Begin PBXFrameworksBuildPhase section */ - 908837C51B637C240063096B /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; - E2A14E571D94155D00645D6B /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; - F0F08D9818D9E80E00214C6B /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - F0F08DA118D9E80E00214C6B /* CoreGraphics.framework in Frameworks */, - F0F08DA318D9E80E00214C6B /* UIKit.framework in Frameworks */, - F0F08D9F18D9E80E00214C6B /* Foundation.framework in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - F0F08DB918D9E80E00214C6B /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - F0F08DBE18D9E80E00214C6B /* XCTest.framework in Frameworks */, - F0F08DC018D9E80E00214C6B /* UIKit.framework in Frameworks */, - F0F08DBF18D9E80E00214C6B /* Foundation.framework in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXFrameworksBuildPhase section */ - -/* Begin PBXGroup section */ - 901CF0D21B6CA9FE00F6414B /* DateTools */ = { - isa = PBXGroup; - children = ( - 901CF0D31B6CA9FE00F6414B /* DateTools.bundle */, - 901CF0D41B6CA9FE00F6414B /* DateTools.h */, - 901CF0D51B6CA9FE00F6414B /* DTConstants.h */, - 901CF0D61B6CA9FE00F6414B /* DTConstants.m */, - 901CF0D71B6CA9FE00F6414B /* DTError.h */, - 901CF0D81B6CA9FE00F6414B /* DTError.m */, - 901CF0D91B6CA9FE00F6414B /* DTTimePeriod.h */, - 901CF0DA1B6CA9FE00F6414B /* DTTimePeriod.m */, - 901CF0DB1B6CA9FE00F6414B /* DTTimePeriodChain.h */, - 901CF0DC1B6CA9FE00F6414B /* DTTimePeriodChain.m */, - 901CF0DD1B6CA9FE00F6414B /* DTTimePeriodCollection.h */, - 901CF0DE1B6CA9FE00F6414B /* DTTimePeriodCollection.m */, - 901CF0DF1B6CA9FE00F6414B /* DTTimePeriodGroup.h */, - 901CF0E01B6CA9FE00F6414B /* DTTimePeriodGroup.m */, - 901CF0E11B6CA9FE00F6414B /* NSDate+DateTools.h */, - 901CF0E21B6CA9FE00F6414B /* NSDate+DateTools.m */, - ); - name = DateTools; - path = ../../DateTools; - sourceTree = ""; - }; - 908837CA1B637C240063096B /* DateTools iOS */ = { - isa = PBXGroup; - children = ( - 908837CC1B637C240063096B /* Info.plist */, - ); - name = "DateTools iOS"; - path = DateTools; - sourceTree = ""; - }; - E2A14E5C1D94155E00645D6B /* DateTools macOS */ = { - isa = PBXGroup; - children = ( - E2A14E5E1D94155E00645D6B /* Info.plist */, - ); - path = "DateTools macOS"; - sourceTree = ""; - }; - F007632218DE5F9E00A99075 /* Colours */ = { - isa = PBXGroup; - children = ( - F007632318DE5FE300A99075 /* Colours.h */, - F007632418DE5FE300A99075 /* Colours.m */, - ); - name = Colours; - sourceTree = ""; - }; - F007632618DE612D00A99075 /* Images */ = { - isa = PBXGroup; - children = ( - F007632718DE613400A99075 /* Tab bar */, - ); - name = Images; - sourceTree = ""; - }; - F007632718DE613400A99075 /* Tab bar */ = { - isa = PBXGroup; - children = ( - F007632818DE61EE00A99075 /* Calendar_filled.png */, - F007632918DE61EE00A99075 /* Calendar_filled@2x.png */, - F007632A18DE61EE00A99075 /* Calendar.png */, - F007632B18DE61EE00A99075 /* Calendar@2x.png */, - F007633B18DE647600A99075 /* Recents_filled.png */, - F007633C18DE647600A99075 /* Recents_filled@2x.png */, - F007633D18DE647600A99075 /* Recents.png */, - F007633E18DE647600A99075 /* Recents@2x.png */, - ); - name = "Tab bar"; - sourceTree = ""; - }; - F007633018DE626600A99075 /* Controllers */ = { - isa = PBXGroup; - children = ( - F007633218DE628900A99075 /* ExampleNavigationController.h */, - F007633318DE628900A99075 /* ExampleNavigationController.m */, - F007633118DE626D00A99075 /* Date Tools */, - F007633518DE63AB00A99075 /* Time Periods */, - ); - name = Controllers; - sourceTree = ""; - }; - F007633118DE626D00A99075 /* Date Tools */ = { - isa = PBXGroup; - children = ( - F007631D18DE5F5E00A99075 /* DateToolsViewController.h */, - F007631E18DE5F5E00A99075 /* DateToolsViewController.m */, - F007631F18DE5F5E00A99075 /* DateToolsViewController.xib */, - ); - name = "Date Tools"; - sourceTree = ""; - }; - F007633518DE63AB00A99075 /* Time Periods */ = { - isa = PBXGroup; - children = ( - F007633618DE63C400A99075 /* TimePeriodsViewController.h */, - F007633718DE63C400A99075 /* TimePeriodsViewController.m */, - F007633818DE63C400A99075 /* TimePeriodsViewController.xib */, - ); - name = "Time Periods"; - sourceTree = ""; - }; - F0F08D9218D9E80E00214C6B = { - isa = PBXGroup; - children = ( - 901CF0D21B6CA9FE00F6414B /* DateTools */, - F0F08DA418D9E80E00214C6B /* DateToolsExample */, - F0F08DC318D9E80E00214C6B /* DateToolsExampleTests */, - 908837CA1B637C240063096B /* DateTools iOS */, - E2A14E5C1D94155E00645D6B /* DateTools macOS */, - F0F08D9D18D9E80E00214C6B /* Frameworks */, - F0F08D9C18D9E80E00214C6B /* Products */, - ); - sourceTree = ""; - }; - F0F08D9C18D9E80E00214C6B /* Products */ = { - isa = PBXGroup; - children = ( - F0F08D9B18D9E80E00214C6B /* DateToolsExample.app */, - F0F08DBC18D9E80E00214C6B /* DateToolsExampleTests.xctest */, - 908837C91B637C240063096B /* DateTools.framework */, - E2A14E5B1D94155D00645D6B /* DateTools.framework */, - ); - name = Products; - sourceTree = ""; - }; - F0F08D9D18D9E80E00214C6B /* Frameworks */ = { - isa = PBXGroup; - children = ( - F0F08D9E18D9E80E00214C6B /* Foundation.framework */, - F0F08DA018D9E80E00214C6B /* CoreGraphics.framework */, - F0F08DA218D9E80E00214C6B /* UIKit.framework */, - F0F08DBD18D9E80E00214C6B /* XCTest.framework */, - ); - name = Frameworks; - sourceTree = ""; - }; - F0F08DA418D9E80E00214C6B /* DateToolsExample */ = { - isa = PBXGroup; - children = ( - F0F08DAD18D9E80E00214C6B /* AppDelegate.h */, - F0F08DAE18D9E80E00214C6B /* AppDelegate.m */, - F0F08DD318D9E81C00214C6B /* DateTools */, - F007633018DE626600A99075 /* Controllers */, - F0F08DB618D9E80E00214C6B /* Images.xcassets */, - F0F08DA518D9E80E00214C6B /* Supporting Files */, - ); - path = DateToolsExample; - sourceTree = ""; - }; - F0F08DA518D9E80E00214C6B /* Supporting Files */ = { - isa = PBXGroup; - children = ( - F007632618DE612D00A99075 /* Images */, - F007632218DE5F9E00A99075 /* Colours */, - F0F08DA618D9E80E00214C6B /* DateToolsExample-Info.plist */, - F0F08DA718D9E80E00214C6B /* InfoPlist.strings */, - F0F08DAA18D9E80E00214C6B /* main.m */, - F0F08DAC18D9E80E00214C6B /* DateToolsExample-Prefix.pch */, - ); - name = "Supporting Files"; - sourceTree = ""; - }; - F0F08DC318D9E80E00214C6B /* DateToolsExampleTests */ = { - isa = PBXGroup; - children = ( - F0F08DC418D9E80E00214C6B /* Supporting Files */, - ); - path = DateToolsExampleTests; - sourceTree = ""; - }; - F0F08DC418D9E80E00214C6B /* Supporting Files */ = { - isa = PBXGroup; - children = ( - F0F08DC518D9E80E00214C6B /* DateToolsExampleTests-Info.plist */, - F0F08DC618D9E80E00214C6B /* InfoPlist.strings */, - ); - name = "Supporting Files"; - sourceTree = ""; - }; - F0F08DD318D9E81C00214C6B /* DateTools */ = { - isa = PBXGroup; - children = ( - 0AFD486418F0BBC0004D0FE1 /* DateTools.bundle */, - F0EE17E118DEB1A10010FAD8 /* DTError.h */, - F0EE17E218DEB1A10010FAD8 /* DTError.m */, - F0EE17E018DEAE190010FAD8 /* DateTools.h */, - F0A426D918DA358C00E236C0 /* DTConstants.h */, - D935DB431B567FBD00BAA4F0 /* DTConstants.m */, - F0F08DD718D9E94F00214C6B /* NSDate+DateTools.h */, - F0F08DD818D9E94F00214C6B /* NSDate+DateTools.m */, - F0A426D418D9FDB500E236C0 /* DTTimePeriod.h */, - F0A426D518D9FDB500E236C0 /* DTTimePeriod.m */, - F0EE17E518DEB1A10010FAD8 /* DTTimePeriodGroup.h */, - F0EE17E618DEB1A10010FAD8 /* DTTimePeriodGroup.m */, - F07A1A0618DCC76500B3E9FF /* DTTimePeriodCollection.h */, - F07A1A0718DCC76500B3E9FF /* DTTimePeriodCollection.m */, - F0EE17E318DEB1A10010FAD8 /* DTTimePeriodChain.h */, - F0EE17E418DEB1A10010FAD8 /* DTTimePeriodChain.m */, - ); - name = DateTools; - sourceTree = ""; - }; -/* End PBXGroup section */ - -/* Begin PBXHeadersBuildPhase section */ - 908837C61B637C240063096B /* Headers */ = { - isa = PBXHeadersBuildPhase; - buildActionMask = 2147483647; - files = ( - 901CF0EF1B6CA9FE00F6414B /* DTTimePeriodGroup.h in Headers */, - 901CF0E91B6CA9FE00F6414B /* DTTimePeriod.h in Headers */, - 901CF0E41B6CA9FE00F6414B /* DateTools.h in Headers */, - 901CF0E71B6CA9FE00F6414B /* DTError.h in Headers */, - 901CF0EB1B6CA9FE00F6414B /* DTTimePeriodChain.h in Headers */, - 901CF0F11B6CA9FE00F6414B /* NSDate+DateTools.h in Headers */, - 901CF0E51B6CA9FE00F6414B /* DTConstants.h in Headers */, - 901CF0ED1B6CA9FE00F6414B /* DTTimePeriodCollection.h in Headers */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - E2A14E581D94155D00645D6B /* Headers */ = { - isa = PBXHeadersBuildPhase; - buildActionMask = 2147483647; - files = ( - E2A14E701D9415D700645D6B /* DTTimePeriodCollection.h in Headers */, - E2A14E721D9415D700645D6B /* NSDate+DateTools.h in Headers */, - E2A14E6D1D9415D700645D6B /* DTError.h in Headers */, - E2A14E6C1D9415D700645D6B /* DTConstants.h in Headers */, - E2A14E6E1D9415D700645D6B /* DTTimePeriod.h in Headers */, - E2A14E6F1D9415D700645D6B /* DTTimePeriodChain.h in Headers */, - E2A14E6B1D9415C300645D6B /* DateTools.h in Headers */, - E2A14E711D9415D700645D6B /* DTTimePeriodGroup.h in Headers */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXHeadersBuildPhase section */ - -/* Begin PBXNativeTarget section */ - 908837C81B637C240063096B /* DateTools iOS */ = { - isa = PBXNativeTarget; - buildConfigurationList = 908837E01B637C240063096B /* Build configuration list for PBXNativeTarget "DateTools iOS" */; - buildPhases = ( - 908837C41B637C240063096B /* Sources */, - 908837C51B637C240063096B /* Frameworks */, - 908837C61B637C240063096B /* Headers */, - 908837C71B637C240063096B /* Resources */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = "DateTools iOS"; - productName = DateTools; - productReference = 908837C91B637C240063096B /* DateTools.framework */; - productType = "com.apple.product-type.framework"; - }; - E2A14E5A1D94155D00645D6B /* DateTools macOS */ = { - isa = PBXNativeTarget; - buildConfigurationList = E2A14E621D94155E00645D6B /* Build configuration list for PBXNativeTarget "DateTools macOS" */; - buildPhases = ( - E2A14E561D94155D00645D6B /* Sources */, - E2A14E571D94155D00645D6B /* Frameworks */, - E2A14E581D94155D00645D6B /* Headers */, - E2A14E591D94155D00645D6B /* Resources */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = "DateTools macOS"; - productName = "DateTools macOS"; - productReference = E2A14E5B1D94155D00645D6B /* DateTools.framework */; - productType = "com.apple.product-type.framework"; - }; - F0F08D9A18D9E80E00214C6B /* DateToolsExample */ = { - isa = PBXNativeTarget; - buildConfigurationList = F0F08DCD18D9E80E00214C6B /* Build configuration list for PBXNativeTarget "DateToolsExample" */; - buildPhases = ( - F0F08D9718D9E80E00214C6B /* Sources */, - F0F08D9818D9E80E00214C6B /* Frameworks */, - F0F08D9918D9E80E00214C6B /* Resources */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = DateToolsExample; - productName = DateToolsExample; - productReference = F0F08D9B18D9E80E00214C6B /* DateToolsExample.app */; - productType = "com.apple.product-type.application"; - }; - F0F08DBB18D9E80E00214C6B /* DateToolsExampleTests */ = { - isa = PBXNativeTarget; - buildConfigurationList = F0F08DD018D9E80E00214C6B /* Build configuration list for PBXNativeTarget "DateToolsExampleTests" */; - buildPhases = ( - F0F08DB818D9E80E00214C6B /* Sources */, - F0F08DB918D9E80E00214C6B /* Frameworks */, - F0F08DBA18D9E80E00214C6B /* Resources */, - ); - buildRules = ( - ); - dependencies = ( - F0F08DC218D9E80E00214C6B /* PBXTargetDependency */, - ); - name = DateToolsExampleTests; - productName = DateToolsExampleTests; - productReference = F0F08DBC18D9E80E00214C6B /* DateToolsExampleTests.xctest */; - productType = "com.apple.product-type.bundle.unit-test"; - }; -/* End PBXNativeTarget section */ - -/* Begin PBXProject section */ - F0F08D9318D9E80E00214C6B /* Project object */ = { - isa = PBXProject; - attributes = { - LastUpgradeCheck = 0800; - TargetAttributes = { - 908837C81B637C240063096B = { - CreatedOnToolsVersion = 6.4; - }; - E2A14E5A1D94155D00645D6B = { - CreatedOnToolsVersion = 8.0; - ProvisioningStyle = Automatic; - }; - F0F08DBB18D9E80E00214C6B = { - TestTargetID = F0F08D9A18D9E80E00214C6B; - }; - }; - }; - buildConfigurationList = F0F08D9618D9E80E00214C6B /* Build configuration list for PBXProject "DateToolsExample" */; - compatibilityVersion = "Xcode 3.2"; - developmentRegion = English; - hasScannedForEncodings = 0; - knownRegions = ( - en, - Base, - ); - mainGroup = F0F08D9218D9E80E00214C6B; - productRefGroup = F0F08D9C18D9E80E00214C6B /* Products */; - projectDirPath = ""; - projectRoot = ""; - targets = ( - F0F08D9A18D9E80E00214C6B /* DateToolsExample */, - F0F08DBB18D9E80E00214C6B /* DateToolsExampleTests */, - 908837C81B637C240063096B /* DateTools iOS */, - E2A14E5A1D94155D00645D6B /* DateTools macOS */, - ); - }; -/* End PBXProject section */ - -/* Begin PBXResourcesBuildPhase section */ - 908837C71B637C240063096B /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 901CF0E31B6CA9FE00F6414B /* DateTools.bundle in Resources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - E2A14E591D94155D00645D6B /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - E2A14E6A1D9415C000645D6B /* DateTools.bundle in Resources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - F0F08D9918D9E80E00214C6B /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - F007633F18DE647600A99075 /* Recents_filled.png in Resources */, - F007632118DE5F5E00A99075 /* DateToolsViewController.xib in Resources */, - F0F08DB718D9E80E00214C6B /* Images.xcassets in Resources */, - F007633A18DE63C400A99075 /* TimePeriodsViewController.xib in Resources */, - F0F08DA918D9E80E00214C6B /* InfoPlist.strings in Resources */, - F007634118DE647600A99075 /* Recents.png in Resources */, - 0AFD486518F0BBC0004D0FE1 /* DateTools.bundle in Resources */, - F007632E18DE61EE00A99075 /* Calendar.png in Resources */, - F007632F18DE61EE00A99075 /* Calendar@2x.png in Resources */, - F007634018DE647600A99075 /* Recents_filled@2x.png in Resources */, - F007632C18DE61EE00A99075 /* Calendar_filled.png in Resources */, - F007632D18DE61EE00A99075 /* Calendar_filled@2x.png in Resources */, - F007634218DE647600A99075 /* Recents@2x.png in Resources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - F0F08DBA18D9E80E00214C6B /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - F0F08DC818D9E80E00214C6B /* InfoPlist.strings in Resources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXResourcesBuildPhase section */ - -/* Begin PBXSourcesBuildPhase section */ - 908837C41B637C240063096B /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 901CF0EA1B6CA9FE00F6414B /* DTTimePeriod.m in Sources */, - 901CF0F01B6CA9FE00F6414B /* DTTimePeriodGroup.m in Sources */, - 901CF0E81B6CA9FE00F6414B /* DTError.m in Sources */, - 901CF0EE1B6CA9FE00F6414B /* DTTimePeriodCollection.m in Sources */, - 901CF0E61B6CA9FE00F6414B /* DTConstants.m in Sources */, - 901CF0F21B6CA9FE00F6414B /* NSDate+DateTools.m in Sources */, - 901CF0EC1B6CA9FE00F6414B /* DTTimePeriodChain.m in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - E2A14E561D94155D00645D6B /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - E2A14E651D9415BC00645D6B /* DTTimePeriod.m in Sources */, - E2A14E681D9415BC00645D6B /* DTTimePeriodGroup.m in Sources */, - E2A14E641D9415BC00645D6B /* DTError.m in Sources */, - E2A14E671D9415BC00645D6B /* DTTimePeriodCollection.m in Sources */, - E2A14E631D9415BC00645D6B /* DTConstants.m in Sources */, - E2A14E691D9415BC00645D6B /* NSDate+DateTools.m in Sources */, - E2A14E661D9415BC00645D6B /* DTTimePeriodChain.m in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - F0F08D9718D9E80E00214C6B /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - D935DB441B567FBD00BAA4F0 /* DTConstants.m in Sources */, - F0EE17E718DEB1A10010FAD8 /* DTError.m in Sources */, - F0EE17EB18DEB1A10010FAD8 /* DTTimePeriodGroup.m in Sources */, - F0A426D618D9FDB500E236C0 /* DTTimePeriod.m in Sources */, - F007633418DE628900A99075 /* ExampleNavigationController.m in Sources */, - F0EE17E918DEB1A10010FAD8 /* DTTimePeriodChain.m in Sources */, - F07A1A0818DCC76500B3E9FF /* DTTimePeriodCollection.m in Sources */, - F0F08DAF18D9E80E00214C6B /* AppDelegate.m in Sources */, - F007632518DE5FE300A99075 /* Colours.m in Sources */, - F007632018DE5F5E00A99075 /* DateToolsViewController.m in Sources */, - F0F08DD918D9E94F00214C6B /* NSDate+DateTools.m in Sources */, - F007633918DE63C400A99075 /* TimePeriodsViewController.m in Sources */, - F0F08DAB18D9E80E00214C6B /* main.m in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - F0F08DB818D9E80E00214C6B /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - F0EE17E818DEB1A10010FAD8 /* DTError.m in Sources */, - F0EE17EC18DEB1A10010FAD8 /* DTTimePeriodGroup.m in Sources */, - F0EE17EA18DEB1A10010FAD8 /* DTTimePeriodChain.m in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXSourcesBuildPhase section */ - -/* Begin PBXTargetDependency section */ - F0F08DC218D9E80E00214C6B /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = F0F08D9A18D9E80E00214C6B /* DateToolsExample */; - targetProxy = F0F08DC118D9E80E00214C6B /* PBXContainerItemProxy */; - }; -/* End PBXTargetDependency section */ - -/* Begin PBXVariantGroup section */ - F0F08DA718D9E80E00214C6B /* InfoPlist.strings */ = { - isa = PBXVariantGroup; - children = ( - F0F08DA818D9E80E00214C6B /* en */, - ); - name = InfoPlist.strings; - sourceTree = ""; - }; - F0F08DC618D9E80E00214C6B /* InfoPlist.strings */ = { - isa = PBXVariantGroup; - children = ( - F0F08DC718D9E80E00214C6B /* en */, - ); - name = InfoPlist.strings; - sourceTree = ""; - }; -/* End PBXVariantGroup section */ - -/* Begin XCBuildConfiguration section */ - 908837DC1B637C240063096B /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - APPLICATION_EXTENSION_API_ONLY = YES; - CLANG_WARN_UNREACHABLE_CODE = YES; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; - CURRENT_PROJECT_VERSION = 1; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - DEFINES_MODULE = YES; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - DYLIB_INSTALL_NAME_BASE = "@rpath"; - ENABLE_STRICT_OBJC_MSGSEND = YES; - GCC_NO_COMMON_BLOCKS = YES; - GCC_PREPROCESSOR_DEFINITIONS = ( - "DEBUG=1", - "$(inherited)", - ); - INFOPLIST_FILE = DateTools/Info.plist; - INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 8.4; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - MTL_ENABLE_DEBUG_INFO = YES; - PRODUCT_BUNDLE_IDENTIFIER = "com.molabo.$(PRODUCT_NAME:rfc1034identifier)"; - PRODUCT_NAME = DateTools; - SKIP_INSTALL = YES; - SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - TARGETED_DEVICE_FAMILY = "1,2"; - VERSIONING_SYSTEM = "apple-generic"; - VERSION_INFO_PREFIX = ""; - }; - name = Debug; - }; - 908837DD1B637C240063096B /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - APPLICATION_EXTENSION_API_ONLY = YES; - CLANG_WARN_UNREACHABLE_CODE = YES; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; - COPY_PHASE_STRIP = NO; - CURRENT_PROJECT_VERSION = 1; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - DEFINES_MODULE = YES; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - DYLIB_INSTALL_NAME_BASE = "@rpath"; - ENABLE_STRICT_OBJC_MSGSEND = YES; - GCC_NO_COMMON_BLOCKS = YES; - INFOPLIST_FILE = DateTools/Info.plist; - INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 8.4; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - MTL_ENABLE_DEBUG_INFO = NO; - PRODUCT_BUNDLE_IDENTIFIER = "com.molabo.$(PRODUCT_NAME:rfc1034identifier)"; - PRODUCT_NAME = DateTools; - SKIP_INSTALL = YES; - TARGETED_DEVICE_FAMILY = "1,2"; - VERSIONING_SYSTEM = "apple-generic"; - VERSION_INFO_PREFIX = ""; - }; - name = Release; - }; - E2A14E601D94155E00645D6B /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - APPLICATION_EXTENSION_API_ONLY = YES; - CLANG_ANALYZER_NONNULL = YES; - CLANG_WARN_DOCUMENTATION_COMMENTS = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_SUSPICIOUS_MOVES = YES; - CLANG_WARN_UNREACHABLE_CODE = YES; - CODE_SIGN_IDENTITY = ""; - COMBINE_HIDPI_IMAGES = YES; - CURRENT_PROJECT_VERSION = 1; - DEBUG_INFORMATION_FORMAT = dwarf; - DEFINES_MODULE = YES; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - DYLIB_INSTALL_NAME_BASE = "@rpath"; - ENABLE_STRICT_OBJC_MSGSEND = YES; - ENABLE_TESTABILITY = YES; - FRAMEWORK_VERSION = A; - GCC_NO_COMMON_BLOCKS = YES; - INFOPLIST_FILE = "DateTools macOS/Info.plist"; - INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks"; - MACOSX_DEPLOYMENT_TARGET = 10.10; - MTL_ENABLE_DEBUG_INFO = YES; - PRODUCT_BUNDLE_IDENTIFIER = "com.molabo.DateTools.DateTools-macOS"; - PRODUCT_NAME = DateTools; - SDKROOT = macosx; - SKIP_INSTALL = YES; - VERSIONING_SYSTEM = "apple-generic"; - VERSION_INFO_PREFIX = ""; - }; - name = Debug; - }; - E2A14E611D94155E00645D6B /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - APPLICATION_EXTENSION_API_ONLY = YES; - CLANG_ANALYZER_NONNULL = YES; - CLANG_WARN_DOCUMENTATION_COMMENTS = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_SUSPICIOUS_MOVES = YES; - CLANG_WARN_UNREACHABLE_CODE = YES; - CODE_SIGN_IDENTITY = ""; - COMBINE_HIDPI_IMAGES = YES; - COPY_PHASE_STRIP = NO; - CURRENT_PROJECT_VERSION = 1; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - DEFINES_MODULE = YES; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - DYLIB_INSTALL_NAME_BASE = "@rpath"; - ENABLE_STRICT_OBJC_MSGSEND = YES; - FRAMEWORK_VERSION = A; - GCC_NO_COMMON_BLOCKS = YES; - INFOPLIST_FILE = "DateTools macOS/Info.plist"; - INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks"; - MACOSX_DEPLOYMENT_TARGET = 10.10; - MTL_ENABLE_DEBUG_INFO = NO; - PRODUCT_BUNDLE_IDENTIFIER = "com.molabo.DateTools.DateTools-macOS"; - PRODUCT_NAME = DateTools; - SDKROOT = macosx; - SKIP_INSTALL = YES; - VERSIONING_SYSTEM = "apple-generic"; - VERSION_INFO_PREFIX = ""; - }; - name = Release; - }; - F0F08DCB18D9E80E00214C6B /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_SUSPICIOUS_MOVE = YES; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; - COPY_PHASE_STRIP = NO; - ENABLE_STRICT_OBJC_MSGSEND = YES; - ENABLE_TESTABILITY = YES; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_DYNAMIC_NO_PIC = NO; - GCC_NO_COMMON_BLOCKS = YES; - GCC_OPTIMIZATION_LEVEL = 0; - GCC_PREPROCESSOR_DEFINITIONS = ( - "DEBUG=1", - "$(inherited)", - ); - GCC_SYMBOLS_PRIVATE_EXTERN = NO; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; - MACOSX_DEPLOYMENT_TARGET = 10.10; - ONLY_ACTIVE_ARCH = YES; - SDKROOT = iphoneos; - }; - name = Debug; - }; - F0F08DCC18D9E80E00214C6B /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_SUSPICIOUS_MOVE = YES; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; - COPY_PHASE_STRIP = YES; - ENABLE_NS_ASSERTIONS = NO; - ENABLE_STRICT_OBJC_MSGSEND = YES; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_NO_COMMON_BLOCKS = YES; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; - MACOSX_DEPLOYMENT_TARGET = 10.10; - SDKROOT = iphoneos; - VALIDATE_PRODUCT = YES; - }; - name = Release; - }; - F0F08DCE18D9E80E00214C6B /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; - GCC_PRECOMPILE_PREFIX_HEADER = YES; - GCC_PREFIX_HEADER = "DateToolsExample/DateToolsExample-Prefix.pch"; - INFOPLIST_FILE = "DateToolsExample/DateToolsExample-Info.plist"; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; - PRODUCT_BUNDLE_IDENTIFIER = "com.mattyork.${PRODUCT_NAME:rfc1034identifier}"; - PRODUCT_NAME = "$(TARGET_NAME)"; - WRAPPER_EXTENSION = app; - }; - name = Debug; - }; - F0F08DCF18D9E80E00214C6B /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; - GCC_PRECOMPILE_PREFIX_HEADER = YES; - GCC_PREFIX_HEADER = "DateToolsExample/DateToolsExample-Prefix.pch"; - INFOPLIST_FILE = "DateToolsExample/DateToolsExample-Info.plist"; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; - PRODUCT_BUNDLE_IDENTIFIER = "com.mattyork.${PRODUCT_NAME:rfc1034identifier}"; - PRODUCT_NAME = "$(TARGET_NAME)"; - WRAPPER_EXTENSION = app; - }; - name = Release; - }; - F0F08DD118D9E80E00214C6B /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - BUNDLE_LOADER = "$(BUILT_PRODUCTS_DIR)/DateToolsExample.app/DateToolsExample"; - FRAMEWORK_SEARCH_PATHS = ( - "$(SDKROOT)/Developer/Library/Frameworks", - "$(inherited)", - "$(DEVELOPER_FRAMEWORKS_DIR)", - ); - GCC_PRECOMPILE_PREFIX_HEADER = YES; - GCC_PREFIX_HEADER = "DateToolsExample/DateToolsExample-Prefix.pch"; - GCC_PREPROCESSOR_DEFINITIONS = ( - "DEBUG=1", - "$(inherited)", - ); - INFOPLIST_FILE = "DateToolsExampleTests/DateToolsExampleTests-Info.plist"; - PRODUCT_BUNDLE_IDENTIFIER = "com.mattyork.${PRODUCT_NAME:rfc1034identifier}"; - PRODUCT_NAME = "$(TARGET_NAME)"; - TEST_HOST = "$(BUNDLE_LOADER)"; - WRAPPER_EXTENSION = xctest; - }; - name = Debug; - }; - F0F08DD218D9E80E00214C6B /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - BUNDLE_LOADER = "$(BUILT_PRODUCTS_DIR)/DateToolsExample.app/DateToolsExample"; - FRAMEWORK_SEARCH_PATHS = ( - "$(SDKROOT)/Developer/Library/Frameworks", - "$(inherited)", - "$(DEVELOPER_FRAMEWORKS_DIR)", - ); - GCC_PRECOMPILE_PREFIX_HEADER = YES; - GCC_PREFIX_HEADER = "DateToolsExample/DateToolsExample-Prefix.pch"; - INFOPLIST_FILE = "DateToolsExampleTests/DateToolsExampleTests-Info.plist"; - PRODUCT_BUNDLE_IDENTIFIER = "com.mattyork.${PRODUCT_NAME:rfc1034identifier}"; - PRODUCT_NAME = "$(TARGET_NAME)"; - TEST_HOST = "$(BUNDLE_LOADER)"; - WRAPPER_EXTENSION = xctest; - }; - name = Release; - }; -/* End XCBuildConfiguration section */ - -/* Begin XCConfigurationList section */ - 908837E01B637C240063096B /* Build configuration list for PBXNativeTarget "DateTools iOS" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 908837DC1B637C240063096B /* Debug */, - 908837DD1B637C240063096B /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - E2A14E621D94155E00645D6B /* Build configuration list for PBXNativeTarget "DateTools macOS" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - E2A14E601D94155E00645D6B /* Debug */, - E2A14E611D94155E00645D6B /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - F0F08D9618D9E80E00214C6B /* Build configuration list for PBXProject "DateToolsExample" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - F0F08DCB18D9E80E00214C6B /* Debug */, - F0F08DCC18D9E80E00214C6B /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - F0F08DCD18D9E80E00214C6B /* Build configuration list for PBXNativeTarget "DateToolsExample" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - F0F08DCE18D9E80E00214C6B /* Debug */, - F0F08DCF18D9E80E00214C6B /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - F0F08DD018D9E80E00214C6B /* Build configuration list for PBXNativeTarget "DateToolsExampleTests" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - F0F08DD118D9E80E00214C6B /* Debug */, - F0F08DD218D9E80E00214C6B /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; -/* End XCConfigurationList section */ - }; - rootObject = F0F08D9318D9E80E00214C6B /* Project object */; -} diff --git a/DateTools/Examples/DateToolsExample/DateToolsExample.xcodeproj/xcshareddata/xcschemes/DateTools macOS.xcscheme b/DateTools/Examples/DateToolsExample/DateToolsExample.xcodeproj/xcshareddata/xcschemes/DateTools macOS.xcscheme deleted file mode 100644 index 8d311d1b..00000000 --- a/DateTools/Examples/DateToolsExample/DateToolsExample.xcodeproj/xcshareddata/xcschemes/DateTools macOS.xcscheme +++ /dev/null @@ -1,80 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/DateTools/Examples/DateToolsExample/DateToolsExample.xcodeproj/xcshareddata/xcschemes/DateTools.xcscheme b/DateTools/Examples/DateToolsExample/DateToolsExample.xcodeproj/xcshareddata/xcschemes/DateTools.xcscheme deleted file mode 100644 index 9846c2f7..00000000 --- a/DateTools/Examples/DateToolsExample/DateToolsExample.xcodeproj/xcshareddata/xcschemes/DateTools.xcscheme +++ /dev/null @@ -1,129 +0,0 @@ - - - - - - >>>>>> swift:DateTools/Examples/DateToolsExample/DateToolsExample.xcodeproj/xcshareddata/xcschemes/DateTools.xcscheme - BlueprintName = "DateTools iOS" - ReferencedContainer = "container:DateToolsExample.xcodeproj"> - - - - - - - - - - - - - - - - - >>>>>> swift:DateTools/Examples/DateToolsExample/DateToolsExample.xcodeproj/xcshareddata/xcschemes/DateTools.xcscheme - BlueprintName = "DateTools iOS" - ReferencedContainer = "container:DateToolsExample.xcodeproj"> - - - - - - - - >>>>>> swift:DateTools/Examples/DateToolsExample/DateToolsExample.xcodeproj/xcshareddata/xcschemes/DateTools.xcscheme - BlueprintName = "DateTools iOS" - ReferencedContainer = "container:DateToolsExample.xcodeproj"> - - - - - - - - >>>>>> swift:DateTools/Examples/DateToolsExample/DateToolsExample.xcodeproj/xcshareddata/xcschemes/DateTools.xcscheme - BlueprintName = "DateTools iOS" - ReferencedContainer = "container:DateToolsExample.xcodeproj"> - - - - - - - - diff --git a/DateTools/Examples/DateToolsExample/DateToolsExample/AppDelegate.h b/DateTools/Examples/DateToolsExample/DateToolsExample/AppDelegate.h deleted file mode 100644 index cb67e70f..00000000 --- a/DateTools/Examples/DateToolsExample/DateToolsExample/AppDelegate.h +++ /dev/null @@ -1,15 +0,0 @@ -// -// AppDelegate.h -// DateToolsExample -// -// Created by Matthew York on 3/19/14. -// -// - -#import - -@interface AppDelegate : UIResponder - -@property (strong, nonatomic) UIWindow *window; -@property (strong, nonatomic) UITabBarController *tabBarController; -@end diff --git a/DateTools/Examples/DateToolsExample/DateToolsExample/AppDelegate.m b/DateTools/Examples/DateToolsExample/DateToolsExample/AppDelegate.m deleted file mode 100644 index 9603c197..00000000 --- a/DateTools/Examples/DateToolsExample/DateToolsExample/AppDelegate.m +++ /dev/null @@ -1,78 +0,0 @@ -// -// AppDelegate.m -// DateToolsExample -// -// Created by Matthew York on 3/19/14. -// -// - -#import "AppDelegate.h" -#import "Colours.h" -#import "ExampleNavigationController.h" -#import "DateToolsViewController.h" -#import "TimePeriodsViewController.h" - -@implementation AppDelegate - -- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions -{ - self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds]; - - [self initializeTabBarController]; - - [self.window setRootViewController:self.tabBarController]; - [self.window makeKeyAndVisible]; - - // Override point for customization after application launch. - return YES; -} - -- (void)applicationWillResignActive:(UIApplication *)application -{ - // 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. - // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. -} - -- (void)applicationDidEnterBackground:(UIApplication *)application -{ - // 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. - // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. -} - -- (void)applicationWillEnterForeground:(UIApplication *)application -{ - // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. -} - -- (void)applicationDidBecomeActive:(UIApplication *)application -{ - // 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. -} - -- (void)applicationWillTerminate:(UIApplication *)application -{ - // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. -} - --(void)initializeTabBarController{ - ExampleNavigationController *dtVC = [[ExampleNavigationController alloc] initWithRootViewController:[[DateToolsViewController alloc] initWithNibName:@"DateToolsViewController" bundle:nil]]; - - ExampleNavigationController *tpVC = [[ExampleNavigationController alloc] initWithRootViewController:[[TimePeriodsViewController alloc] initWithNibName:@"TimePeriodsViewController" bundle:nil]]; - - //Initialize tab bar controller - self.tabBarController = [[UITabBarController alloc] init]; - - //Style tab bar - if ([self.tabBarController.tabBar respondsToSelector:@selector(setTranslucent:)]) { - [self.tabBarController.tabBar setTranslucent:NO]; - [self.tabBarController.tabBar setTintColor:[UIColor infoBlueColor]]; - } - else { - [self.tabBarController.tabBar setBackgroundColor:[UIColor infoBlueColor]]; - } - - //Add view controllers - self.tabBarController.viewControllers = @[dtVC, tpVC]; -} - -@end diff --git a/DateTools/Examples/DateToolsExample/DateToolsExample/Calendar.png b/DateTools/Examples/DateToolsExample/DateToolsExample/Calendar.png deleted file mode 100755 index f410bd76880a2127929a0d3dda3479e11d00e95e..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1230 zcmah}PiWIn7!N4(4;xMdng1X}5rwsRFHPDcv~F#axZ+wzSJ*s=OOw|vEdP9Ywe2o~ z;=zLl@h$~Dco0Fvi-MkndGMf~^rj3CUPM9gAnHrk&K+b1lK17y_xrxz_b=CHDyK(w zAKc9_%t&cUtI~5ny~lPA(dVycBWLJwfavpNHfWHRi4l{xgF0eMp1Fvs$h12bU!p9- zZ2Rie=E;0{TD1Z%X~s6mwii+~!(=Dgp=m86!q(BEk{Ee05| zQW7LAkcMnpOhOSTqB71300JHgJjf&7Ro6om%@F9->0k%&4zG2010Iy&&6p~%8cNSwfDV~=J%Xp$U9nXaech2`>w zV?XK_ik6ITn;{RAfcLyOuby>8s^~9`e_BViPKfv_ih?G#Xg?Z92Vh#etpg1VZEM3W zY+|>Ur)}}bMIQ1=L`lIOBg$MoiyhiP)71j28GkKlIj-4sY*o?(AS;5XqzZ;sfKY*A zUX~P~rJw}lq8tZ{9c%_tP12^=ye<_D14@#d(IM1RvSfgw4CG8&$|#zs53nUaBBpPl zIB1M@{$j-~v1$<`lLWXH1nyu|O0L_C2#(ckaW)nAug?%+=Mu6F9C&Q60jl$lxQ37_ zo*0kB7gU13P%g1BrIuzZL)*bPi-1pR*=5}C7 zmmwB6wvfJT>@o7`@?yHBPtISQqZ=NTw0y1ozW(F)?}=^dZP9si+5LF;9;$cuE^L1{ zweQx$&b2pP=KAaL6I1xe$!BB7Z)WaYz0w$ZGWVMCl(L&LlNwP5y!4Ay1{QTed z-_NnVeLL2!-n^QksI|GBdV%cS^V-ygy?GeA_Y?GGY4=bFQ) zfJ}Sz-~*JTsAU6Av4l(c-J0dQtQqOBb+M3THS0m?0%rW$=3LZ%@ zb551=d+CfHAX;KU+yXMBWs!vj09 zQp|pgD;meuYBjbduzoPiK~+^bz;iqwCmQi^)Wc>y?u8vK1|5Y~;8d{VdvwHT4*FG` zVu+`6A-I)%eu3Bv=MzOz#?{RV2U){9-Ch0s-R9;ktw4tXVRH4|bNGi|;C;=s- zvG%Mi-&TE0QQFSph=D zkkeV7Ps<4d7?PA`=CSsoM782o)Bl6zh%;Q&5sNycB_eGX9T)nYToxtbEP9&&_ri!?B0rXu)$8f-td!o zBW$|{jjKC89DkdBaaL-7_2-Yrzu8TV{M?xC*z)nyt~=$t^YY87zdq2Kza(#6{O0; z_W8Hf$?>}SSi;NTTcD6U2dQ1YAZ!gLN42< JUrK*=3W{yMFF$P(){V4jw&GexSGL|B@@MkZX1gd3 zks*RV2XC^22fYYh6%_O|ym=AzCOhmPh@N(Ge(Bn|gJ>Z6-n@CA_kG^KtW8zM2YQEk zDT*2>O=wkeo+S6FBZtZJ*Xw~xh zVb|)oUY=A;-%T5dO*(c1f~KgEu{bcyC4}h)TClww^ZnHuhPJI7Gb@%sIVhk-dtxO- z(<_ylxw2%+7Be2MWu!TCH@8 zPy68l3uRem0mpJ&iddwgWe*#1%8Q1(9yAo0p&ek`_vpl<(eRr%#}KBwDY!woyyw`9 zI)x%7V`C#=VH&Wmo8;BDj&K$Iq48JisJ0v+wu&OZ8JeUY^TS;*solQ=bqy_Z&n{?& zPCHM_WRZhh^UY@RwWQ^kX4AG5QR9FlbArt0buAB}3p-EM$l|0S--$rm{;pULV#7e&H(7i;Y+R5xE0{s+qvGM1@e8#|~onW}?3l4B>+p*V)O zK+2G^(7e%fFf%$enYmK&L)UQV3TjOn%Vh9qz>ToU7&^}Ex^}f07T9Rc* z#Jw#fFME58JhHqY+0vgEzI-DaZk9B)7JqJR@9d2AD31mE!*%EDlc%V$ethoWr-{DR z7cZr3_R;-%Pw?!_IaNI|xccC5ih94f@$mM{RDbX4;JpX0*Tn6fV^`L1-8pn4e!IAN ncW82awRC<~e|PFAb)cWxIy=+%aqHdj$qSY2PO(}xxExoi<#FyEb?H)=EB=6i+V9|)Xq&H1# z6pOtTg=I=(9e{qnFZQ!yL^=Rzng*Z*Bq_rXnPerT_8=1`2gV*uoH)dbsTYNO>d|gT zJz5l)(v2eoajmxLI7~)~VkrXyI|fLEAPCZP4bcg0;@dLrh)!B7F$PVXL_OlLdMq6n zlUeTW9%u}7olRWaBmVH5t^=@-102$Xi9$m~Ou7CP@mK+E-;A7I`n75ngv5nrxc+iXs{1 zoFp6hF}E5f)D9h-22Hu%ZLWG(u3jeCrV(jHkw0#gs_*v_N>VdlUdX2P8!5!ZdjY!^ zi2{CD0NuMoT+K3NBulCyD{6(QR;`>-kt8FRx1gmchA`r~TM{)suU7dVE?{C@N2eb3 z@u)LPJ{|3RFYON9x5ExgL&n8RcF(86Y-2w6Ts*@VAeHA}6*AM3yWJb9d-{^8ik zi~COBf8@i7XRSTUZ(H8(?CJMvUo>vMJpJYC|D3q4|FZv{le@3JbY%JC3m>)5Ug@?v z6EhEAKDF~yymRf=1HWCFK6r~<;?5uB-g^4G&(7~%`*!}P!jn_mw(q)e_-|2}+qZxH z*K?DP`RkVxu%@)%xiS0wS^DWW*R)Ib9iL#R2jS7L->i3|5B}{pQp+Q|UYvy7YZt^b U7h8Wllm3yamAd(farD*y0AZ$}?f?J) diff --git a/DateTools/Examples/DateToolsExample/DateToolsExample/Colours.h b/DateTools/Examples/DateToolsExample/DateToolsExample/Colours.h deleted file mode 100755 index 72fb2a5c..00000000 --- a/DateTools/Examples/DateToolsExample/DateToolsExample/Colours.h +++ /dev/null @@ -1,489 +0,0 @@ -// Copyright (C) 2013 by Benjamin Gordon -// -// Permission is hereby granted, free of charge, to any -// person obtaining a copy of this software and -// associated documentation files (the "Software"), to -// deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the -// Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall -// be included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES -// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS -// BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -#include "TargetConditionals.h" -#include - - -#pragma mark - Static String Keys -static NSString * kColoursRGBA_R = @"RGBA-r"; -static NSString * kColoursRGBA_G = @"RGBA-g"; -static NSString * kColoursRGBA_B = @"RGBA-b"; -static NSString * kColoursRGBA_A = @"RGBA-a"; -static NSString * kColoursHSBA_H = @"HSBA-h"; -static NSString * kColoursHSBA_S = @"HSBA-s"; -static NSString * kColoursHSBA_B = @"HSBA-b"; -static NSString * kColoursHSBA_A = @"HSBA-a"; -static NSString * kColoursCIE_L = @"LABa-L"; -static NSString * kColoursCIE_A = @"LABa-A"; -static NSString * kColoursCIE_B = @"LABa-B"; -static NSString * kColoursCIE_alpha = @"LABa-a"; -static NSString * kColoursCMYK_C = @"CMYK-c"; -static NSString * kColoursCMYK_M = @"CMYK-m"; -static NSString * kColoursCMYK_Y = @"CMYK-y"; -static NSString * kColoursCMYK_K = @"CMYK-k"; - - -#pragma mark - Create correct iOS/OSX interface - -#if TARGET_OS_IPHONE -#import -@interface UIColor (Colours) - -#elif TARGET_OS_MAC -#import -@interface NSColor (Colours) - -#endif - - -#pragma mark - Enums -// Color Scheme Generation Enum -typedef NS_ENUM(NSInteger, ColorScheme) { - ColorSchemeAnalagous, - ColorSchemeMonochromatic, - ColorSchemeTriad, - ColorSchemeComplementary -}; - -// ColorFormulation Type -typedef NS_ENUM(NSInteger, ColorFormulation) { - ColorFormulationRGBA, - ColorFormulationHSBA, - ColorFormulationLAB, - ColorFormulationCMYK -}; - -// ColorDistance -typedef NS_ENUM(NSInteger, ColorDistance) { - ColorDistanceCIE76, - ColorDistanceCIE94, - ColorDistanceCIE2000, -}; - - -#pragma mark - Color from Hex/RGBA/HSBA/CIE_LAB/CMYK -/** - Creates a Color from a Hex representation string - @param hexString Hex string that looks like @"#FF0000" or @"FF0000" - @return Color - */ -+ (instancetype)colorFromHexString:(NSString *)hexString; - -/** - Creates a Color from an array of 4 NSNumbers (r,g,b,a) - @param rgbaArray 4 NSNumbers for rgba between 0 - 1 - @return Color - */ -+ (instancetype)colorFromRGBAArray:(NSArray *)rgbaArray; - -/** - Creates a Color from a dictionary of 4 NSNumbers - Keys: kColoursRGBA_R, kColoursRGBA_G, kColoursRGBA_B, kColoursRGBA_A - @param rgbaDictionary 4 NSNumbers for rgba between 0 - 1 - @return Color - */ -+ (instancetype)colorFromRGBADictionary:(NSDictionary *)rgbaDict; - -/** - Creates a Color from an array of 4 NSNumbers (h,s,b,a) - @param hsbaArray 4 NSNumbers for rgba between 0 - 1 - @return Color - */ -+ (instancetype)colorFromHSBAArray:(NSArray *)hsbaArray; - -/** - Creates a Color from a dictionary of 4 NSNumbers - Keys: kColoursHSBA_H, kColoursHSBA_S, kColoursHSBA_B, kColoursHSBA_A - @param hsbaDictionary 4 NSNumbers for rgba between 0 - 1 - @return Color - */ -+ (instancetype)colorFromHSBADictionary:(NSDictionary *)hsbaDict; - -/** - Creates a Color from an array of 4 NSNumbers (L,a,b,alpha) - @param colors 4 NSNumbers for CIE_LAB between 0 - 1 - @return Color - */ -+ (instancetype)colorFromCIE_LabArray:(NSArray *)colors; - -/** - Creates a Color from a dictionary of 4 NSNumbers - Keys: kColoursCIE_L, kColoursCIE_A, kColoursCIE_B, kColoursCIE_alpha - @param colors 4 NSNumbers for CIE_LAB between 0 - 1 - @return Color - */ -+ (instancetype)colorFromCIE_LabDictionary:(NSDictionary *)colors; - -/** - Creates a Color from an array of 4 NSNumbers (C,M,Y,K) - @param colors 4 NSNumbers for CMYK between 0 - 1 - @return Color - */ -+ (instancetype)colorFromCMYKArray:(NSArray *)cmyk; - -/** - Creates a Color from a dictionary of 4 NSNumbers - Keys: kColoursCMYK_C, kColoursCMYK_M, kColoursCMYK_Y, kColoursCMYK_K - @param colors 4 NSNumbers for CMYK between 0 - 1 - @return Color - */ -+ (instancetype)colorFromCMYKDictionary:(NSDictionary *)cmyk; - - - -#pragma mark - Hex/RGBA/HSBA/CIE_LAB/CMYK from Color -/** - Creates a Hex representation from a Color - @return NSString - */ -- (NSString *)hexString; - -/** - Creates an array of 4 NSNumbers representing the float values of r, g, b, a in that order. - @return NSArray - */ -- (NSArray *)rgbaArray; - -/** - Creates an array of 4 NSNumbers representing the float values of h, s, b, a in that order. - @return NSArray - */ -- (NSArray *)hsbaArray; - -/** - Creates a dictionary of 4 NSNumbers representing float values with keys: kColoursRGBA_R, kColoursRGBA_G, kColoursRGBA_B, kColoursRGBA_A - @return NSDictionary - */ -- (NSDictionary *)rgbaDictionary; - -/** - Creates a dictionary of 4 NSNumbers representing float values with keys: kColoursHSBA_H, kColoursHSBA_S, kColoursHSBA_B, kColoursHSBA_A - @return NSDictionary - */ -- (NSDictionary *)hsbaDictionary; - -/** - * Creates an array of 4 NSNumbers representing the float values of L*, a, b, alpha in that order. - * - * @return NSArray - */ -- (NSArray *)CIE_LabArray; - -/** - * Creates a dictionary of 4 NSNumbers representing the float values with keys: kColoursCIE_L, kColoursCIE_A, kColoursCIE_B, kColoursCIE_alpha - * - * @return NSDictionary - */ -- (NSDictionary *)CIE_LabDictionary; - -/** - * Creates an array of 4 NSNumbers representing the float values of C, M, Y, K in that order. - * - * @return NSArray - */ -- (NSArray *)cmykArray; - -/** - * Creates a dictionary of 4 NSNumbers representing the float values with keys: kColoursCMYK_C, kColoursCMYK_M, kColoursCMYK_Y, kColoursCMYK_K - * - * @return NSDictionary - */ -- (NSDictionary *)cmykDictionary; - - -#pragma mark - Color Components -/** - * Creates an NSDictionary with RGBA and HSBA color components inside. - * - * @return NSDictionary - */ -- (NSDictionary *)colorComponents; - -/** - * Returns the red value from an RGBA formulation of the UIColor. - * - * @return CGFloat - */ -- (CGFloat)red; - -/** - * Returns the green value from an RGBA formulation of the UIColor. - * - * @return CGFloat - */ -- (CGFloat)green; - -/** - * Returns the blue value from an RGBA formulation of the UIColor. - * - * @return CGFloat - */ -- (CGFloat)blue; - -/** - * Returns the hue value from an HSBA formulation of the UIColor. - * - * @return CGFloat - */ -- (CGFloat)hue; - -/** - * Returns the saturation value from an HSBA formulation of the UIColor. - * - * @return CGFloat - */ -- (CGFloat)saturation; - -/** - * Returns the brightness value from an HSBA formulation of the UIColor. - * - * @return CGFloat - */ -- (CGFloat)brightness; - -/** - * Returns the alpha value from an RGBA formulation of the UIColor. - * - * @return CGFloat - */ -- (CGFloat)alpha; - -/** - * Returns the lightness value from a CIELAB formulation of the UIColor. - * - * @return CGFloat - */ -- (CGFloat)CIE_Lightness; - -/** - * Returns the a value from a CIELAB formulation of the UIColor. - * - * @return CGFloat - */ -- (CGFloat)CIE_a; - -/** - * Returns the b value from a CIELAB formulation of the UIColor. - * - * @return CGFloat - */ -- (CGFloat)CIE_b; - -/** - * Returns the cyan value from a CMYK formulation of the UIColor. - * - * @return CGFloat - */ -- (CGFloat)cyan; - -/** - * Returns the magenta value from a CMYK formulation of the UIColor. - * - * @return CGFloat - */ -- (CGFloat)magenta; - -/** - * Returns the yellow value from a CMYK formulation of the UIColor. - * - * @return CGFloat - */ -- (CGFloat)yellow; - -/** - * Returns the black (K) value from a CMYK formulation of the UIColor. - * - * @return CGFloat - */ -- (CGFloat)keyBlack; - - -#pragma mark - 4 Color Scheme from Color -/** - Creates an NSArray of 4 Colors that complement the Color. - @param type ColorSchemeAnalagous, ColorSchemeMonochromatic, ColorSchemeTriad, ColorSchemeComplementary - @return NSArray - */ -- (NSArray *)colorSchemeOfType:(ColorScheme)type; - - -#pragma mark - Contrasting Color from Color -/** - Creates either [Color whiteColor] or [Color blackColor] depending on if the color this method is run on is dark or light. - @return Color - */ -- (instancetype)blackOrWhiteContrastingColor; - - -#pragma mark - Complementary Color -/** - Creates a complementary color - a color directly opposite it on the color wheel. - @return Color - */ -- (instancetype)complementaryColor; - - -#pragma mark - Distance between Colors -/** - * Returns a float of the distance between 2 colors. Defaults to the - * CIE94 specification found here: http://en.wikipedia.org/wiki/Color_difference - * - * @param color Color to check self with. - * - * @return CGFloat - */ -- (CGFloat)distanceFromColor:(id)color; - -/** - * Returns a float of the distance between 2 colors, using one of - * - * - * @param color Color to check against - * @param distanceType Formula to calculate with - * - * @return CGFloat - */ -- (CGFloat)distanceFromColor:(id)color type:(ColorDistance)distanceType; - - -#pragma mark - Colors -// System Colors -+ (instancetype)infoBlueColor; -+ (instancetype)successColor; -+ (instancetype)warningColor; -+ (instancetype)dangerColor; - -// Whites -+ (instancetype)antiqueWhiteColor; -+ (instancetype)oldLaceColor; -+ (instancetype)ivoryColor; -+ (instancetype)seashellColor; -+ (instancetype)ghostWhiteColor; -+ (instancetype)snowColor; -+ (instancetype)linenColor; - -// Grays -+ (instancetype)black25PercentColor; -+ (instancetype)black50PercentColor; -+ (instancetype)black75PercentColor; -+ (instancetype)warmGrayColor; -+ (instancetype)coolGrayColor; -+ (instancetype)charcoalColor; - -// Blues -+ (instancetype)tealColor; -+ (instancetype)steelBlueColor; -+ (instancetype)robinEggColor; -+ (instancetype)pastelBlueColor; -+ (instancetype)turquoiseColor; -+ (instancetype)skyBlueColor; -+ (instancetype)indigoColor; -+ (instancetype)denimColor; -+ (instancetype)blueberryColor; -+ (instancetype)cornflowerColor; -+ (instancetype)babyBlueColor; -+ (instancetype)midnightBlueColor; -+ (instancetype)fadedBlueColor; -+ (instancetype)icebergColor; -+ (instancetype)waveColor; - -// Greens -+ (instancetype)emeraldColor; -+ (instancetype)grassColor; -+ (instancetype)pastelGreenColor; -+ (instancetype)seafoamColor; -+ (instancetype)paleGreenColor; -+ (instancetype)cactusGreenColor; -+ (instancetype)chartreuseColor; -+ (instancetype)hollyGreenColor; -+ (instancetype)oliveColor; -+ (instancetype)oliveDrabColor; -+ (instancetype)moneyGreenColor; -+ (instancetype)honeydewColor; -+ (instancetype)limeColor; -+ (instancetype)cardTableColor; - -// Reds -+ (instancetype)salmonColor; -+ (instancetype)brickRedColor; -+ (instancetype)easterPinkColor; -+ (instancetype)grapefruitColor; -+ (instancetype)pinkColor; -+ (instancetype)indianRedColor; -+ (instancetype)strawberryColor; -+ (instancetype)coralColor; -+ (instancetype)maroonColor; -+ (instancetype)watermelonColor; -+ (instancetype)tomatoColor; -+ (instancetype)pinkLipstickColor; -+ (instancetype)paleRoseColor; -+ (instancetype)crimsonColor; - -// Purples -+ (instancetype)eggplantColor; -+ (instancetype)pastelPurpleColor; -+ (instancetype)palePurpleColor; -+ (instancetype)coolPurpleColor; -+ (instancetype)violetColor; -+ (instancetype)plumColor; -+ (instancetype)lavenderColor; -+ (instancetype)raspberryColor; -+ (instancetype)fuschiaColor; -+ (instancetype)grapeColor; -+ (instancetype)periwinkleColor; -+ (instancetype)orchidColor; - -// Yellows -+ (instancetype)goldenrodColor; -+ (instancetype)yellowGreenColor; -+ (instancetype)bananaColor; -+ (instancetype)mustardColor; -+ (instancetype)buttermilkColor; -+ (instancetype)goldColor; -+ (instancetype)creamColor; -+ (instancetype)lightCreamColor; -+ (instancetype)wheatColor; -+ (instancetype)beigeColor; - -// Oranges -+ (instancetype)peachColor; -+ (instancetype)burntOrangeColor; -+ (instancetype)pastelOrangeColor; -+ (instancetype)cantaloupeColor; -+ (instancetype)carrotColor; -+ (instancetype)mandarinColor; - -// Browns -+ (instancetype)chiliPowderColor; -+ (instancetype)burntSiennaColor; -+ (instancetype)chocolateColor; -+ (instancetype)coffeeColor; -+ (instancetype)cinnamonColor; -+ (instancetype)almondColor; -+ (instancetype)eggshellColor; -+ (instancetype)sandColor; -+ (instancetype)mudColor; -+ (instancetype)siennaColor; -+ (instancetype)dustColor; - -@end diff --git a/DateTools/Examples/DateToolsExample/DateToolsExample/Colours.m b/DateTools/Examples/DateToolsExample/DateToolsExample/Colours.m deleted file mode 100755 index e3706253..00000000 --- a/DateTools/Examples/DateToolsExample/DateToolsExample/Colours.m +++ /dev/null @@ -1,1303 +0,0 @@ -// Copyright (C) 2013 by Benjamin Gordon -// -// Permission is hereby granted, free of charge, to any -// person obtaining a copy of this software and -// associated documentation files (the "Software"), to -// deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the -// Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall -// be included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES -// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS -// BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -#import "Colours.h" - -// Swizzle -#import - -#pragma mark - Create correct iOS/OSX implementation - -#if TARGET_OS_IPHONE -#import -@implementation UIColor (Colours) - -#elif TARGET_OS_MAC -#import -@implementation NSColor (Colours) - -#endif - - -#pragma mark - Color from Hex -+ (instancetype)colorFromHexString:(NSString *)hexString -{ - unsigned rgbValue = 0; - hexString = [hexString stringByReplacingOccurrencesOfString:@"#" withString:@""]; - NSScanner *scanner = [NSScanner scannerWithString:hexString]; - [scanner scanHexInt:&rgbValue]; - - return [[self class] colorWithR:((rgbValue & 0xFF0000) >> 16) G:((rgbValue & 0xFF00) >> 8) B:(rgbValue & 0xFF) A:1.0]; -} - - -#pragma mark - Hex from Color -- (NSString *)hexString -{ - NSArray *colorArray = [self rgbaArray]; - int r = [colorArray[0] floatValue] * 255; - int g = [colorArray[1] floatValue] * 255; - int b = [colorArray[2] floatValue] * 255; - NSString *red = [NSString stringWithFormat:@"%02x", r]; - NSString *green = [NSString stringWithFormat:@"%02x", g]; - NSString *blue = [NSString stringWithFormat:@"%02x", b]; - - return [NSString stringWithFormat:@"#%@%@%@", red, green, blue]; -} - - -#pragma mark - Color from RGBA -+ (instancetype)colorFromRGBAArray:(NSArray *)rgbaArray -{ - if (rgbaArray.count < 4) { - return [[self class] clearColor]; - } - - return [[self class] colorWithRed:[rgbaArray[0] floatValue] - green:[rgbaArray[1] floatValue] - blue:[rgbaArray[2] floatValue] - alpha:[rgbaArray[3] floatValue]]; -} - -+ (instancetype)colorFromRGBADictionary:(NSDictionary *)rgbaDict -{ - if (rgbaDict[kColoursRGBA_R] && rgbaDict[kColoursRGBA_G] && rgbaDict[kColoursRGBA_B] && rgbaDict[kColoursRGBA_A]) { - return [[self class] colorWithRed:[rgbaDict[kColoursRGBA_R] floatValue] - green:[rgbaDict[kColoursRGBA_G] floatValue] - blue:[rgbaDict[kColoursRGBA_B] floatValue] - alpha:[rgbaDict[kColoursRGBA_A] floatValue]]; - } - - return [[self class] clearColor]; -} - - -#pragma mark - RGBA from Color -- (NSArray *)rgbaArray -{ - CGFloat r=0,g=0,b=0,a=0; - - if ([self respondsToSelector:@selector(getRed:green:blue:alpha:)]) { - [self getRed:&r green:&g blue:&b alpha:&a]; - } - else { - const CGFloat *components = CGColorGetComponents(self.CGColor); - r = components[0]; - g = components[1]; - b = components[2]; - a = components[3]; - } - - return @[@(r), - @(g), - @(b), - @(a)]; -} - -- (NSDictionary *)rgbaDictionary -{ - CGFloat r=0,g=0,b=0,a=0; - if ([self respondsToSelector:@selector(getRed:green:blue:alpha:)]) { - [self getRed:&r green:&g blue:&b alpha:&a]; - } - else { - const CGFloat *components = CGColorGetComponents(self.CGColor); - r = components[0]; - g = components[1]; - b = components[2]; - a = components[3]; - } - - return @{kColoursRGBA_R:@(r), - kColoursRGBA_G:@(g), - kColoursRGBA_B:@(b), - kColoursRGBA_A:@(a)}; -} - - -#pragma mark - HSBA from Color -- (NSArray *)hsbaArray -{ - // Takes a [self class] and returns Hue,Saturation,Brightness,Alpha values in NSNumber form - CGFloat h=0,s=0,b=0,a=0; - - if ([self respondsToSelector:@selector(getHue:saturation:brightness:alpha:)]) { - [self getHue:&h saturation:&s brightness:&b alpha:&a]; - } - - return @[@(h), - @(s), - @(b), - @(a)]; -} - -- (NSDictionary *)hsbaDictionary -{ - CGFloat h=0,s=0,b=0,a=0; - - if ([self respondsToSelector:@selector(getHue:saturation:brightness:alpha:)]) { - [self getHue:&h saturation:&s brightness:&b alpha:&a]; - } - - return @{kColoursHSBA_H:@(h), - kColoursHSBA_S:@(s), - kColoursHSBA_B:@(b), - kColoursHSBA_A:@(a)}; -} - - -#pragma mark - Color from HSBA -+ (instancetype)colorFromHSBAArray:(NSArray *)hsbaArray -{ - if (hsbaArray.count < 4) { - return [[self class] clearColor]; - } - - return [[self class] colorWithHue:[hsbaArray[0] doubleValue] - saturation:[hsbaArray[1] doubleValue] - brightness:[hsbaArray[2] doubleValue] - alpha:[hsbaArray[3] doubleValue]]; -} - -+ (instancetype)colorFromHSBADictionary:(NSDictionary *)hsbaDict -{ - if (hsbaDict[kColoursHSBA_H] && hsbaDict[kColoursHSBA_S] && hsbaDict[kColoursHSBA_B] && hsbaDict[kColoursHSBA_A]) { - return [[self class] colorWithHue:[hsbaDict[kColoursHSBA_H] doubleValue] - saturation:[hsbaDict[kColoursHSBA_S] doubleValue] - brightness:[hsbaDict[kColoursHSBA_B] doubleValue] - alpha:[hsbaDict[kColoursHSBA_A] doubleValue]]; - } - - return [[self class] clearColor]; -} - - -#pragma mark - LAB from Color -- (NSArray *)CIE_LabArray { - // Convert Color to XYZ format first - NSArray *rgba = [self rgbaArray]; - CGFloat R = [rgba[0] floatValue]; - CGFloat G = [rgba[1] floatValue]; - CGFloat B = [rgba[2] floatValue]; - - // Create deltaR block - void (^deltaRGB)(CGFloat *R); - deltaRGB = ^(CGFloat *R) { - *R = (*R > 0.04045) ? pow((*R + 0.055)/1.055, 2.40) : (*R/12.92); - }; - deltaRGB(&R); - deltaRGB(&G); - deltaRGB(&B); - CGFloat X = R*41.24 + G*35.76 + B*18.05; - CGFloat Y = R*21.26 + G*71.52 + B*7.22; - CGFloat Z = R*1.93 + G*11.92 + B*95.05; - - // Convert XYZ to L*a*b* - X = X/95.047; - Y = Y/100.000; - Z = Z/108.883; - - // Create deltaF block - void (^deltaF)(CGFloat *f); - deltaF = ^(CGFloat *f){ - *f = (*f > pow((6.0/29.0), 3.0)) ? pow(*f, 1.0/3.0) : (1/3)*pow((29.0/6.0), 2.0) * *f + 4/29.0; - }; - deltaF(&X); - deltaF(&Y); - deltaF(&Z); - NSNumber *L = @(116*Y - 16); - NSNumber *a = @(500 * (X - Y)); - NSNumber *b = @(200 * (Y - Z)); - - return @[L, - a, - b, - rgba[3]]; -} - -- (NSDictionary *)CIE_LabDictionary { - NSArray *colors = [self CIE_LabArray]; - return @{kColoursCIE_L:colors[0], - kColoursCIE_A:colors[1], - kColoursCIE_B:colors[2], - kColoursCIE_alpha:colors[3],}; -} - - -#pragma mark - Color from LAB -+ (instancetype)colorFromCIE_LabArray:(NSArray *)colors { - if (!colors || colors.count < 4) { - return [[self class] clearColor]; - } - - // Convert LAB to XYZ - CGFloat L = [colors[0] floatValue]; - CGFloat A = [colors[1] floatValue]; - CGFloat B = [colors[2] floatValue]; - CGFloat Y = (L + 16.0)/116.0; - CGFloat X = A/500 + Y; - CGFloat Z = Y - B/200; - - void (^deltaXYZ)(CGFloat *); - deltaXYZ = ^(CGFloat *k){ - *k = (pow(*k, 3.0) > 0.008856) ? pow(*k, 3.0) : (*k - 4/29.0)/7.787; - }; - - deltaXYZ(&X); - deltaXYZ(&Y); - deltaXYZ(&Z); - X = X*.95047; - Y = Y*1.00000; - Z = Z*1.08883; - - // Convert XYZ to RGB - CGFloat R = X*3.2406 + Y*-1.5372 + Z*-0.4986; - CGFloat G = X*-0.9689 + Y*1.8758 + Z*0.0415; - CGFloat _B = X*0.0557 + Y*-0.2040 + Z*1.0570; - - void (^deltaRGB)(CGFloat *); - deltaRGB = ^(CGFloat *k){ - *k = (*k > 0.0031308) ? 1.055 * (pow(*k, (1/2.4))) - 0.055 : *k * 12.92; - }; - - deltaRGB(&R); - deltaRGB(&G); - deltaRGB(&_B); - - // return Color - return [[self class] colorFromRGBAArray:@[@(R), @(G), @(_B), colors[3]]]; -} - -+ (instancetype)colorFromCIE_LabDictionary:(NSDictionary *)colors { - if (!colors) { - return [[self class] clearColor]; - } - - if (colors[kColoursCIE_L] && colors[kColoursCIE_A] && colors[kColoursCIE_B] && colors[kColoursCIE_alpha]) { - return [self colorFromCIE_LabArray:@[colors[kColoursCIE_L], - colors[kColoursCIE_A], - colors[kColoursCIE_B], - colors[kColoursCIE_alpha]]]; - } - - return [[self class] clearColor]; -} - - -#pragma mark - Color to CMYK -- (NSArray *)cmykArray -{ - // Convert RGB to CMY - NSArray *rgb = [self rgbaArray]; - CGFloat C = 1 - [rgb[0] floatValue]; - CGFloat M = 1 - [rgb[1] floatValue]; - CGFloat Y = 1 - [rgb[2] floatValue]; - - // Find K - CGFloat K = MIN(1, MIN(C, MIN(Y, M))); - if (K == 1) { - C = 0; - M = 0; - Y = 0; - } - else { - void (^newCMYK)(CGFloat *); - newCMYK = ^(CGFloat *x){ - *x = (*x - K)/(1 - K); - }; - newCMYK(&C); - newCMYK(&M); - newCMYK(&Y); - } - - return @[@(C), - @(M), - @(Y), - @(K)]; -} - -- (NSDictionary *)cmykDictionary -{ - NSArray *colors = [self cmykArray]; - return @{kColoursCMYK_C:colors[0], - kColoursCMYK_M:colors[1], - kColoursCMYK_Y:colors[2], - kColoursCMYK_K:colors[3]}; -} - -#pragma mark - CMYK to Color -+ (instancetype)colorFromCMYKArray:(NSArray *)cmyk -{ - if (!cmyk || cmyk.count < 4) { - return [[self class] clearColor]; - } - - // Find CMY values - CGFloat C = [cmyk[0] floatValue]; - CGFloat M = [cmyk[1] floatValue]; - CGFloat Y = [cmyk[2] floatValue]; - CGFloat K = [cmyk[3] floatValue]; - void (^cmyTransform)(CGFloat *); - cmyTransform = ^(CGFloat *x){ - *x = *x * (1 - K) + K; - }; - cmyTransform(&C); - cmyTransform(&M); - cmyTransform(&Y); - - // Translate CMY to RGB - CGFloat R = 1 - C; - CGFloat G = 1 - M; - CGFloat B = 1 - Y; - - // return the Color - return [[self class] colorFromRGBAArray:@[@(R), - @(G), - @(B), - @(1)]]; -} - -+ (instancetype)colorFromCMYKDictionary:(NSDictionary *)cmyk -{ - if (!cmyk) { - return [[self class] clearColor]; - } - - if (cmyk[kColoursCMYK_C] && cmyk[kColoursCMYK_M] && cmyk[kColoursCMYK_Y] && cmyk[kColoursCMYK_K]) { - return [[self class] colorFromCMYKArray:@[cmyk[kColoursCMYK_C], - cmyk[kColoursCMYK_M], - cmyk[kColoursCMYK_Y], - cmyk[kColoursCMYK_K]]]; - } - - return [[self class] clearColor]; -} - - -#pragma mark - Color Components -- (NSDictionary *)colorComponents -{ - NSMutableDictionary *components = [[self rgbaDictionary] mutableCopy]; - [components addEntriesFromDictionary:[self hsbaDictionary]]; - [components addEntriesFromDictionary:[self CIE_LabDictionary]]; - return components; -} - -- (CGFloat)red -{ - return [[self rgbaArray][0] floatValue]; -} - -- (CGFloat)green -{ - return [[self rgbaArray][1] floatValue]; -} - -- (CGFloat)blue -{ - return [[self rgbaArray][2] floatValue]; -} - -- (CGFloat)hue -{ - return [[self hsbaArray][0] floatValue]; -} - -- (CGFloat)saturation -{ - return [[self hsbaArray][1] floatValue]; -} - -- (CGFloat)brightness -{ - return [[self hsbaArray][2] floatValue]; -} - -- (CGFloat)alpha -{ - return [[self rgbaArray][3] floatValue]; -} - -- (CGFloat)CIE_Lightness -{ - return [[self CIE_LabArray][0] floatValue]; -} - -- (CGFloat)CIE_a -{ - return [[self CIE_LabArray][1] floatValue]; -} - -- (CGFloat)CIE_b -{ - return [[self CIE_LabArray][2] floatValue]; -} - -- (CGFloat)cyan { - return [[self cmykArray][0] floatValue]; -} - -- (CGFloat)magenta { - return [[self cmykArray][1] floatValue]; -} - -- (CGFloat)yellow { - return [[self cmykArray][2] floatValue]; -} - -- (CGFloat)keyBlack { - return [[self cmykArray][3] floatValue]; -} - -#pragma mark - Generate Color Scheme -- (NSArray *)colorSchemeOfType:(ColorScheme)type -{ - NSArray *hsbArray = [self hsbaArray]; - float hue = [hsbArray[0] floatValue] * 360; - float sat = [hsbArray[1] floatValue] * 100; - float bright = [hsbArray[2] floatValue] * 100; - float alpha = [hsbArray[3] floatValue]; - - switch (type) { - case ColorSchemeAnalagous: - return [[self class] analagousColorsFromHue:hue saturation:sat brightness:bright alpha:alpha]; - case ColorSchemeMonochromatic: - return [[self class] monochromaticColorsFromHue:hue saturation:sat brightness:bright alpha:alpha]; - case ColorSchemeTriad: - return [[self class] triadColorsFromHue:hue saturation:sat brightness:bright alpha:alpha]; - case ColorSchemeComplementary: - return [[self class] complementaryColorsFromHue:hue saturation:sat brightness:bright alpha:alpha]; - default: - return nil; - } -} - - -#pragma mark - Color Scheme Generation - Helper methods -+ (NSArray *)analagousColorsFromHue:(float)h saturation:(float)s brightness:(float)b alpha:(float)a -{ - return @[[[self class] colorWithHue:[[self class] addDegrees:30 toDegree:h]/360 saturation:(s-5)/100 brightness:(b-10)/100 alpha:a], - [[self class] colorWithHue:[[self class] addDegrees:15 toDegree:h]/360 saturation:(s-5)/100 brightness:(b-5)/100 alpha:a], - [[self class] colorWithHue:[[self class] addDegrees:-15 toDegree:h]/360 saturation:(s-5)/100 brightness:(b-5)/100 alpha:a], - [[self class] colorWithHue:[[self class] addDegrees:-30 toDegree:h]/360 saturation:(s-5)/100 brightness:(b-10)/100 alpha:a]]; -} - -+ (NSArray *)monochromaticColorsFromHue:(float)h saturation:(float)s brightness:(float)b alpha:(float)a -{ - return @[[[self class] colorWithHue:h/360 saturation:(s/2)/100 brightness:(b/3)/100 alpha:a], - [[self class] colorWithHue:h/360 saturation:s/100 brightness:(b/2)/100 alpha:a], - [[self class] colorWithHue:h/360 saturation:(s/3)/100 brightness:(2*b/3)/100 alpha:a], - [[self class] colorWithHue:h/360 saturation:s/100 brightness:(4*b/5)/100 alpha:a]]; -} - -+ (NSArray *)triadColorsFromHue:(float)h saturation:(float)s brightness:(float)b alpha:(float)a -{ - return @[[[self class] colorWithHue:[[self class] addDegrees:120 toDegree:h]/360 saturation:(7*s/6)/100 brightness:(b-5)/100 alpha:a], - [[self class] colorWithHue:[[self class] addDegrees:120 toDegree:h]/360 saturation:s/100 brightness:b/100 alpha:a], - [[self class] colorWithHue:[[self class] addDegrees:240 toDegree:h]/360 saturation:s/100 brightness:b/100 alpha:a], - [[self class] colorWithHue:[[self class] addDegrees:240 toDegree:h]/360 saturation:(7*s/6)/100 brightness:(b-5)/100 alpha:a]]; -} - -+ (NSArray *)complementaryColorsFromHue:(float)h saturation:(float)s brightness:(float)b alpha:(float)a -{ - return @[[[self class] colorWithHue:h/360 saturation:s/100 brightness:(4*b/5)/100 alpha:a], - [[self class] colorWithHue:h/360 saturation:(5*s/7)/100 brightness:b/100 alpha:a], - [[self class] colorWithHue:[[self class] addDegrees:180 toDegree:h]/360 saturation:s/100 brightness:b/100 alpha:a], - [[self class] colorWithHue:[[self class] addDegrees:180 toDegree:h]/360 saturation:(5*s/7)/100 brightness:b/100 alpha:a]]; -} - - -#pragma mark - Contrasting Color -- (instancetype)blackOrWhiteContrastingColor -{ - NSArray *rgbaArray = [self rgbaArray]; - double a = 1 - ((0.299 * [rgbaArray[0] doubleValue]) + (0.587 * [rgbaArray[1] doubleValue]) + (0.114 * [rgbaArray[2] doubleValue])); - return a < 0.5 ? [[self class] blackColor] : [[self class] whiteColor]; -} - - -#pragma mark - Complementary Color -- (instancetype)complementaryColor -{ - NSMutableDictionary *hsba = [[self hsbaDictionary] mutableCopy]; - float newH = [[self class] addDegrees:180.0f toDegree:([hsba[kColoursHSBA_H] floatValue]*360)]; - [hsba setObject:@(newH) forKey:kColoursHSBA_H]; - return [[self class] colorFromHSBADictionary:hsba]; - -} - - -#pragma mark - Distance between Colors -- (CGFloat)distanceFromColor:(id)color -{ - // Defaults to CIE94 - return [self distanceFromColor:color type:ColorDistanceCIE94]; -} - -- (CGFloat)distanceFromColor:(id)color type:(ColorDistance)distanceType { - /** - * - * Detecting a difference in two colors is not as trivial as it sounds. - * One's first instinct is to go for a difference in RGB values, leaving - * you with a sum of the differences of each point. It looks great! Until - * you actually start comparing colors. Why do these two reds have a different - * distance than these two blues *in real life* vs computationally? - * Human visual perception is next in the line of things between a color - * and your brain. Some colors are just perceived to have larger variants inside - * of their respective areas than others, so we need a way to model this - * human variable to colors. Enter CIELAB. This color formulation is supposed to be - * this model. So now we need to standardize a unit of distance between any two - * colors that works independent of how humans visually perceive that distance. - * Enter CIE76,94,2000. These are methods that use user-tested data and other - * mathematically and statistically significant correlations to output this info. - * You can read the wiki articles below to get a better understanding historically - * of how we moved to newer and better color distance formulas, and what - * their respective pros/cons are. - * - * References: - * - * http://en.wikipedia.org/wiki/Color_difference - * http://en.wikipedia.org/wiki/Just_noticeable_difference - * http://en.wikipedia.org/wiki/CIELAB - * - */ - - // Check if it's a color - if (![color isKindOfClass:[self class]]) { - // NSLog(@"Not a %@ object.", NSStringFromClass([self class])); - return MAXFLOAT; - } - - // Set Up Common Variables - NSArray *lab1 = [self CIE_LabArray]; - NSArray *lab2 = [color CIE_LabArray]; - CGFloat L1 = [lab1[0] floatValue]; - CGFloat A1 = [lab1[1] floatValue]; - CGFloat B1 = [lab1[2] floatValue]; - CGFloat L2 = [lab2[0] floatValue]; - CGFloat A2 = [lab2[1] floatValue]; - CGFloat B2 = [lab2[2] floatValue]; - - // CIE76 first - if (distanceType == ColorDistanceCIE76) { - CGFloat distance = sqrtf(pow((L1-L2), 2) + pow((A1-A2), 2) + pow((B1-B2), 2)); - return distance; - } - - // More Common Variables - CGFloat kL = 1; - CGFloat kC = 1; - CGFloat kH = 1; - CGFloat k1 = 0.045; - CGFloat k2 = 0.015; - CGFloat deltaL = L1 - L2; - CGFloat C1 = sqrt((A1*A1) + (B1*B1)); - CGFloat C2 = sqrt((A2*A2) + (B2*B2)); - CGFloat deltaC = C1 - C2; - CGFloat deltaH = sqrt(pow((A1-A2), 2.0) + pow((B1-B2), 2.0) - pow(deltaC, 2.0)); - CGFloat sL = 1; - CGFloat sC = 1 + k1*(sqrt((A1*A1) + (B1*B1))); - CGFloat sH = 1 + k2*(sqrt((A1*A1) + (B1*B1))); - - // CIE94 - if (distanceType == ColorDistanceCIE94) { - return sqrt(pow((deltaL/(kL*sL)), 2.0) + pow((deltaC/(kC*sC)), 2.0) + pow((deltaH/(kH*sH)), 2.0)); - } - - // CIE2000 - // More variables - CGFloat deltaLPrime = L2 - L1; - CGFloat meanL = (L1 + L2)/2; - CGFloat meanC = (C1 + C2)/2; - CGFloat aPrime1 = A1 + A1/2*(1 - sqrt(pow(meanC, 7.0)/(pow(meanC, 7.0) + pow(25.0, 7.0)))); - CGFloat aPrime2 = A2 + A2/2*(1 - sqrt(pow(meanC, 7.0)/(pow(meanC, 7.0) + pow(25.0, 7.0)))); - CGFloat cPrime1 = sqrt((aPrime1*aPrime1) + (B1*B1)); - CGFloat cPrime2 = sqrt((aPrime2*aPrime2) + (B2*B2)); - CGFloat cMeanPrime = (cPrime1 + cPrime2)/2; - CGFloat deltaCPrime = cPrime1 - cPrime2; - CGFloat hPrime1 = atan2(B1, aPrime1); - CGFloat hPrime2 = atan2(B2, aPrime2); - hPrime1 = fmodf(hPrime1, [self radiansFromDegree:360]); - hPrime2 = fmodf(hPrime2, [self radiansFromDegree:360]); - CGFloat deltahPrime = 0; - if (fabsf(hPrime1 - hPrime2) <= [self radiansFromDegree:180]) { - deltahPrime = hPrime2 - hPrime1; - } - else { - deltahPrime = (hPrime2 <= hPrime1) ? hPrime2 - hPrime1 + [self radiansFromDegree:360] : hPrime2 - hPrime1 - [self radiansFromDegree:360]; - } - CGFloat deltaHPrime = 2 * sqrt(cPrime1*cPrime2) * sin(deltahPrime/2); - CGFloat meanHPrime = (fabsf(hPrime1 - hPrime2) <= [self radiansFromDegree:180]) ? (hPrime1 + hPrime2)/2 : (hPrime1 + hPrime2 + [self radiansFromDegree:360])/2; - CGFloat T = 1 - 0.17*cos(meanHPrime - [self radiansFromDegree:30]) + 0.24*cos(2*meanHPrime)+0.32*cos(3*meanHPrime + [self radiansFromDegree:6]) - 0.20*cos(4*meanHPrime - [self radiansFromDegree:63]); - sL = 1 + (0.015 * pow((meanL - 50), 2))/sqrt(20 + pow((meanL - 50), 2)); - sC = 1 + 0.045*cMeanPrime; - sH = 1 + 0.015*cMeanPrime*T; - CGFloat Rt = -2 * sqrt(pow(cMeanPrime, 7)/(pow(cMeanPrime, 7) + pow(25.0, 7))) * sin([self radiansFromDegree:60]* exp(-1 * pow((meanHPrime - [self radiansFromDegree:275])/[self radiansFromDegree:25], 2))); - - // Finally return CIE2000 distance - return sqrt(pow((deltaLPrime/(kL*sL)), 2) + pow((deltaCPrime/(kC*sC)), 2) + pow((deltaHPrime/(kH*sH)), 2) + Rt*(deltaC/(kC*sC))*(deltaHPrime/(kH*sH))); -} - - -#pragma mark - System Colors -+ (instancetype)infoBlueColor -{ - return [[self class] colorWithR:47 G:112 B:225 A:1.0]; -} - -+ (instancetype)successColor -{ - return [[self class] colorWithR:83 G:215 B:106 A:1.0]; -} - -+ (instancetype)warningColor -{ - return [[self class] colorWithR:221 G:170 B:59 A:1.0]; -} - -+ (instancetype)dangerColor -{ - return [[self class] colorWithR:229 G:0 B:15 A:1.0]; -} - - -#pragma mark - Whites -+ (instancetype)antiqueWhiteColor -{ - return [[self class] colorWithR:250 G:235 B:215 A:1.0]; -} - -+ (instancetype)oldLaceColor -{ - return [[self class] colorWithR:253 G:245 B:230 A:1.0]; -} - -+ (instancetype)ivoryColor -{ - return [[self class] colorWithR:255 G:255 B:240 A:1.0]; -} - -+ (instancetype)seashellColor -{ - return [[self class] colorWithR:255 G:245 B:238 A:1.0]; -} - -+ (instancetype)ghostWhiteColor -{ - return [[self class] colorWithR:248 G:248 B:255 A:1.0]; -} - -+ (instancetype)snowColor -{ - return [[self class] colorWithR:255 G:250 B:250 A:1.0]; -} - -+ (instancetype)linenColor -{ - return [[self class] colorWithR:250 G:240 B:230 A:1.0]; -} - - -#pragma mark - Grays -+ (instancetype)black25PercentColor -{ - return [[self class] colorWithWhite:0.25 alpha:1.0]; -} - -+ (instancetype)black50PercentColor -{ - return [[self class] colorWithWhite:0.5 alpha:1.0]; -} - -+ (instancetype)black75PercentColor -{ - return [[self class] colorWithWhite:0.75 alpha:1.0]; -} - -+ (instancetype)warmGrayColor -{ - return [[self class] colorWithR:133 G:117 B:112 A:1.0]; -} - -+ (instancetype)coolGrayColor -{ - return [[self class] colorWithR:118 G:122 B:133 A:1.0]; -} - -+ (instancetype)charcoalColor -{ - return [[self class] colorWithR:34 G:34 B:34 A:1.0]; -} - - -#pragma mark - Blues -+ (instancetype)tealColor -{ - return [[self class] colorWithR:28 G:160 B:170 A:1.0]; -} - -+ (instancetype)steelBlueColor -{ - return [[self class] colorWithR:103 G:153 B:170 A:1.0]; -} - -+ (instancetype)robinEggColor -{ - return [[self class] colorWithR:141 G:218 B:247 A:1.0]; -} - -+ (instancetype)pastelBlueColor -{ - return [[self class] colorWithR:99 G:161 B:247 A:1.0]; -} - -+ (instancetype)turquoiseColor -{ - return [[self class] colorWithR:112 G:219 B:219 A:1.0]; -} - -+ (instancetype)skyBlueColor -{ - return [[self class] colorWithR:0 G:178 B:238 A:1.0]; -} - -+ (instancetype)indigoColor -{ - return [[self class] colorWithR:13 G:79 B:139 A:1.0]; -} - -+ (instancetype)denimColor -{ - return [[self class] colorWithR:67 G:114 B:170 A:1.0]; -} - -+ (instancetype)blueberryColor -{ - return [[self class] colorWithR:89 G:113 B:173 A:1.0]; -} - -+ (instancetype)cornflowerColor -{ - return [[self class] colorWithR:100 G:149 B:237 A:1.0]; -} - -+ (instancetype)babyBlueColor -{ - return [[self class] colorWithR:190 G:220 B:230 A:1.0]; -} - -+ (instancetype)midnightBlueColor -{ - return [[self class] colorWithR:13 G:26 B:35 A:1.0]; -} - -+ (instancetype)fadedBlueColor -{ - return [[self class] colorWithR:23 G:137 B:155 A:1.0]; -} - -+ (instancetype)icebergColor -{ - return [[self class] colorWithR:200 G:213 B:219 A:1.0]; -} - -+ (instancetype)waveColor -{ - return [[self class] colorWithR:102 G:169 B:251 A:1.0]; -} - - -#pragma mark - Greens -+ (instancetype)emeraldColor -{ - return [[self class] colorWithR:1 G:152 B:117 A:1.0]; -} - -+ (instancetype)grassColor -{ - return [[self class] colorWithR:99 G:214 B:74 A:1.0]; -} - -+ (instancetype)pastelGreenColor -{ - return [[self class] colorWithR:126 G:242 B:124 A:1.0]; -} - -+ (instancetype)seafoamColor -{ - return [[self class] colorWithR:77 G:226 B:140 A:1.0]; -} - -+ (instancetype)paleGreenColor -{ - return [[self class] colorWithR:176 G:226 B:172 A:1.0]; -} - -+ (instancetype)cactusGreenColor -{ - return [[self class] colorWithR:99 G:111 B:87 A:1.0]; -} - -+ (instancetype)chartreuseColor -{ - return [[self class] colorWithR:69 G:139 B:0 A:1.0]; -} - -+ (instancetype)hollyGreenColor -{ - return [[self class] colorWithR:32 G:87 B:14 A:1.0]; -} - -+ (instancetype)oliveColor -{ - return [[self class] colorWithR:91 G:114 B:34 A:1.0]; -} - -+ (instancetype)oliveDrabColor -{ - return [[self class] colorWithR:107 G:142 B:35 A:1.0]; -} - -+ (instancetype)moneyGreenColor -{ - return [[self class] colorWithR:134 G:198 B:124 A:1.0]; -} - -+ (instancetype)honeydewColor -{ - return [[self class] colorWithR:216 G:255 B:231 A:1.0]; -} - -+ (instancetype)limeColor -{ - return [[self class] colorWithR:56 G:237 B:56 A:1.0]; -} - -+ (instancetype)cardTableColor -{ - return [[self class] colorWithR:87 G:121 B:107 A:1.0]; -} - - -#pragma mark - Reds -+ (instancetype)salmonColor -{ - return [[self class] colorWithR:233 G:87 B:95 A:1.0]; -} - -+ (instancetype)brickRedColor -{ - return [[self class] colorWithR:151 G:27 B:16 A:1.0]; -} - -+ (instancetype)easterPinkColor -{ - return [[self class] colorWithR:241 G:167 B:162 A:1.0]; -} - -+ (instancetype)grapefruitColor -{ - return [[self class] colorWithR:228 G:31 B:54 A:1.0]; -} - -+ (instancetype)pinkColor -{ - return [[self class] colorWithR:255 G:95 B:154 A:1.0]; -} - -+ (instancetype)indianRedColor -{ - return [[self class] colorWithR:205 G:92 B:92 A:1.0]; -} - -+ (instancetype)strawberryColor -{ - return [[self class] colorWithR:190 G:38 B:37 A:1.0]; -} - -+ (instancetype)coralColor -{ - return [[self class] colorWithR:240 G:128 B:128 A:1.0]; -} - -+ (instancetype)maroonColor -{ - return [[self class] colorWithR:80 G:4 B:28 A:1.0]; -} - -+ (instancetype)watermelonColor -{ - return [[self class] colorWithR:242 G:71 B:63 A:1.0]; -} - -+ (instancetype)tomatoColor -{ - return [[self class] colorWithR:255 G:99 B:71 A:1.0]; -} - -+ (instancetype)pinkLipstickColor -{ - return [[self class] colorWithR:255 G:105 B:180 A:1.0]; -} - -+ (instancetype)paleRoseColor -{ - return [[self class] colorWithR:255 G:228 B:225 A:1.0]; -} - -+ (instancetype)crimsonColor -{ - return [[self class] colorWithR:187 G:18 B:36 A:1.0]; -} - - -#pragma mark - Purples -+ (instancetype)eggplantColor -{ - return [[self class] colorWithR:105 G:5 B:98 A:1.0]; -} - -+ (instancetype)pastelPurpleColor -{ - return [[self class] colorWithR:207 G:100 B:235 A:1.0]; -} - -+ (instancetype)palePurpleColor -{ - return [[self class] colorWithR:229 G:180 B:235 A:1.0]; -} - -+ (instancetype)coolPurpleColor -{ - return [[self class] colorWithR:140 G:93 B:228 A:1.0]; -} - -+ (instancetype)violetColor -{ - return [[self class] colorWithR:191 G:95 B:255 A:1.0]; -} - -+ (instancetype)plumColor -{ - return [[self class] colorWithR:139 G:102 B:139 A:1.0]; -} - -+ (instancetype)lavenderColor -{ - return [[self class] colorWithR:204 G:153 B:204 A:1.0]; -} - -+ (instancetype)raspberryColor -{ - return [[self class] colorWithR:135 G:38 B:87 A:1.0]; -} - -+ (instancetype)fuschiaColor -{ - return [[self class] colorWithR:255 G:20 B:147 A:1.0]; -} - -+ (instancetype)grapeColor -{ - return [[self class] colorWithR:54 G:11 B:88 A:1.0]; -} - -+ (instancetype)periwinkleColor -{ - return [[self class] colorWithR:135 G:159 B:237 A:1.0]; -} - -+ (instancetype)orchidColor -{ - return [[self class] colorWithR:218 G:112 B:214 A:1.0]; -} - - -#pragma mark - Yellows -+ (instancetype)goldenrodColor -{ - return [[self class] colorWithR:215 G:170 B:51 A:1.0]; -} - -+ (instancetype)yellowGreenColor -{ - return [[self class] colorWithR:192 G:242 B:39 A:1.0]; -} - -+ (instancetype)bananaColor -{ - return [[self class] colorWithR:229 G:227 B:58 A:1.0]; -} - -+ (instancetype)mustardColor -{ - return [[self class] colorWithR:205 G:171 B:45 A:1.0]; -} - -+ (instancetype)buttermilkColor -{ - return [[self class] colorWithR:254 G:241 B:181 A:1.0]; -} - -+ (instancetype)goldColor -{ - return [[self class] colorWithR:139 G:117 B:18 A:1.0]; -} - -+ (instancetype)creamColor -{ - return [[self class] colorWithR:240 G:226 B:187 A:1.0]; -} - -+ (instancetype)lightCreamColor -{ - return [[self class] colorWithR:240 G:238 B:215 A:1.0]; -} - -+ (instancetype)wheatColor -{ - return [[self class] colorWithR:240 G:238 B:215 A:1.0]; -} - -+ (instancetype)beigeColor -{ - return [[self class] colorWithR:245 G:245 B:220 A:1.0]; -} - - -#pragma mark - Oranges -+ (instancetype)peachColor -{ - return [[self class] colorWithR:242 G:187 B:97 A:1.0]; -} - -+ (instancetype)burntOrangeColor -{ - return [[self class] colorWithR:184 G:102 B:37 A:1.0]; -} - -+ (instancetype)pastelOrangeColor -{ - return [[self class] colorWithR:248 G:197 B:143 A:1.0]; -} - -+ (instancetype)cantaloupeColor -{ - return [[self class] colorWithR:250 G:154 B:79 A:1.0]; -} - -+ (instancetype)carrotColor -{ - return [[self class] colorWithR:237 G:145 B:33 A:1.0]; -} - -+ (instancetype)mandarinColor -{ - return [[self class] colorWithR:247 G:145 B:55 A:1.0]; -} - - -#pragma mark - Browns -+ (instancetype)chiliPowderColor -{ - return [[self class] colorWithR:199 G:63 B:23 A:1.0]; -} - -+ (instancetype)burntSiennaColor -{ - return [[self class] colorWithR:138 G:54 B:15 A:1.0]; -} - -+ (instancetype)chocolateColor -{ - return [[self class] colorWithR:94 G:38 B:5 A:1.0]; -} - -+ (instancetype)coffeeColor -{ - return [[self class] colorWithR:141 G:60 B:15 A:1.0]; -} - -+ (instancetype)cinnamonColor -{ - return [[self class] colorWithR:123 G:63 B:9 A:1.0]; -} - -+ (instancetype)almondColor -{ - return [[self class] colorWithR:196 G:142 B:72 A:1.0]; -} - -+ (instancetype)eggshellColor -{ - return [[self class] colorWithR:252 G:230 B:201 A:1.0]; -} - -+ (instancetype)sandColor -{ - return [[self class] colorWithR:222 G:182 B:151 A:1.0]; -} - -+ (instancetype)mudColor -{ - return [[self class] colorWithR:70 G:45 B:29 A:1.0]; -} - -+ (instancetype)siennaColor -{ - return [[self class] colorWithR:160 G:82 B:45 A:1.0]; -} - -+ (instancetype)dustColor -{ - return [[self class] colorWithR:236 G:214 B:197 A:1.0]; -} - - -#pragma mark - Private - - -#pragma mark - RGBA Helper method -+ (instancetype)colorWithR:(CGFloat)red G:(CGFloat)green B:(CGFloat)blue A:(CGFloat)alpha -{ - return [[self class] colorWithRed:red/255.0f green:green/255.0f blue:blue/255.0f alpha:alpha]; -} - - -#pragma mark - Degrees Helper method for Color Schemes -+ (float)addDegrees:(float)addDeg toDegree:(float)staticDeg -{ - staticDeg += addDeg; - if (staticDeg > 360) { - float offset = staticDeg - 360; - return offset; - } - else if (staticDeg < 0) { - return -1 * staticDeg; - } - else { - return staticDeg; - } -} - -- (CGFloat)radiansFromDegree:(CGFloat)degree { - return degree * M_PI/180; -} - - -#pragma mark - Swizzle - - -#pragma mark - On Load - Flip methods -+ (void)load { - static dispatch_once_t onceToken; - dispatch_once(&onceToken, ^{ - Class class = [self class]; - SEL rgbaSelector = @selector(getRed:green:blue:alpha:); - SEL swizzledRGBASelector = @selector(colours_getRed:green:blue:alpha:); - SEL hsbaSelector = @selector(getHue:saturation:brightness:alpha:); - SEL swizzledHSBASelector = @selector(colours_getHue:saturation:brightness:alpha:); - Method rgbaMethod = class_getInstanceMethod(class, rgbaSelector); - Method swizzledRGBAMethod = class_getInstanceMethod(class, swizzledRGBASelector); - Method hsbaMethod = class_getInstanceMethod(class, hsbaSelector); - Method swizzledHSBAMethod = class_getInstanceMethod(class, swizzledHSBASelector); - - // Attempt adding the methods - BOOL didAddRGBAMethod = - class_addMethod(class, - rgbaSelector, - method_getImplementation(swizzledRGBAMethod), - method_getTypeEncoding(swizzledRGBAMethod)); - - BOOL didAddHSBAMethod = - class_addMethod(class, - hsbaSelector, - method_getImplementation(swizzledHSBAMethod), - method_getTypeEncoding(swizzledHSBAMethod)); - - // Replace methods - if (didAddRGBAMethod) { - class_replaceMethod(class, - swizzledRGBASelector, - method_getImplementation(swizzledRGBAMethod), - method_getTypeEncoding(swizzledRGBAMethod)); - } else { - method_exchangeImplementations(rgbaMethod, swizzledRGBAMethod); - } - - if (didAddHSBAMethod) { - class_replaceMethod(class, - swizzledHSBASelector, - method_getImplementation(swizzledHSBAMethod), - method_getTypeEncoding(swizzledHSBAMethod)); - } else { - method_exchangeImplementations(hsbaMethod, swizzledHSBAMethod); - } - }); -} - - -#pragma mark - Swizzled Methods -- (BOOL)colours_getRed:(CGFloat *)red green:(CGFloat *)green blue:(CGFloat *)blue alpha:(CGFloat *)alpha -{ - if (CGColorGetNumberOfComponents(self.CGColor) == 4) { - return [self colours_getRed:red green:green blue:blue alpha:alpha]; - } - else if (CGColorGetNumberOfComponents(self.CGColor) == 2) { - CGFloat white; - CGFloat m_alpha; - if ([self getWhite:&white alpha:&m_alpha]) { - *red = white * 1.0; - *green = white * 1.0; - *blue = white * 1.0; - *alpha = m_alpha; - return YES; - } - } - - return NO; -} - - -- (BOOL)colours_getHue:(CGFloat *)hue saturation:(CGFloat *)saturation brightness:(CGFloat *)brightness alpha:(CGFloat *)alpha -{ - if (CGColorGetNumberOfComponents(self.CGColor) == 4) { - return [self colours_getHue:hue saturation:saturation brightness:brightness alpha:alpha]; - } - else if (CGColorGetNumberOfComponents(self.CGColor) == 2) { - CGFloat white = 0; - CGFloat a = 0; - if ([self getWhite:&white alpha:&a]) { - *hue = 0; - *saturation = 0; - *brightness = white * 1.0; - *alpha = a * 1.0; - - return YES; - } - } - - return NO; -} - - -@end diff --git a/DateTools/Examples/DateToolsExample/DateToolsExample/DateToolsExample-Info.plist b/DateTools/Examples/DateToolsExample/DateToolsExample/DateToolsExample-Info.plist deleted file mode 100644 index 3eb70251..00000000 --- a/DateTools/Examples/DateToolsExample/DateToolsExample/DateToolsExample-Info.plist +++ /dev/null @@ -1,36 +0,0 @@ - - - - - CFBundleDevelopmentRegion - en - CFBundleDisplayName - ${PRODUCT_NAME} - CFBundleExecutable - ${EXECUTABLE_NAME} - CFBundleIdentifier - $(PRODUCT_BUNDLE_IDENTIFIER) - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - ${PRODUCT_NAME} - CFBundlePackageType - APPL - CFBundleShortVersionString - 1.0 - CFBundleSignature - ???? - CFBundleVersion - 1.0 - LSRequiresIPhoneOS - - UIRequiredDeviceCapabilities - - armv7 - - UISupportedInterfaceOrientations - - UIInterfaceOrientationPortrait - - - diff --git a/DateTools/Examples/DateToolsExample/DateToolsExample/DateToolsExample-Prefix.pch b/DateTools/Examples/DateToolsExample/DateToolsExample/DateToolsExample-Prefix.pch deleted file mode 100644 index 82a2bb45..00000000 --- a/DateTools/Examples/DateToolsExample/DateToolsExample/DateToolsExample-Prefix.pch +++ /dev/null @@ -1,16 +0,0 @@ -// -// Prefix header -// -// The contents of this file are implicitly included at the beginning of every source file. -// - -#import - -#ifndef __IPHONE_5_0 -#warning "This project uses features only available in iOS SDK 5.0 and later." -#endif - -#ifdef __OBJC__ - #import - #import -#endif diff --git a/DateTools/Examples/DateToolsExample/DateToolsExample/DateToolsViewController.h b/DateTools/Examples/DateToolsExample/DateToolsExample/DateToolsViewController.h deleted file mode 100644 index 553a4a9b..00000000 --- a/DateTools/Examples/DateToolsExample/DateToolsExample/DateToolsViewController.h +++ /dev/null @@ -1,13 +0,0 @@ -// -// DateToolsViewController.h -// DateToolsExample -// -// Created by Matthew York on 3/22/14. -// -// - -#import - -@interface DateToolsViewController : UIViewController - -@end diff --git a/DateTools/Examples/DateToolsExample/DateToolsExample/DateToolsViewController.m b/DateTools/Examples/DateToolsExample/DateToolsExample/DateToolsViewController.m deleted file mode 100644 index 9751534b..00000000 --- a/DateTools/Examples/DateToolsExample/DateToolsExample/DateToolsViewController.m +++ /dev/null @@ -1,123 +0,0 @@ -// -// DateToolsViewController.m -// DateToolsExample -// -// Created by Matthew York on 3/22/14. -// -// - -#import "DateToolsViewController.h" -#import "NSDate+DateTools.h" -#import "Colours.h" - -@interface DateToolsViewController () -@property (weak, nonatomic) IBOutlet UIScrollView *MasterScrollView; -@property NSTimer *updateTimer; -@property NSDate *selectedDate; -@property NSDateFormatter *formatter; - -//Time Ago View -@property (strong, nonatomic) IBOutlet UIView *TimeAgoView; -@property (weak, nonatomic) IBOutlet UILabel *TimeAgoLabel; -@property (weak, nonatomic) IBOutlet UISlider *TimeAgoSlider; -@property (weak, nonatomic) IBOutlet UILabel *SecondsLabel; -@property (weak, nonatomic) IBOutlet UILabel *MinutesLabel; -@property (weak, nonatomic) IBOutlet UILabel *HoursLabel; -@property (weak, nonatomic) IBOutlet UILabel *DaysLabel; -@property (weak, nonatomic) IBOutlet UILabel *WeeksLabel; -@property (weak, nonatomic) IBOutlet UILabel *MonthsLabel; -@property (weak, nonatomic) IBOutlet UILabel *YearsLabel; - -@end - -@implementation DateToolsViewController - -- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil -{ - self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]; - if (self) { - // Custom initialization - self.title = @"NSDate+DateTools"; - self.tabBarItem.title = @"NSDate+DateTools"; - self.tabBarItem.image = [UIImage imageNamed:@"Calendar"]; - self.tabBarItem.selectedImage = [UIImage imageNamed:@"Calendar_filled"]; - } - return self; -} - -- (void)viewDidLoad -{ - [super viewDidLoad]; - - //Setup date formatter - self.formatter = [[NSDateFormatter alloc] init]; - [self.formatter setDateFormat:@"HHmm MMMM d yyyy"]; - - - - // <<<<<<<<<<<<<<<<<<<<<<< - self.selectedDate = [NSDate dateWithTimeIntervalSinceNow:-24*60*60*6+100]; - NSString *week = [NSDate weekTimeAgoSinceDate:self.selectedDate]; - NSLog(@"Week:%@", week); - // >>>>>>>>>>>>>>>>>>>>>>> - - - //Set initial date - self.selectedDate = [self.formatter dateFromString:@"0000 November 5 1605"]; - self.TimeAgoSlider.value = [self.selectedDate timeIntervalSinceNow]; - - //Set up timer for updating UI - self.updateTimer = [NSTimer timerWithTimeInterval:1.0 target:self selector:@selector(updateTimeAgoLabels) userInfo:nil repeats:YES]; - [[NSRunLoop mainRunLoop] addTimer:self.updateTimer forMode:NSRunLoopCommonModes]; - - [self setupViews]; - [self updateTimeAgoLabels]; -} - -- (void)didReceiveMemoryWarning -{ - [super didReceiveMemoryWarning]; - // Dispose of any resources that can be recreated. -} - --(void)setupViews{ - [self.MasterScrollView addSubview:self.TimeAgoView]; - [self.MasterScrollView setContentSize:self.TimeAgoView.frame.size]; - - self.SecondsLabel.textColor = [UIColor tealColor]; - self.MinutesLabel.textColor = [UIColor moneyGreenColor]; - self.HoursLabel.textColor = [UIColor salmonColor]; - self.DaysLabel.textColor = [UIColor violetColor]; - self.WeeksLabel.textColor = [UIColor tealColor]; - self.MonthsLabel.textColor = [UIColor waveColor]; - self.YearsLabel.textColor = [UIColor bananaColor]; -} - -#pragma mark - Update --(void)updateTimeAgoLabels{ - //Account for now - if (self.TimeAgoSlider.value == 0) { - self.selectedDate = [NSDate date]; - } - - //Set time ago label - self.TimeAgoLabel.text = [self.formatter stringFromDate:self.selectedDate]; - - //Set date component labels - self.SecondsLabel.text = [NSString stringWithFormat:@"%.0f", self.selectedDate.secondsAgo]; - self.MinutesLabel.text = [NSString stringWithFormat:@"%.0f", self.selectedDate.minutesAgo]; - self.HoursLabel.text = [NSString stringWithFormat:@"%.0f", self.selectedDate.hoursAgo]; - self.DaysLabel.text = [NSString stringWithFormat:@"%ld", (long)self.selectedDate.daysAgo]; - self.WeeksLabel.text = [NSString stringWithFormat:@"%ld", (long)self.selectedDate.weeksAgo]; - self.MonthsLabel.text = [NSString stringWithFormat:@"%ld", (long)self.selectedDate.monthsAgo]; - self.YearsLabel.text = [NSString stringWithFormat:@"%ld", (long)self.selectedDate.yearsAgo]; -} - -- (IBAction)sliderValueDidChange:(UISlider *)sender { - self.selectedDate = [NSDate dateWithTimeIntervalSinceNow:sender.value]; - - //Update UI - [self updateTimeAgoLabels]; -} - -@end diff --git a/DateTools/Examples/DateToolsExample/DateToolsExample/DateToolsViewController.xib b/DateTools/Examples/DateToolsExample/DateToolsExample/DateToolsViewController.xib deleted file mode 100644 index 545bbc19..00000000 --- a/DateTools/Examples/DateToolsExample/DateToolsExample/DateToolsViewController.xib +++ /dev/null @@ -1,157 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/DateTools/Examples/DateToolsExample/DateToolsExample/ExampleNavigationController.h b/DateTools/Examples/DateToolsExample/DateToolsExample/ExampleNavigationController.h deleted file mode 100644 index 44b31fb2..00000000 --- a/DateTools/Examples/DateToolsExample/DateToolsExample/ExampleNavigationController.h +++ /dev/null @@ -1,13 +0,0 @@ -// -// ExampleNavigationController.h -// DateToolsExample -// -// Created by Matthew York on 3/22/14. -// -// - -#import - -@interface ExampleNavigationController : UINavigationController - -@end diff --git a/DateTools/Examples/DateToolsExample/DateToolsExample/ExampleNavigationController.m b/DateTools/Examples/DateToolsExample/DateToolsExample/ExampleNavigationController.m deleted file mode 100644 index ffd2719c..00000000 --- a/DateTools/Examples/DateToolsExample/DateToolsExample/ExampleNavigationController.m +++ /dev/null @@ -1,50 +0,0 @@ -// -// ExampleNavigationController.m -// DateToolsExample -// -// Created by Matthew York on 3/22/14. -// -// - -#import "ExampleNavigationController.h" -#import "Colours.h" - -@interface ExampleNavigationController () - -@end - -@implementation ExampleNavigationController - -- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil -{ - self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]; - if (self) { - // Custom initialization - } - return self; -} - -- (void)viewDidLoad -{ - [super viewDidLoad]; - // Do any additional setup after loading the view. - - if ([self.navigationBar respondsToSelector:@selector(setTranslucent:)]) { - self.navigationBar.translucent = NO; - self.navigationBar.barTintColor = [UIColor infoBlueColor]; - self.navigationBar.titleTextAttributes = @{NSForegroundColorAttributeName: [UIColor whiteColor], NSFontAttributeName: [UIFont fontWithName:@"HelveticaNeue-Light" size:21.0]}; - [[UIBarButtonItem appearance] setTintColor:[UIColor whiteColor]]; - } -} - -- (void)didReceiveMemoryWarning -{ - [super didReceiveMemoryWarning]; - // Dispose of any resources that can be recreated. -} - --(UIStatusBarStyle)preferredStatusBarStyle{ - return UIStatusBarStyleLightContent; -} - -@end diff --git a/DateTools/Examples/DateToolsExample/DateToolsExample/Images.xcassets/AppIcon.appiconset/Contents.json b/DateTools/Examples/DateToolsExample/DateToolsExample/Images.xcassets/AppIcon.appiconset/Contents.json deleted file mode 100644 index a396706d..00000000 --- a/DateTools/Examples/DateToolsExample/DateToolsExample/Images.xcassets/AppIcon.appiconset/Contents.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "images" : [ - { - "idiom" : "iphone", - "size" : "29x29", - "scale" : "2x" - }, - { - "idiom" : "iphone", - "size" : "40x40", - "scale" : "2x" - }, - { - "idiom" : "iphone", - "size" : "60x60", - "scale" : "2x" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/DateTools/Examples/DateToolsExample/DateToolsExample/Images.xcassets/LaunchImage.launchimage/Contents.json b/DateTools/Examples/DateToolsExample/DateToolsExample/Images.xcassets/LaunchImage.launchimage/Contents.json deleted file mode 100644 index c79ebd3a..00000000 --- a/DateTools/Examples/DateToolsExample/DateToolsExample/Images.xcassets/LaunchImage.launchimage/Contents.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "images" : [ - { - "orientation" : "portrait", - "idiom" : "iphone", - "extent" : "full-screen", - "minimum-system-version" : "7.0", - "scale" : "2x" - }, - { - "orientation" : "portrait", - "idiom" : "iphone", - "subtype" : "retina4", - "extent" : "full-screen", - "minimum-system-version" : "7.0", - "scale" : "2x" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/DateTools/Examples/DateToolsExample/DateToolsExample/Recents.png b/DateTools/Examples/DateToolsExample/DateToolsExample/Recents.png deleted file mode 100755 index cf27e7ec9884072994024556765e06de3f454801..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1452 zcmah}eQeZZ7%wQxw#e8FW}6G47KF|1t{->p+PWLuUGLn&;>COj016yC=Q9)5;0k#0=k)iLGbPEZtM?&P1^VA z)93d*zvrt1%}r0OEPS*OL6DW92B8I>W%iw)2cI)Z&kcB#TY+|~)#$X6q6rYMY(xMW z(!?le0ixXV(gdhOkO%%$+S;x5a3e1nnp3oGoGC2^(FjtvDHRi?E?}V%5LI*!c5VD5 zhAOfL+fIjxaLf;OC=I zW=yOu54J$6J=~1?4HKZWlW<4`L!yk^NxBKn&DEe3K@vDg;Y6*2BzU@(CrC7VVKAC0 zck(SlFdGZLd9WRp72|O{nM^v9E~jBeagyUWoS<-uazG15yhpdhltYiN%Xtt$Tr!oI zr5HMDdlVx^!t!8{=|T!xEF4~RtjDv3f+fRKVhksp1g>dzUK#7S)dKF)xTkfzttSTX z77#ZQrUd)Zxh@BWwYz_yoS`f&+Qky4n#og^aG(MW=vEw(A~TF2bAGF-zy^w{U`Pr3 zYe?{5iG(8av_KIoN4YtdFDUp(k|W(-mgWe-MbZT8XYF9NgQY;Iamo-Y1Q}BBy9JtM zS&|I6ScdU(L4synet{r3Zw?#Mi3lQbBeyy{eU!RK=bSUKRByEQ3P^onk_@u=?gk=7lE1)I=3+ z0?9_P2M!)eP<6OHhN=S58EL^0zQlb-y<~24mT(ztad8Xb%iXD?{4Z+^&g6y7(RA0%>eB{=^$5*7lTgIE= zr=OYlhv`_(zB)qA=kFP+cG$J6OFdj0vi@3-H$`umCb?xQmk zuGm!1P;l+JA9lCD_TXUj>jQU=m-c_Lrii?@v9f$Fovu2?KKFM1mJ9pBvkmVIz4zJZ zw@;LItad%Jp|fh2P!O43QBb_$^x$bn&Dz%AJY~!Fm-VCPi|OtvUm;l`o(-4gpNw3L z{QY^c_i?6X%Jla~C+j+nG>+e%eE-SPSI%|3`*V5?-p?F-IPY-zO!Ze|XRB9%k)hc` z13ka4pC933MR)RwLf!5|2e0%UJ23r=`{l{=tNy+GSM`_3)|+FAH@@5bhyDKy1)7AT Iz881>2WyA)Z2$lO diff --git a/DateTools/Examples/DateToolsExample/DateToolsExample/Recents@2x.png b/DateTools/Examples/DateToolsExample/DateToolsExample/Recents@2x.png deleted file mode 100755 index d77e1d9c6f230377dbeb1adc95c3106d88a5635a..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1654 zcmah~c~BEq7~c>)z@iu(Z=GeSXC>LqCSkJ@z+4gpiVzEUl_gmuhGgSrAtBn4LueQU zBx0c!P^zu9bsX^Oh!z7q)EPl+g=$C8!I4@lLY1mO$999D{^8i&*?sSQ^ZkC`J+Ck} zW|g1s9A5wc{4^2DICh0S-^B6kKf!D8V|JO%s1liYDwVMjGzqNKQz;~ak~r};le6U^02)8qu~gapWsE-l%QW zW?4u<9BHL8XdPRR)W9(?o4dCg@+h+2;P2B0wkSlplG0_ENHe2R%Akx4gB}+vg)k-+ zilnGqt&}5(6cMeOy^B4QX*U}FTY16fMGp2fn!s0c+BLNTURBZvycV39k_Uh(|p&c@d(L zqz##*UQJUba3ra?;SF{X6jO**DpZY$F%^m+7~4P!jEz+&S0Hk=3L3@gUrW?jyom6B zumaW@fu|#0>yR-K+jgGq%YJ7MFDHgHvtvTD^I$LO9{>QaI*oFr*8bbAb-kv$@H=aF z4&P>S9eGTigMI6{-mRuRep^89^$vH3`zF}ouDav$q05GE@Q#xgTgs<<%0N{i_+E#JUh}5c&27e>!pjX*-?Od zX02p3=bPih*~!mk-HW>xuh@ZY=Hi zs$|9zImsPI^*H5tb+UhZsjK*DLzbf?|HI^cORKNdHLh>mUwVC9$6Zj{}6x=4zc!Sf}@&YHul?8t`{c)Y`rY37Fwxfw=s{_6a`R zbhB5)KIx|Bg^j@xv(9(B?+*Y}W!Hwenc)Rpf0mu*xx@5L$dP}hb?)`4eg4QT-`Ub0 zJmA*PNxU%8x#h&8rOdn<{pyN}?+)f~)1nO_`=U}(y*3=Y$ML_kFx4-?(tUHNc)_d( zyY+R(HNTcGn@1e0d$)G7)4h)8yt9AplKbP@oj%%SAxA5+eJjHMExckIM89l!TIg=G zgLC$97F8#g+~BtPdo9pZ$v(|?iO=*wwe8-|sKHS10ooqNb8?~njThQJ3ZO5CX%ENW zelKnyzV{lfNTj4iGm7$xuDT+x)NhS|IsP#3{j)}XMVeXs*=x@ z?3jX=5}X#`Nm5nQ+{BZv`XP7UJx&dHYuCe1zW+g<|Kw;6H{xsg@Qp)xQOEfGXPb9$ Z#sl_(!YleT3CD92XjC!EK(cXDpPg}%I)8xH2Hh-?k zd%J5bICMn|LzK={@PjJ|ei3mWijz&8xJ_kRHW8FbN39d3e%OYEtsuoW*SoGC#tbCy zlPAybd4A8oOy+Y>g|KX-2Xh9o!m=vfp!py~|T?02zHDyPu_+K+} zf~-^wUF2kj<^?7yu#zH600qd z``2IyUE>hc71yzddILn`E^(8L90gH^=b{{+W&z-pn3QH1DHc~~h2tc$fz>w@s+n&R z{12AGWOPkL1~Oq|GLt51NT%UWhiIzyATC2#hb6UQBC;#r6MHe|xRz=XIauvcNAchh zG}B4>V`v%}U6uwDIz~cuTG0bKCHS-^|F#V(rSA z=Prj{C$>*?Z#g;jQ)ns3AD(>w*twRaAllrKnLpC?y>ay2Us~s;U$`B(`ul;oj@erW z&tIy{Ki)m@#E$c&SLC+f&(R;AyfAaCb>H~cKVE_8o2s3>A#8V%PSu{{JnL&dHxh HFTM63$aT($ diff --git a/DateTools/Examples/DateToolsExample/DateToolsExample/Recents_filled@2x.png b/DateTools/Examples/DateToolsExample/DateToolsExample/Recents_filled@2x.png deleted file mode 100755 index eefedf84ce850f6d053d9bc3a26be0f89482b529..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1600 zcmah}du$VR9KVhMW1}(dd5EWEFd<4Q{)2I-6$RHwWP>h?=A&dZV7>jqM9s7geC3nB?eee7E zem~#Wy&1B7y1_Z;iiYwVz~>l7+A(N+}KmATw}O;Dcc*YDE%$DMeP*C;}%; z9x0!v5_X6ZfQ>q=(2tpL*ksV*28=Y23t$4nF%&0Itf&yjC}Rl;pU*sL<@uAyp#tTg#8j1 zk~uL5s~(vKF(O+Lh3UN%gpkKG;y4&i7D_1@8f8K#uES74Q1ePyhvh18pT+~N!!^wz zfL4L97?J!+KLU9vuu{8+2TB>T{t>%SMB)>9vVIisKmb8GtdPPJj1=b7Vu@24$ndo2 zkEmbWv=xa&IF>Tf1ZE})1F5&WXgiLRxWQ&Nk{GSWjhNYCR)eVyMgtX%j#aQYS)_Lr zIbB9`krT(AdeTAK?KnozdctgXnv5x|I~bOkpdY9~RV;TO>wGAda!7!YMX5#<`P8Vm zc|H=BB~=YOs`YCBk_>^wJquWuBnoh%0TlOuxTK3V;0D5MG#JfJJ&v1QCcBd$?4}|Y z<}w=XND|AADpV?8()mAFR3XFqDVdXbkeo~#FDE6QQ>TOCnP8(*hC&tumM{w(Y0-B&I}ZvHrbw)WtKav&9^c55F>e0u{ZRH|{8DSLD_@wm^Al)J{EP01dGXl3$!_1*Z=F8%-kjl_ zql4q%#n<<@pZP28Z|D5i7L|YAbLZqQhmSzd_r$aX8`h`K+?sW~ee0L&j~3W}+G0Ag zX@H%$_ZHkx`y|v^kb8I2XH)9QMZ0p>GRKDk=?7leiw&9<{rU2lK9R##y!o$V_%OwjDeU4GmV zi^ogStcdT!?_Rt)^I}&2vF#mg@2}L<52bn6y#3>a*37~3jZ4qXIs*(j<~z;9#VgY@ zu^i3C&D~vD-F@4*!9`s=;M|-WH|Baj&N;AVN7?rIlWK1ZwY&N(n=aQcIMi};=gg}& zifeDrvf9Q4OFr#;?$|1p&~*1_O}D(U!6HoC_B5NZ%o2(mIC`bN zZ}(8=loR?HzZWyD-z=T*=hCY9mKEAy#<#PtHf}6#=r{CUGp$IQ2o0S6>at1fIH>;9 N-A*t4fqmt={{T3}G - -@interface TimePeriodsViewController : UIViewController - -@end diff --git a/DateTools/Examples/DateToolsExample/DateToolsExample/TimePeriodsViewController.m b/DateTools/Examples/DateToolsExample/DateToolsExample/TimePeriodsViewController.m deleted file mode 100644 index 10bd24a3..00000000 --- a/DateTools/Examples/DateToolsExample/DateToolsExample/TimePeriodsViewController.m +++ /dev/null @@ -1,188 +0,0 @@ -// -// TimePeriodsViewController.m -// DateToolsExample -// -// Created by Matthew York on 3/22/14. -// -// - -#import "TimePeriodsViewController.h" -#import "DTTimePeriod.h" - -@interface TimePeriodsViewController () -@property (weak, nonatomic) IBOutlet UIView *AView; -@property (weak, nonatomic) IBOutlet UIView *BView; -@property (weak, nonatomic) IBOutlet UIView *CView; - -//Relationships -@property (weak, nonatomic) IBOutlet UILabel *ABRelationship; -@property (weak, nonatomic) IBOutlet UILabel *ACRelationship; -@property (weak, nonatomic) IBOutlet UILabel *BARelationship; -@property (weak, nonatomic) IBOutlet UILabel *BCRelationship; -@property (weak, nonatomic) IBOutlet UILabel *CARelationship; -@property (weak, nonatomic) IBOutlet UILabel *CBRelationship; - -@end - -@implementation TimePeriodsViewController - -- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil -{ - self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]; - if (self) { - // Custom initialization - // Custom initialization - self.title = @"Time Periods"; - self.tabBarItem.title = @"Time Periods"; - self.tabBarItem.image = [UIImage imageNamed:@"Recents"]; - self.tabBarItem.selectedImage = [UIImage imageNamed:@"Recents_filled"]; - } - return self; -} - -- (void)viewDidLoad -{ - [super viewDidLoad]; - // Do any additional setup after loading the view from its nib. - - //Setup pan recognizers - UIPanGestureRecognizer *recognizerA = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(handlePan:)]; - [recognizerA setMaximumNumberOfTouches:1]; - [recognizerA setMinimumNumberOfTouches:1]; - [self.AView addGestureRecognizer:recognizerA]; - - UIPanGestureRecognizer *recognizerB = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(handlePan:)]; - [recognizerB setMaximumNumberOfTouches:1]; - [recognizerB setMinimumNumberOfTouches:1]; - [self.BView addGestureRecognizer:recognizerB]; - - UIPanGestureRecognizer *recognizerC = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(handlePan:)]; - [recognizerC setMaximumNumberOfTouches:1]; - [recognizerC setMinimumNumberOfTouches:1]; - [self.CView addGestureRecognizer:recognizerC]; - - //Set initial relationships - [self updateRelationships]; - - //Set up info button for alert - [self.navigationItem setRightBarButtonItem:[[UIBarButtonItem alloc] initWithTitle:@"Info" style:UIBarButtonItemStyleBordered target:self action:@selector(showInfo)]]; -} - --(void)showInfo{ - [[[UIAlertView alloc] initWithTitle:@"Legend" message:@"Ins. - Inside\nEnc. - Enclosing\n\nFor more information on the various DTTimePeriod relationships, please see the DateTools README on GitHub." delegate:nil cancelButtonTitle:@"OK" otherButtonTitles: nil] show]; -} - -- (void)didReceiveMemoryWarning -{ - [super didReceiveMemoryWarning]; - // Dispose of any resources that can be recreated. -} - -#pragma mark - Pan Recognizers - - -- (IBAction)handlePan:(UIPanGestureRecognizer *)recognizer { - - CGPoint translation = [recognizer translationInView:self.view]; - recognizer.view.frame = CGRectMake(MAX(10, MIN((self.view.frame.size.width-recognizer.view.frame.size.width - 10), recognizer.view.frame.origin.x + translation.x)), recognizer.view.frame.origin.y, recognizer.view.frame.size.width, recognizer.view.frame.size.height); - [recognizer setTranslation:CGPointMake(0, 0) inView:self.view]; - - [self updateRelationships]; -} - -#pragma mark - Update - --(void)updateRelationships{ - NSInteger AOffset = -300 + (self.AView.frame.origin.x - 10); - NSInteger BOffset = -300 + (self.BView.frame.origin.x - 10); - NSInteger COffset = -300 + (self.CView.frame.origin.x - 10); - - //AOffset *= 4; - //BOffset *= 4; - //COffset *= 4; - - DTTimePeriod *aPeriod = [DTTimePeriod timePeriodWithStartDate:[NSDate dateWithTimeIntervalSince1970:AOffset] endDate:[NSDate dateWithTimeIntervalSince1970:AOffset+self.AView.frame.size.width]]; - DTTimePeriod *bPeriod = [DTTimePeriod timePeriodWithStartDate:[NSDate dateWithTimeIntervalSince1970:BOffset] endDate:[NSDate dateWithTimeIntervalSince1970:BOffset+self.BView.frame.size.width]]; - DTTimePeriod *cPeriod = [DTTimePeriod timePeriodWithStartDate:[NSDate dateWithTimeIntervalSince1970:COffset] endDate:[NSDate dateWithTimeIntervalSince1970:COffset+self.CView.frame.size.width]]; - - //Set A relationships - self.ABRelationship.text = [self stringForRelation:[aPeriod relationToPeriod:bPeriod] forPeriodName:@"B"]; - self.ACRelationship.text = [self stringForRelation:[aPeriod relationToPeriod:cPeriod] forPeriodName:@"C"]; - - //Set B relationships - self.BARelationship.text = [self stringForRelation:[bPeriod relationToPeriod:aPeriod] forPeriodName:@"A"]; - self.BCRelationship.text = [self stringForRelation:[bPeriod relationToPeriod:cPeriod] forPeriodName:@"C"]; - - //Set C relationships - self.CARelationship.text = [self stringForRelation:[cPeriod relationToPeriod:aPeriod] forPeriodName:@"A"]; - self.CBRelationship.text = [self stringForRelation:[cPeriod relationToPeriod:bPeriod] forPeriodName:@"B"]; - -} - --(NSString *)stringForRelation:(DTTimePeriodRelation)relation forPeriodName:(NSString *)periodName{ - switch (relation) { - case DTTimePeriodRelationAfter: - return [NSString stringWithFormat:@"After %@", periodName]; - - case DTTimePeriodRelationBefore: - return [NSString stringWithFormat:@"Before %@", periodName]; - - case DTTimePeriodRelationEnclosing: - return [NSString stringWithFormat:@"Enclosing %@", periodName]; - - case DTTimePeriodRelationEnclosingEndTouching: - return [NSString stringWithFormat:@"Enc. End Touch %@", periodName]; - - case DTTimePeriodRelationEnclosingStartTouching: - return [NSString stringWithFormat:@"Enc. Start Touch %@", periodName]; - - case DTTimePeriodRelationEndInside: - return [NSString stringWithFormat:@"Ends Inside %@", periodName]; - - case DTTimePeriodRelationEndTouching: - return [NSString stringWithFormat:@"Ends Touching %@", periodName]; - - case DTTimePeriodRelationExactMatch: - return [NSString stringWithFormat:@"Exact Match %@", periodName]; - - case DTTimePeriodRelationInside: - return [NSString stringWithFormat:@"Inside %@", periodName]; - - case DTTimePeriodRelationInsideEndTouching: - return [NSString stringWithFormat:@"Ins. End Touch %@", periodName]; - - case DTTimePeriodRelationInsideStartTouching: - return [NSString stringWithFormat:@"Ins. Start Touch %@", periodName]; - - case DTTimePeriodRelationNone: - return [NSString stringWithFormat:@"No Relation to %@", periodName]; - - case DTTimePeriodRelationStartInside: - return [NSString stringWithFormat:@"Starts Inside %@", periodName]; - - case DTTimePeriodRelationStartTouching: - return [NSString stringWithFormat:@"Starts Touching %@", periodName]; - - default: - break; - } - - typedef NS_ENUM(NSUInteger, DTTimePeriodRelation){ - DTTimePeriodRelationAfter, - DTTimePeriodRelationStartTouching, - DTTimePeriodRelationStartInside, - DTTimePeriodRelationInsideStartTouching, - DTTimePeriodRelationEnclosingStartTouching, - DTTimePeriodRelationEnclosing, - DTTimePeriodRelationEnclosingEndTouching, - DTTimePeriodRelationExactMatch, - DTTimePeriodRelationInside, - DTTimePeriodRelationInsideEndTouching, - DTTimePeriodRelationEndInside, - DTTimePeriodRelationEndTouching, - DTTimePeriodRelationBefore, - DTTimePeriodRelationNone //One or more of the dates does not exist - }; -} - -@end diff --git a/DateTools/Examples/DateToolsExample/DateToolsExample/TimePeriodsViewController.xib b/DateTools/Examples/DateToolsExample/DateToolsExample/TimePeriodsViewController.xib deleted file mode 100644 index 78a1ec6c..00000000 --- a/DateTools/Examples/DateToolsExample/DateToolsExample/TimePeriodsViewController.xib +++ /dev/null @@ -1,162 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/DateTools/Examples/DateToolsExample/DateToolsExample/en.lproj/InfoPlist.strings b/DateTools/Examples/DateToolsExample/DateToolsExample/en.lproj/InfoPlist.strings deleted file mode 100644 index 477b28ff..00000000 --- a/DateTools/Examples/DateToolsExample/DateToolsExample/en.lproj/InfoPlist.strings +++ /dev/null @@ -1,2 +0,0 @@ -/* Localized versions of Info.plist keys */ - diff --git a/DateTools/Examples/DateToolsExample/DateToolsExample/main.m b/DateTools/Examples/DateToolsExample/DateToolsExample/main.m deleted file mode 100644 index 5a5d056d..00000000 --- a/DateTools/Examples/DateToolsExample/DateToolsExample/main.m +++ /dev/null @@ -1,18 +0,0 @@ -// -// main.m -// DateToolsExample -// -// Created by Matthew York on 3/19/14. -// -// - -#import - -#import "AppDelegate.h" - -int main(int argc, char * argv[]) -{ - @autoreleasepool { - return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); - } -} diff --git a/DateTools/Examples/DateToolsExample/DateToolsExampleTests/DateToolsExampleTests-Info.plist b/DateTools/Examples/DateToolsExample/DateToolsExampleTests/DateToolsExampleTests-Info.plist deleted file mode 100644 index 169b6f71..00000000 --- a/DateTools/Examples/DateToolsExample/DateToolsExampleTests/DateToolsExampleTests-Info.plist +++ /dev/null @@ -1,22 +0,0 @@ - - - - - CFBundleDevelopmentRegion - en - CFBundleExecutable - ${EXECUTABLE_NAME} - CFBundleIdentifier - $(PRODUCT_BUNDLE_IDENTIFIER) - CFBundleInfoDictionaryVersion - 6.0 - CFBundlePackageType - BNDL - CFBundleShortVersionString - 1.0 - CFBundleSignature - ???? - CFBundleVersion - 1 - - diff --git a/DateTools/Examples/DateToolsExample/DateToolsExampleTests/en.lproj/InfoPlist.strings b/DateTools/Examples/DateToolsExample/DateToolsExampleTests/en.lproj/InfoPlist.strings deleted file mode 100644 index 477b28ff..00000000 --- a/DateTools/Examples/DateToolsExample/DateToolsExampleTests/en.lproj/InfoPlist.strings +++ /dev/null @@ -1,2 +0,0 @@ -/* Localized versions of Info.plist keys */ - diff --git a/DateTools/Tests/DateToolsTests/DateToolsTests.xcodeproj/project.pbxproj b/DateTools/Tests/DateToolsTests/DateToolsTests.xcodeproj/project.pbxproj deleted file mode 100644 index bf9fd860..00000000 --- a/DateTools/Tests/DateToolsTests/DateToolsTests.xcodeproj/project.pbxproj +++ /dev/null @@ -1,560 +0,0 @@ -// !$*UTF8*$! -{ - archiveVersion = 1; - classes = { - }; - objectVersion = 46; - objects = { - -/* Begin PBXBuildFile section */ - 0AFD486018F08640004D0FE1 /* DTTimeAgoTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 0AFD485F18F08640004D0FE1 /* DTTimeAgoTests.m */; }; - F00762C218DE5D7500A99075 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F00762C118DE5D7500A99075 /* Foundation.framework */; }; - F00762C418DE5D7500A99075 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F00762C318DE5D7500A99075 /* CoreGraphics.framework */; }; - F00762C618DE5D7500A99075 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F00762C518DE5D7500A99075 /* UIKit.framework */; }; - F00762CC18DE5D7500A99075 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = F00762CA18DE5D7500A99075 /* InfoPlist.strings */; }; - F00762CE18DE5D7500A99075 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = F00762CD18DE5D7500A99075 /* main.m */; }; - F00762D218DE5D7500A99075 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = F00762D118DE5D7500A99075 /* AppDelegate.m */; }; - F00762D518DE5D7500A99075 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = F00762D318DE5D7500A99075 /* Main.storyboard */; }; - F00762D818DE5D7500A99075 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = F00762D718DE5D7500A99075 /* ViewController.m */; }; - F00762DA18DE5D7500A99075 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = F00762D918DE5D7500A99075 /* Images.xcassets */; }; - F00762E118DE5D7500A99075 /* XCTest.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F00762E018DE5D7500A99075 /* XCTest.framework */; }; - F00762E218DE5D7500A99075 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F00762C118DE5D7500A99075 /* Foundation.framework */; }; - F00762E318DE5D7500A99075 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F00762C518DE5D7500A99075 /* UIKit.framework */; }; - F00762EB18DE5D7500A99075 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = F00762E918DE5D7500A99075 /* InfoPlist.strings */; }; - F00762FB18DE5D9900A99075 /* DateToolsTests.m in Sources */ = {isa = PBXBuildFile; fileRef = F00762F618DE5D9900A99075 /* DateToolsTests.m */; }; - F00762FC18DE5D9900A99075 /* DTTimePeriodTests.m in Sources */ = {isa = PBXBuildFile; fileRef = F00762F718DE5D9900A99075 /* DTTimePeriodTests.m */; }; - F00762FD18DE5D9900A99075 /* DTTimePeriodGroupTests.m in Sources */ = {isa = PBXBuildFile; fileRef = F00762F818DE5D9900A99075 /* DTTimePeriodGroupTests.m */; }; - F00762FE18DE5D9900A99075 /* DTTimePeriodChainTests.m in Sources */ = {isa = PBXBuildFile; fileRef = F00762F918DE5D9900A99075 /* DTTimePeriodChainTests.m */; }; - F00762FF18DE5D9900A99075 /* DTTimePeriodCollectionTests.m in Sources */ = {isa = PBXBuildFile; fileRef = F00762FA18DE5D9900A99075 /* DTTimePeriodCollectionTests.m */; }; - F0F1CC161E444C6E00677AAB /* DateTools.bundle in Resources */ = {isa = PBXBuildFile; fileRef = F0F1CC061E444C6E00677AAB /* DateTools.bundle */; }; - F0F1CC171E444C6E00677AAB /* DTConstants.m in Sources */ = {isa = PBXBuildFile; fileRef = F0F1CC091E444C6E00677AAB /* DTConstants.m */; }; - F0F1CC181E444C6E00677AAB /* DTError.m in Sources */ = {isa = PBXBuildFile; fileRef = F0F1CC0B1E444C6E00677AAB /* DTError.m */; }; - F0F1CC191E444C6E00677AAB /* DTTimePeriod.m in Sources */ = {isa = PBXBuildFile; fileRef = F0F1CC0D1E444C6E00677AAB /* DTTimePeriod.m */; }; - F0F1CC1A1E444C6E00677AAB /* DTTimePeriodChain.m in Sources */ = {isa = PBXBuildFile; fileRef = F0F1CC0F1E444C6E00677AAB /* DTTimePeriodChain.m */; }; - F0F1CC1B1E444C6E00677AAB /* DTTimePeriodCollection.m in Sources */ = {isa = PBXBuildFile; fileRef = F0F1CC111E444C6E00677AAB /* DTTimePeriodCollection.m */; }; - F0F1CC1C1E444C6E00677AAB /* DTTimePeriodGroup.m in Sources */ = {isa = PBXBuildFile; fileRef = F0F1CC131E444C6E00677AAB /* DTTimePeriodGroup.m */; }; - F0F1CC1D1E444C6E00677AAB /* NSDate+DateTools.m in Sources */ = {isa = PBXBuildFile; fileRef = F0F1CC151E444C6E00677AAB /* NSDate+DateTools.m */; }; -/* End PBXBuildFile section */ - -/* Begin PBXContainerItemProxy section */ - F00762E418DE5D7500A99075 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = F00762B618DE5D7500A99075 /* Project object */; - proxyType = 1; - remoteGlobalIDString = F00762BD18DE5D7500A99075; - remoteInfo = DateToolsTests; - }; -/* End PBXContainerItemProxy section */ - -/* Begin PBXFileReference section */ - 0AFD485F18F08640004D0FE1 /* DTTimeAgoTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DTTimeAgoTests.m; sourceTree = ""; }; - 0AFD486118F0AB99004D0FE1 /* ja */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = ja; path = ja.lproj/Main.strings; sourceTree = ""; }; - 0AFD486218F0AB99004D0FE1 /* ja */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = ja; path = ja.lproj/InfoPlist.strings; sourceTree = ""; }; - 0AFD486318F0AB99004D0FE1 /* ja */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = ja; path = ja.lproj/InfoPlist.strings; sourceTree = ""; }; - F00762BE18DE5D7500A99075 /* DateToolsTests.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = DateToolsTests.app; sourceTree = BUILT_PRODUCTS_DIR; }; - F00762C118DE5D7500A99075 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; - F00762C318DE5D7500A99075 /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; - F00762C518DE5D7500A99075 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; }; - F00762C918DE5D7500A99075 /* DateToolsTests-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "DateToolsTests-Info.plist"; sourceTree = ""; }; - F00762CB18DE5D7500A99075 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; - F00762CD18DE5D7500A99075 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; - F00762CF18DE5D7500A99075 /* DateToolsTests-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "DateToolsTests-Prefix.pch"; sourceTree = ""; }; - F00762D018DE5D7500A99075 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; - F00762D118DE5D7500A99075 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; - F00762D418DE5D7500A99075 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; - F00762D618DE5D7500A99075 /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; - F00762D718DE5D7500A99075 /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; - F00762D918DE5D7500A99075 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; - F00762DF18DE5D7500A99075 /* DateToolsTestsTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = DateToolsTestsTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; - F00762E018DE5D7500A99075 /* XCTest.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = XCTest.framework; path = Library/Frameworks/XCTest.framework; sourceTree = DEVELOPER_DIR; }; - F00762E818DE5D7500A99075 /* DateToolsTestsTests-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "DateToolsTestsTests-Info.plist"; sourceTree = ""; }; - F00762EA18DE5D7500A99075 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; - F00762F618DE5D9900A99075 /* DateToolsTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DateToolsTests.m; sourceTree = ""; }; - F00762F718DE5D9900A99075 /* DTTimePeriodTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DTTimePeriodTests.m; sourceTree = ""; }; - F00762F818DE5D9900A99075 /* DTTimePeriodGroupTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DTTimePeriodGroupTests.m; sourceTree = ""; }; - F00762F918DE5D9900A99075 /* DTTimePeriodChainTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DTTimePeriodChainTests.m; sourceTree = ""; }; - F00762FA18DE5D9900A99075 /* DTTimePeriodCollectionTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DTTimePeriodCollectionTests.m; sourceTree = ""; }; - F022EC1418F44D3700743E17 /* es */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = es; path = es.lproj/Main.strings; sourceTree = ""; }; - F0F1CC061E444C6E00677AAB /* DateTools.bundle */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.plug-in"; name = DateTools.bundle; path = ../../../DateTools/DateTools.bundle; sourceTree = ""; }; - F0F1CC071E444C6E00677AAB /* DateTools.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DateTools.h; path = ../../../DateTools/DateTools.h; sourceTree = ""; }; - F0F1CC081E444C6E00677AAB /* DTConstants.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DTConstants.h; path = ../../../DateTools/DTConstants.h; sourceTree = ""; }; - F0F1CC091E444C6E00677AAB /* DTConstants.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = DTConstants.m; path = ../../../DateTools/DTConstants.m; sourceTree = ""; }; - F0F1CC0A1E444C6E00677AAB /* DTError.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DTError.h; path = ../../../DateTools/DTError.h; sourceTree = ""; }; - F0F1CC0B1E444C6E00677AAB /* DTError.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = DTError.m; path = ../../../DateTools/DTError.m; sourceTree = ""; }; - F0F1CC0C1E444C6E00677AAB /* DTTimePeriod.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DTTimePeriod.h; path = ../../../DateTools/DTTimePeriod.h; sourceTree = ""; }; - F0F1CC0D1E444C6E00677AAB /* DTTimePeriod.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = DTTimePeriod.m; path = ../../../DateTools/DTTimePeriod.m; sourceTree = ""; }; - F0F1CC0E1E444C6E00677AAB /* DTTimePeriodChain.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DTTimePeriodChain.h; path = ../../../DateTools/DTTimePeriodChain.h; sourceTree = ""; }; - F0F1CC0F1E444C6E00677AAB /* DTTimePeriodChain.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = DTTimePeriodChain.m; path = ../../../DateTools/DTTimePeriodChain.m; sourceTree = ""; }; - F0F1CC101E444C6E00677AAB /* DTTimePeriodCollection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DTTimePeriodCollection.h; path = ../../../DateTools/DTTimePeriodCollection.h; sourceTree = ""; }; - F0F1CC111E444C6E00677AAB /* DTTimePeriodCollection.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = DTTimePeriodCollection.m; path = ../../../DateTools/DTTimePeriodCollection.m; sourceTree = ""; }; - F0F1CC121E444C6E00677AAB /* DTTimePeriodGroup.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DTTimePeriodGroup.h; path = ../../../DateTools/DTTimePeriodGroup.h; sourceTree = ""; }; - F0F1CC131E444C6E00677AAB /* DTTimePeriodGroup.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = DTTimePeriodGroup.m; path = ../../../DateTools/DTTimePeriodGroup.m; sourceTree = ""; }; - F0F1CC141E444C6E00677AAB /* NSDate+DateTools.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "NSDate+DateTools.h"; path = "../../../DateTools/NSDate+DateTools.h"; sourceTree = ""; }; - F0F1CC151E444C6E00677AAB /* NSDate+DateTools.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = "NSDate+DateTools.m"; path = "../../../DateTools/NSDate+DateTools.m"; sourceTree = ""; }; -/* End PBXFileReference section */ - -/* Begin PBXFrameworksBuildPhase section */ - F00762BB18DE5D7500A99075 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - F00762C418DE5D7500A99075 /* CoreGraphics.framework in Frameworks */, - F00762C618DE5D7500A99075 /* UIKit.framework in Frameworks */, - F00762C218DE5D7500A99075 /* Foundation.framework in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - F00762DC18DE5D7500A99075 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - F00762E118DE5D7500A99075 /* XCTest.framework in Frameworks */, - F00762E318DE5D7500A99075 /* UIKit.framework in Frameworks */, - F00762E218DE5D7500A99075 /* Foundation.framework in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXFrameworksBuildPhase section */ - -/* Begin PBXGroup section */ - F00762B518DE5D7500A99075 = { - isa = PBXGroup; - children = ( - F00762C718DE5D7500A99075 /* DateToolsTests */, - F00762E618DE5D7500A99075 /* DateToolsTestsTests */, - F00762C018DE5D7500A99075 /* Frameworks */, - F00762BF18DE5D7500A99075 /* Products */, - ); - sourceTree = ""; - }; - F00762BF18DE5D7500A99075 /* Products */ = { - isa = PBXGroup; - children = ( - F00762BE18DE5D7500A99075 /* DateToolsTests.app */, - F00762DF18DE5D7500A99075 /* DateToolsTestsTests.xctest */, - ); - name = Products; - sourceTree = ""; - }; - F00762C018DE5D7500A99075 /* Frameworks */ = { - isa = PBXGroup; - children = ( - F00762C118DE5D7500A99075 /* Foundation.framework */, - F00762C318DE5D7500A99075 /* CoreGraphics.framework */, - F00762C518DE5D7500A99075 /* UIKit.framework */, - F00762E018DE5D7500A99075 /* XCTest.framework */, - ); - name = Frameworks; - sourceTree = ""; - }; - F00762C718DE5D7500A99075 /* DateToolsTests */ = { - isa = PBXGroup; - children = ( - F007630018DE5DB000A99075 /* DateTools */, - F00762D018DE5D7500A99075 /* AppDelegate.h */, - F00762D118DE5D7500A99075 /* AppDelegate.m */, - F00762D318DE5D7500A99075 /* Main.storyboard */, - F00762D618DE5D7500A99075 /* ViewController.h */, - F00762D718DE5D7500A99075 /* ViewController.m */, - F00762D918DE5D7500A99075 /* Images.xcassets */, - F00762C818DE5D7500A99075 /* Supporting Files */, - ); - path = DateToolsTests; - sourceTree = ""; - }; - F00762C818DE5D7500A99075 /* Supporting Files */ = { - isa = PBXGroup; - children = ( - F00762C918DE5D7500A99075 /* DateToolsTests-Info.plist */, - F00762CA18DE5D7500A99075 /* InfoPlist.strings */, - F00762CD18DE5D7500A99075 /* main.m */, - F00762CF18DE5D7500A99075 /* DateToolsTests-Prefix.pch */, - ); - name = "Supporting Files"; - sourceTree = ""; - }; - F00762E618DE5D7500A99075 /* DateToolsTestsTests */ = { - isa = PBXGroup; - children = ( - F00762F618DE5D9900A99075 /* DateToolsTests.m */, - F00762F718DE5D9900A99075 /* DTTimePeriodTests.m */, - F00762F818DE5D9900A99075 /* DTTimePeriodGroupTests.m */, - F00762F918DE5D9900A99075 /* DTTimePeriodChainTests.m */, - F00762FA18DE5D9900A99075 /* DTTimePeriodCollectionTests.m */, - 0AFD485F18F08640004D0FE1 /* DTTimeAgoTests.m */, - F00762E718DE5D7500A99075 /* Supporting Files */, - ); - path = DateToolsTestsTests; - sourceTree = ""; - }; - F00762E718DE5D7500A99075 /* Supporting Files */ = { - isa = PBXGroup; - children = ( - F00762E818DE5D7500A99075 /* DateToolsTestsTests-Info.plist */, - F00762E918DE5D7500A99075 /* InfoPlist.strings */, - ); - name = "Supporting Files"; - sourceTree = ""; - }; - F007630018DE5DB000A99075 /* DateTools */ = { - isa = PBXGroup; - children = ( - F0F1CC061E444C6E00677AAB /* DateTools.bundle */, - F0F1CC071E444C6E00677AAB /* DateTools.h */, - F0F1CC081E444C6E00677AAB /* DTConstants.h */, - F0F1CC091E444C6E00677AAB /* DTConstants.m */, - F0F1CC0A1E444C6E00677AAB /* DTError.h */, - F0F1CC0B1E444C6E00677AAB /* DTError.m */, - F0F1CC0C1E444C6E00677AAB /* DTTimePeriod.h */, - F0F1CC0D1E444C6E00677AAB /* DTTimePeriod.m */, - F0F1CC0E1E444C6E00677AAB /* DTTimePeriodChain.h */, - F0F1CC0F1E444C6E00677AAB /* DTTimePeriodChain.m */, - F0F1CC101E444C6E00677AAB /* DTTimePeriodCollection.h */, - F0F1CC111E444C6E00677AAB /* DTTimePeriodCollection.m */, - F0F1CC121E444C6E00677AAB /* DTTimePeriodGroup.h */, - F0F1CC131E444C6E00677AAB /* DTTimePeriodGroup.m */, - F0F1CC141E444C6E00677AAB /* NSDate+DateTools.h */, - F0F1CC151E444C6E00677AAB /* NSDate+DateTools.m */, - ); - name = DateTools; - sourceTree = ""; - }; -/* End PBXGroup section */ - -/* Begin PBXNativeTarget section */ - F00762BD18DE5D7500A99075 /* DateToolsTests */ = { - isa = PBXNativeTarget; - buildConfigurationList = F00762F018DE5D7500A99075 /* Build configuration list for PBXNativeTarget "DateToolsTests" */; - buildPhases = ( - F00762BA18DE5D7500A99075 /* Sources */, - F00762BB18DE5D7500A99075 /* Frameworks */, - F00762BC18DE5D7500A99075 /* Resources */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = DateToolsTests; - productName = DateToolsTests; - productReference = F00762BE18DE5D7500A99075 /* DateToolsTests.app */; - productType = "com.apple.product-type.application"; - }; - F00762DE18DE5D7500A99075 /* DateToolsTestsTests */ = { - isa = PBXNativeTarget; - buildConfigurationList = F00762F318DE5D7500A99075 /* Build configuration list for PBXNativeTarget "DateToolsTestsTests" */; - buildPhases = ( - F00762DB18DE5D7500A99075 /* Sources */, - F00762DC18DE5D7500A99075 /* Frameworks */, - F00762DD18DE5D7500A99075 /* Resources */, - ); - buildRules = ( - ); - dependencies = ( - F00762E518DE5D7500A99075 /* PBXTargetDependency */, - ); - name = DateToolsTestsTests; - productName = DateToolsTestsTests; - productReference = F00762DF18DE5D7500A99075 /* DateToolsTestsTests.xctest */; - productType = "com.apple.product-type.bundle.unit-test"; - }; -/* End PBXNativeTarget section */ - -/* Begin PBXProject section */ - F00762B618DE5D7500A99075 /* Project object */ = { - isa = PBXProject; - attributes = { - LastUpgradeCheck = 0510; - TargetAttributes = { - F00762DE18DE5D7500A99075 = { - TestTargetID = F00762BD18DE5D7500A99075; - }; - }; - }; - buildConfigurationList = F00762B918DE5D7500A99075 /* Build configuration list for PBXProject "DateToolsTests" */; - compatibilityVersion = "Xcode 3.2"; - developmentRegion = English; - hasScannedForEncodings = 0; - knownRegions = ( - en, - Base, - ja, - es, - ); - mainGroup = F00762B518DE5D7500A99075; - productRefGroup = F00762BF18DE5D7500A99075 /* Products */; - projectDirPath = ""; - projectRoot = ""; - targets = ( - F00762BD18DE5D7500A99075 /* DateToolsTests */, - F00762DE18DE5D7500A99075 /* DateToolsTestsTests */, - ); - }; -/* End PBXProject section */ - -/* Begin PBXResourcesBuildPhase section */ - F00762BC18DE5D7500A99075 /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - F00762DA18DE5D7500A99075 /* Images.xcassets in Resources */, - F00762CC18DE5D7500A99075 /* InfoPlist.strings in Resources */, - F00762D518DE5D7500A99075 /* Main.storyboard in Resources */, - F0F1CC161E444C6E00677AAB /* DateTools.bundle in Resources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - F00762DD18DE5D7500A99075 /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - F00762EB18DE5D7500A99075 /* InfoPlist.strings in Resources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXResourcesBuildPhase section */ - -/* Begin PBXSourcesBuildPhase section */ - F00762BA18DE5D7500A99075 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - F0F1CC181E444C6E00677AAB /* DTError.m in Sources */, - F0F1CC1C1E444C6E00677AAB /* DTTimePeriodGroup.m in Sources */, - F0F1CC1B1E444C6E00677AAB /* DTTimePeriodCollection.m in Sources */, - F00762D818DE5D7500A99075 /* ViewController.m in Sources */, - F0F1CC171E444C6E00677AAB /* DTConstants.m in Sources */, - F0F1CC191E444C6E00677AAB /* DTTimePeriod.m in Sources */, - F0F1CC1A1E444C6E00677AAB /* DTTimePeriodChain.m in Sources */, - F00762D218DE5D7500A99075 /* AppDelegate.m in Sources */, - F0F1CC1D1E444C6E00677AAB /* NSDate+DateTools.m in Sources */, - F00762CE18DE5D7500A99075 /* main.m in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - F00762DB18DE5D7500A99075 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 0AFD486018F08640004D0FE1 /* DTTimeAgoTests.m in Sources */, - F00762FB18DE5D9900A99075 /* DateToolsTests.m in Sources */, - F00762FD18DE5D9900A99075 /* DTTimePeriodGroupTests.m in Sources */, - F00762FF18DE5D9900A99075 /* DTTimePeriodCollectionTests.m in Sources */, - F00762FC18DE5D9900A99075 /* DTTimePeriodTests.m in Sources */, - F00762FE18DE5D9900A99075 /* DTTimePeriodChainTests.m in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXSourcesBuildPhase section */ - -/* Begin PBXTargetDependency section */ - F00762E518DE5D7500A99075 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = F00762BD18DE5D7500A99075 /* DateToolsTests */; - targetProxy = F00762E418DE5D7500A99075 /* PBXContainerItemProxy */; - }; -/* End PBXTargetDependency section */ - -/* Begin PBXVariantGroup section */ - F00762CA18DE5D7500A99075 /* InfoPlist.strings */ = { - isa = PBXVariantGroup; - children = ( - F00762CB18DE5D7500A99075 /* en */, - 0AFD486218F0AB99004D0FE1 /* ja */, - ); - name = InfoPlist.strings; - sourceTree = ""; - }; - F00762D318DE5D7500A99075 /* Main.storyboard */ = { - isa = PBXVariantGroup; - children = ( - F00762D418DE5D7500A99075 /* Base */, - 0AFD486118F0AB99004D0FE1 /* ja */, - F022EC1418F44D3700743E17 /* es */, - ); - name = Main.storyboard; - sourceTree = ""; - }; - F00762E918DE5D7500A99075 /* InfoPlist.strings */ = { - isa = PBXVariantGroup; - children = ( - F00762EA18DE5D7500A99075 /* en */, - 0AFD486318F0AB99004D0FE1 /* ja */, - ); - name = InfoPlist.strings; - sourceTree = ""; - }; -/* End PBXVariantGroup section */ - -/* Begin XCBuildConfiguration section */ - F00762EE18DE5D7500A99075 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; - COPY_PHASE_STRIP = NO; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_DYNAMIC_NO_PIC = NO; - GCC_OPTIMIZATION_LEVEL = 0; - GCC_PREPROCESSOR_DEFINITIONS = ( - "DEBUG=1", - "$(inherited)", - ); - GCC_SYMBOLS_PRIVATE_EXTERN = NO; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; - ONLY_ACTIVE_ARCH = YES; - SDKROOT = iphoneos; - }; - name = Debug; - }; - F00762EF18DE5D7500A99075 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; - COPY_PHASE_STRIP = YES; - ENABLE_NS_ASSERTIONS = NO; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; - SDKROOT = iphoneos; - VALIDATE_PRODUCT = YES; - }; - name = Release; - }; - F00762F118DE5D7500A99075 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; - GCC_PRECOMPILE_PREFIX_HEADER = YES; - GCC_PREFIX_HEADER = "DateToolsTests/DateToolsTests-Prefix.pch"; - INFOPLIST_FILE = "DateToolsTests/DateToolsTests-Info.plist"; - IPHONEOS_DEPLOYMENT_TARGET = 7.0; - PRODUCT_NAME = "$(TARGET_NAME)"; - WRAPPER_EXTENSION = app; - }; - name = Debug; - }; - F00762F218DE5D7500A99075 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; - GCC_PRECOMPILE_PREFIX_HEADER = YES; - GCC_PREFIX_HEADER = "DateToolsTests/DateToolsTests-Prefix.pch"; - INFOPLIST_FILE = "DateToolsTests/DateToolsTests-Info.plist"; - IPHONEOS_DEPLOYMENT_TARGET = 7.0; - PRODUCT_NAME = "$(TARGET_NAME)"; - WRAPPER_EXTENSION = app; - }; - name = Release; - }; - F00762F418DE5D7500A99075 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - BUNDLE_LOADER = "$(BUILT_PRODUCTS_DIR)/DateToolsTests.app/DateToolsTests"; - FRAMEWORK_SEARCH_PATHS = ( - "$(SDKROOT)/Developer/Library/Frameworks", - "$(inherited)", - "$(DEVELOPER_FRAMEWORKS_DIR)", - ); - GCC_PRECOMPILE_PREFIX_HEADER = YES; - GCC_PREFIX_HEADER = "DateToolsTests/DateToolsTests-Prefix.pch"; - GCC_PREPROCESSOR_DEFINITIONS = ( - "DEBUG=1", - "$(inherited)", - ); - INFOPLIST_FILE = "DateToolsTestsTests/DateToolsTestsTests-Info.plist"; - PRODUCT_NAME = "$(TARGET_NAME)"; - TEST_HOST = "$(BUNDLE_LOADER)"; - WRAPPER_EXTENSION = xctest; - }; - name = Debug; - }; - F00762F518DE5D7500A99075 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - BUNDLE_LOADER = "$(BUILT_PRODUCTS_DIR)/DateToolsTests.app/DateToolsTests"; - FRAMEWORK_SEARCH_PATHS = ( - "$(SDKROOT)/Developer/Library/Frameworks", - "$(inherited)", - "$(DEVELOPER_FRAMEWORKS_DIR)", - ); - GCC_PRECOMPILE_PREFIX_HEADER = YES; - GCC_PREFIX_HEADER = "DateToolsTests/DateToolsTests-Prefix.pch"; - INFOPLIST_FILE = "DateToolsTestsTests/DateToolsTestsTests-Info.plist"; - PRODUCT_NAME = "$(TARGET_NAME)"; - TEST_HOST = "$(BUNDLE_LOADER)"; - WRAPPER_EXTENSION = xctest; - }; - name = Release; - }; -/* End XCBuildConfiguration section */ - -/* Begin XCConfigurationList section */ - F00762B918DE5D7500A99075 /* Build configuration list for PBXProject "DateToolsTests" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - F00762EE18DE5D7500A99075 /* Debug */, - F00762EF18DE5D7500A99075 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - F00762F018DE5D7500A99075 /* Build configuration list for PBXNativeTarget "DateToolsTests" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - F00762F118DE5D7500A99075 /* Debug */, - F00762F218DE5D7500A99075 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - F00762F318DE5D7500A99075 /* Build configuration list for PBXNativeTarget "DateToolsTestsTests" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - F00762F418DE5D7500A99075 /* Debug */, - F00762F518DE5D7500A99075 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; -/* End XCConfigurationList section */ - }; - rootObject = F00762B618DE5D7500A99075 /* Project object */; -} diff --git a/DateTools/Tests/DateToolsTests/DateToolsTests.xcodeproj/xcshareddata/xcschemes/DateToolsTests.xcscheme b/DateTools/Tests/DateToolsTests/DateToolsTests.xcodeproj/xcshareddata/xcschemes/DateToolsTests.xcscheme deleted file mode 100644 index d7b54544..00000000 --- a/DateTools/Tests/DateToolsTests/DateToolsTests.xcodeproj/xcshareddata/xcschemes/DateToolsTests.xcscheme +++ /dev/null @@ -1,96 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/DateTools/Tests/DateToolsTests/DateToolsTests.xcodeproj/xcshareddata/xcschemes/DateToolsTestsTests.xcscheme b/DateTools/Tests/DateToolsTests/DateToolsTests.xcodeproj/xcshareddata/xcschemes/DateToolsTestsTests.xcscheme deleted file mode 100644 index 58d4b3ed..00000000 --- a/DateTools/Tests/DateToolsTests/DateToolsTests.xcodeproj/xcshareddata/xcschemes/DateToolsTestsTests.xcscheme +++ /dev/null @@ -1,66 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/DateTools/Tests/DateToolsTests/DateToolsTests/AppDelegate.h b/DateTools/Tests/DateToolsTests/DateToolsTests/AppDelegate.h deleted file mode 100644 index 5b54c7f7..00000000 --- a/DateTools/Tests/DateToolsTests/DateToolsTests/AppDelegate.h +++ /dev/null @@ -1,15 +0,0 @@ -// -// AppDelegate.h -// DateToolsTests -// -// Created by Matthew York on 3/22/14. -// -// - -#import - -@interface AppDelegate : UIResponder - -@property (strong, nonatomic) UIWindow *window; - -@end diff --git a/DateTools/Tests/DateToolsTests/DateToolsTests/AppDelegate.m b/DateTools/Tests/DateToolsTests/DateToolsTests/AppDelegate.m deleted file mode 100644 index a7e8061c..00000000 --- a/DateTools/Tests/DateToolsTests/DateToolsTests/AppDelegate.m +++ /dev/null @@ -1,46 +0,0 @@ -// -// AppDelegate.m -// DateToolsTests -// -// Created by Matthew York on 3/22/14. -// -// - -#import "AppDelegate.h" - -@implementation AppDelegate - -- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions -{ - // Override point for customization after application launch. - return YES; -} - -- (void)applicationWillResignActive:(UIApplication *)application -{ - // 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. - // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. -} - -- (void)applicationDidEnterBackground:(UIApplication *)application -{ - // 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. - // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. -} - -- (void)applicationWillEnterForeground:(UIApplication *)application -{ - // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. -} - -- (void)applicationDidBecomeActive:(UIApplication *)application -{ - // 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. -} - -- (void)applicationWillTerminate:(UIApplication *)application -{ - // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. -} - -@end diff --git a/DateTools/Tests/DateToolsTests/DateToolsTests/Base.lproj/Main.storyboard b/DateTools/Tests/DateToolsTests/DateToolsTests/Base.lproj/Main.storyboard deleted file mode 100644 index ce2c6585..00000000 --- a/DateTools/Tests/DateToolsTests/DateToolsTests/Base.lproj/Main.storyboard +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/DateTools/Tests/DateToolsTests/DateToolsTests/DateToolsTests-Info.plist b/DateTools/Tests/DateToolsTests/DateToolsTests/DateToolsTests-Info.plist deleted file mode 100644 index ad707158..00000000 --- a/DateTools/Tests/DateToolsTests/DateToolsTests/DateToolsTests-Info.plist +++ /dev/null @@ -1,40 +0,0 @@ - - - - - CFBundleDevelopmentRegion - en - CFBundleDisplayName - ${PRODUCT_NAME} - CFBundleExecutable - ${EXECUTABLE_NAME} - CFBundleIdentifier - com.mattyork.${PRODUCT_NAME:rfc1034identifier} - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - ${PRODUCT_NAME} - CFBundlePackageType - APPL - CFBundleShortVersionString - 1.0 - CFBundleSignature - ???? - CFBundleVersion - 1.0 - LSRequiresIPhoneOS - - UIMainStoryboardFile - Main - UIRequiredDeviceCapabilities - - armv7 - - UISupportedInterfaceOrientations - - UIInterfaceOrientationPortrait - UIInterfaceOrientationLandscapeLeft - UIInterfaceOrientationLandscapeRight - - - diff --git a/DateTools/Tests/DateToolsTests/DateToolsTests/DateToolsTests-Prefix.pch b/DateTools/Tests/DateToolsTests/DateToolsTests/DateToolsTests-Prefix.pch deleted file mode 100644 index 82a2bb45..00000000 --- a/DateTools/Tests/DateToolsTests/DateToolsTests/DateToolsTests-Prefix.pch +++ /dev/null @@ -1,16 +0,0 @@ -// -// Prefix header -// -// The contents of this file are implicitly included at the beginning of every source file. -// - -#import - -#ifndef __IPHONE_5_0 -#warning "This project uses features only available in iOS SDK 5.0 and later." -#endif - -#ifdef __OBJC__ - #import - #import -#endif diff --git a/DateTools/Tests/DateToolsTests/DateToolsTests/Images.xcassets/AppIcon.appiconset/Contents.json b/DateTools/Tests/DateToolsTests/DateToolsTests/Images.xcassets/AppIcon.appiconset/Contents.json deleted file mode 100644 index a396706d..00000000 --- a/DateTools/Tests/DateToolsTests/DateToolsTests/Images.xcassets/AppIcon.appiconset/Contents.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "images" : [ - { - "idiom" : "iphone", - "size" : "29x29", - "scale" : "2x" - }, - { - "idiom" : "iphone", - "size" : "40x40", - "scale" : "2x" - }, - { - "idiom" : "iphone", - "size" : "60x60", - "scale" : "2x" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/DateTools/Tests/DateToolsTests/DateToolsTests/Images.xcassets/LaunchImage.launchimage/Contents.json b/DateTools/Tests/DateToolsTests/DateToolsTests/Images.xcassets/LaunchImage.launchimage/Contents.json deleted file mode 100644 index c79ebd3a..00000000 --- a/DateTools/Tests/DateToolsTests/DateToolsTests/Images.xcassets/LaunchImage.launchimage/Contents.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "images" : [ - { - "orientation" : "portrait", - "idiom" : "iphone", - "extent" : "full-screen", - "minimum-system-version" : "7.0", - "scale" : "2x" - }, - { - "orientation" : "portrait", - "idiom" : "iphone", - "subtype" : "retina4", - "extent" : "full-screen", - "minimum-system-version" : "7.0", - "scale" : "2x" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/DateTools/Tests/DateToolsTests/DateToolsTests/ViewController.h b/DateTools/Tests/DateToolsTests/DateToolsTests/ViewController.h deleted file mode 100644 index f3e57961..00000000 --- a/DateTools/Tests/DateToolsTests/DateToolsTests/ViewController.h +++ /dev/null @@ -1,13 +0,0 @@ -// -// ViewController.h -// DateToolsTests -// -// Created by Matthew York on 3/22/14. -// -// - -#import - -@interface ViewController : UIViewController - -@end diff --git a/DateTools/Tests/DateToolsTests/DateToolsTests/ViewController.m b/DateTools/Tests/DateToolsTests/DateToolsTests/ViewController.m deleted file mode 100644 index b5910da9..00000000 --- a/DateTools/Tests/DateToolsTests/DateToolsTests/ViewController.m +++ /dev/null @@ -1,54 +0,0 @@ -// -// ViewController.m -// DateToolsTests -// -// Created by Matthew York on 3/22/14. -// -// - -#import "ViewController.h" -#import "NSDate+DateTools.h" - -@interface ViewController () - -@end - -@implementation ViewController - -- (void)viewDidLoad -{ - [super viewDidLoad]; - //Time ago test - NSLog(@"10 months Ago: %@", [[NSDate date] dateBySubtractingMonths:10].timeAgoSinceNow); - NSLog(@"8 weeks Ago: %@", [[NSDate date] dateBySubtractingWeeks:8].timeAgoSinceNow); - NSLog(@"3 days Ago: %@", [[NSDate date] dateBySubtractingDays:3].timeAgoSinceNow); - NSLog(@"2 hours Ago: %@", [[NSDate date] dateBySubtractingHours:2].timeAgoSinceNow); - NSLog(@"5 minutes Ago: %@", [[NSDate date] dateBySubtractingMinutes:5].timeAgoSinceNow); - NSLog(@"1 second Ago: %@", [[NSDate date] dateBySubtractingSeconds:1].timeAgoSinceNow); - NSLog(@"now Ago: %@", [NSDate date].timeAgoSinceNow); - - //Short time ago test - NSLog(@"10 months Ago: %@", [[NSDate date] dateBySubtractingMonths:10].shortTimeAgoSinceNow); - NSLog(@"8 weeks Ago: %@", [[NSDate date] dateBySubtractingWeeks:8].shortTimeAgoSinceNow); - NSLog(@"3 days Ago: %@", [[NSDate date] dateBySubtractingDays:3].shortTimeAgoSinceNow); - NSLog(@"2 hours Ago: %@", [[NSDate date] dateBySubtractingHours:2].shortTimeAgoSinceNow); - NSLog(@"5 minutes Ago: %@", [[NSDate date] dateBySubtractingMinutes:5].shortTimeAgoSinceNow); - NSLog(@"1 second Ago: %@", [[NSDate date] dateBySubtractingSeconds:1].shortTimeAgoSinceNow); - NSLog(@"now Ago: %@", [NSDate date].timeAgoSinceNow); - - //Test formatters - NSString *dateStringFormatTest = [[NSDate date] formattedDateWithFormat:@"dd MMM, yyyy"]; - NSString *dateStringStyleTest = [[NSDate date] formattedDateWithStyle:NSDateFormatterLongStyle timeZone:[NSTimeZone localTimeZone] locale:[NSLocale currentLocale]]; - NSString *dateStringStyleTest2 = [[NSDate date] formattedDateWithStyle:NSDateFormatterShortStyle timeZone:[NSTimeZone localTimeZone] locale:[NSLocale currentLocale]]; - NSLog(@"%@", dateStringFormatTest); - NSLog(@"%@", dateStringStyleTest); - NSLog(@"%@", dateStringStyleTest2); -} - -- (void)didReceiveMemoryWarning -{ - [super didReceiveMemoryWarning]; - // Dispose of any resources that can be recreated. -} - -@end diff --git a/DateTools/Tests/DateToolsTests/DateToolsTests/en.lproj/InfoPlist.strings b/DateTools/Tests/DateToolsTests/DateToolsTests/en.lproj/InfoPlist.strings deleted file mode 100644 index 477b28ff..00000000 --- a/DateTools/Tests/DateToolsTests/DateToolsTests/en.lproj/InfoPlist.strings +++ /dev/null @@ -1,2 +0,0 @@ -/* Localized versions of Info.plist keys */ - diff --git a/DateTools/Tests/DateToolsTests/DateToolsTests/es.lproj/InfoPlist.strings b/DateTools/Tests/DateToolsTests/DateToolsTests/es.lproj/InfoPlist.strings deleted file mode 100644 index 477b28ff..00000000 --- a/DateTools/Tests/DateToolsTests/DateToolsTests/es.lproj/InfoPlist.strings +++ /dev/null @@ -1,2 +0,0 @@ -/* Localized versions of Info.plist keys */ - diff --git a/DateTools/Tests/DateToolsTests/DateToolsTests/es.lproj/Main.strings b/DateTools/Tests/DateToolsTests/DateToolsTests/es.lproj/Main.strings deleted file mode 100644 index e69de29b..00000000 diff --git a/DateTools/Tests/DateToolsTests/DateToolsTests/ja.lproj/InfoPlist.strings b/DateTools/Tests/DateToolsTests/DateToolsTests/ja.lproj/InfoPlist.strings deleted file mode 100644 index 477b28ff..00000000 --- a/DateTools/Tests/DateToolsTests/DateToolsTests/ja.lproj/InfoPlist.strings +++ /dev/null @@ -1,2 +0,0 @@ -/* Localized versions of Info.plist keys */ - diff --git a/DateTools/Tests/DateToolsTests/DateToolsTests/ja.lproj/Main.strings b/DateTools/Tests/DateToolsTests/DateToolsTests/ja.lproj/Main.strings deleted file mode 100644 index e69de29b..00000000 diff --git a/DateTools/Tests/DateToolsTests/DateToolsTests/main.m b/DateTools/Tests/DateToolsTests/DateToolsTests/main.m deleted file mode 100644 index 6b11f274..00000000 --- a/DateTools/Tests/DateToolsTests/DateToolsTests/main.m +++ /dev/null @@ -1,18 +0,0 @@ -// -// main.m -// DateToolsTests -// -// Created by Matthew York on 3/22/14. -// -// - -#import - -#import "AppDelegate.h" - -int main(int argc, char * argv[]) -{ - @autoreleasepool { - return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); - } -} diff --git a/DateTools/Tests/DateToolsTests/DateToolsTestsTests/DTTimeAgoTests.m b/DateTools/Tests/DateToolsTests/DateToolsTestsTests/DTTimeAgoTests.m deleted file mode 100644 index 0f9f2af5..00000000 --- a/DateTools/Tests/DateToolsTests/DateToolsTestsTests/DTTimeAgoTests.m +++ /dev/null @@ -1,175 +0,0 @@ -// -// DTTimeAgoTests.m -// DateToolsTests -// -// Created by kevin on 2014.04.05. -// -// - -#import -#import "NSDate+DateTools.h" - -@interface DTTimeAgoTests : XCTestCase -@property NSDateFormatter *formatter; -@property NSDate *date0; -@property NSDate *date1; -@end - -@implementation DTTimeAgoTests - -- (void)setUp -{ - [super setUp]; - // Put setup code here. This method is called before the invocation of each test method in the class. - - self.formatter = [[NSDateFormatter alloc] init]; - [self.formatter setDateFormat:@"yyyy MM dd HH:mm:ss.SSS"]; - self.date0 = [self.formatter dateFromString:@"2014 11 05 18:15:12.000"]; - self.date1 = [self.formatter dateFromString:@"2014 11 07 18:15:12.000"]; - -} - -- (void)tearDown -{ - // Put teardown code here. This method is called after the invocation of each test method in the class. - [super tearDown]; -} - -- (void)testBasicLongTimeAgo -{ - NSString *now = [self.date0 timeAgoSinceDate:self.date0]; - - XCTAssert(now && now.length > 0, @"'Now' is nil or empty."); - - - NSString *ago = [self.date1 timeAgoSinceDate:self.date0]; - - XCTAssert(ago && ago.length > 0, @"Ago is nil or empty."); -} - -- (void)testLongTimeAgo2Days -{ - self.date0 = [self.formatter dateFromString:@"2014 11 05 18:15:12.000"]; - self.date1 = [self.formatter dateFromString:@"2014 11 07 18:15:12.000"]; - NSString *ago = [self.date0 timeAgoSinceDate:self.date1]; - XCTAssertEqualObjects(ago, DateToolsLocalizedStrings(@"2 days ago")); -} - -- (void)testLongTimeAgo1DayAndHalf -{ - self.date0 = [self.formatter dateFromString:@"2014 11 06 9:15:12.000"]; - self.date1 = [self.formatter dateFromString:@"2014 11 07 18:15:12.000"]; - NSString *ago = [self.date0 timeAgoSinceDate:self.date1]; - XCTAssertEqualObjects(ago, DateToolsLocalizedStrings(@"Yesterday")); -} - -- (void)testLongTimeAgoExactlyYesterday -{ - self.date0 = [self.formatter dateFromString:@"2014 11 06 18:15:12.000"]; - self.date1 = [self.formatter dateFromString:@"2014 11 07 18:15:12.000"]; - NSString *ago = [self.date0 timeAgoSinceDate:self.date1]; - XCTAssertEqualObjects(ago, DateToolsLocalizedStrings(@"Yesterday")); -} - -- (void)testLongTimeAgoLessThan24hoursButYesterday -{ - self.date0 = [self.formatter dateFromString:@"2014 11 06 20:15:12.000"]; - self.date1 = [self.formatter dateFromString:@"2014 11 07 18:15:12.000"]; - NSString *ago = [self.date0 timeAgoSinceDate:self.date1]; - XCTAssertEqualObjects(ago, DateToolsLocalizedStrings(@"22 hours ago")); -} - -- (void)testLongTimeAgoLessThan24hoursSameDay -{ - self.date0 = [self.formatter dateFromString:@"2014 11 07 10:15:12.000"]; - self.date1 = [self.formatter dateFromString:@"2014 11 07 18:15:12.000"]; - NSString *ago = [self.date0 timeAgoSinceDate:self.date1]; - XCTAssertEqualObjects(ago, DateToolsLocalizedStrings(@"8 hours ago")); -} - -- (void)testLongTimeAgoBetween24And48Hours -{ - self.date0 = [self.formatter dateFromString:@"2014 11 07 10:15:12.000"]; - self.date1 = [self.formatter dateFromString:@"2014 11 08 18:15:12.000"]; - NSString *ago = [self.date0 timeAgoSinceDate:self.date1]; - XCTAssertEqualObjects(ago, DateToolsLocalizedStrings(@"Yesterday")); -} - -- (void)testBasicShortTimeAgo -{ - NSString *now = [self.date0 shortTimeAgoSinceDate:self.date0]; - - XCTAssert(now && now.length > 0, @"'Now' is nil or empty."); - - - NSString *ago = [self.date1 shortTimeAgoSinceDate:self.date0]; - - XCTAssert(ago && ago.length > 0, @"Ago is nil or empty."); -} - - -- (void)testShortTimeAgo2Days -{ - self.date0 = [self.formatter dateFromString:@"2014 11 05 18:15:12.000"]; - self.date1 = [self.formatter dateFromString:@"2014 11 07 18:15:12.000"]; - NSString *ago = [self.date0 shortTimeAgoSinceDate:self.date1]; - XCTAssertEqualObjects(ago, DateToolsLocalizedStrings(@"2d")); -} - -- (void)testShortTimeAgo1DayAndHalf -{ - self.date0 = [self.formatter dateFromString:@"2014 11 06 9:15:12.000"]; - self.date1 = [self.formatter dateFromString:@"2014 11 07 18:15:12.000"]; - NSString *ago = [self.date0 shortTimeAgoSinceDate:self.date1]; - XCTAssertEqualObjects(ago, DateToolsLocalizedStrings(@"1d")); -} - -- (void)testShortTimeAgoExactlyYesterday -{ - self.date0 = [self.formatter dateFromString:@"2014 11 06 18:15:12.000"]; - self.date1 = [self.formatter dateFromString:@"2014 11 07 18:15:12.000"]; - NSString *ago = [self.date0 shortTimeAgoSinceDate:self.date1]; - XCTAssertEqualObjects(ago, DateToolsLocalizedStrings(@"1d")); -} - -- (void)testShortTimeAgoLessThan24hoursButYesterday -{ - self.date0 = [self.formatter dateFromString:@"2014 11 06 20:15:12.000"]; - self.date1 = [self.formatter dateFromString:@"2014 11 07 18:15:12.000"]; - NSString *ago = [self.date0 shortTimeAgoSinceDate:self.date1]; - XCTAssertEqualObjects(ago, DateToolsLocalizedStrings(@"22h")); -} - -- (void)testShortTimeAgoLessThan24hoursSameDay -{ - self.date0 = [self.formatter dateFromString:@"2014 11 07 10:15:12.000"]; - self.date1 = [self.formatter dateFromString:@"2014 11 07 18:15:12.000"]; - NSString *ago = [self.date0 shortTimeAgoSinceDate:self.date1]; - XCTAssertEqualObjects(ago, DateToolsLocalizedStrings(@"8h")); -} - -- (void)testShortTimeAgoBetween24And48Hours -{ - self.date0 = [self.formatter dateFromString:@"2014 11 07 10:15:12.000"]; - self.date1 = [self.formatter dateFromString:@"2014 11 08 18:15:12.000"]; - NSString *ago = [self.date0 shortTimeAgoSinceDate:self.date1]; - XCTAssertEqualObjects(ago, DateToolsLocalizedStrings(@"1d")); -} - -- (void)testLongTimeAgoLocalizationsAccessible -{ - NSString *en_local = @"Yesterday"; - NSString *ja_local = @"昨日"; - - NSString *key = en_local; - - NSString *path = [NSBundle.mainBundle.bundlePath stringByAppendingPathComponent:@"DateTools.bundle/ja.lproj"]; - NSBundle *bundle = [NSBundle bundleWithPath:path]; - - NSString *ja_result = NSLocalizedStringFromTableInBundle(key, @"DateTools", bundle, nil); - - XCTAssertEqualObjects(ja_local, ja_result, @"Could not access localizations."); -} - - -@end diff --git a/DateTools/Tests/DateToolsTests/DateToolsTestsTests/DTTimePeriodChainTests.m b/DateTools/Tests/DateToolsTests/DateToolsTestsTests/DTTimePeriodChainTests.m deleted file mode 100644 index 79b1e33b..00000000 --- a/DateTools/Tests/DateToolsTests/DateToolsTestsTests/DTTimePeriodChainTests.m +++ /dev/null @@ -1,183 +0,0 @@ -// -// DTTimePeriodChainTests.m -// DateToolsExample -// -// Created by Matthew York on 3/21/14. -// -// - -#import -#import "DTTimePeriodChain.h" - -@interface DTTimePeriodChainTests : XCTestCase -@property NSDateFormatter *formatter; -@property DTTimePeriodChain *controlChain; -@end - -@implementation DTTimePeriodChainTests - -- (void)setUp -{ - [super setUp]; - - //Initialize control DTTimePeriodChain - self.controlChain = [[DTTimePeriodChain alloc] init]; - - //Initialize formatter - self.formatter = [[NSDateFormatter alloc] init]; - [self.formatter setDateFormat:@"yyyy MM dd HH:mm:ss.SSS"]; - - //Create test DTTimePeriods that are 1 year long - DTTimePeriod *firstPeriod = [DTTimePeriod timePeriodWithStartDate:[self.formatter dateFromString:@"2014 11 05 18:15:12.000"] endDate:[self.formatter dateFromString:@"2015 11 05 18:15:12.000"]]; - DTTimePeriod *secondPeriod = [DTTimePeriod timePeriodWithStartDate:[self.formatter dateFromString:@"2015 11 05 18:15:12.000"] endDate:[self.formatter dateFromString:@"2016 11 05 18:15:12.000"]]; - DTTimePeriod *thirdPeriod = [DTTimePeriod timePeriodWithStartDate:[self.formatter dateFromString:@"2016 11 05 18:15:12.000"] endDate:[self.formatter dateFromString:@"2017 11 05 18:15:12.000"]]; - - //Add test periods - [self.controlChain addTimePeriod:firstPeriod]; - [self.controlChain addTimePeriod:secondPeriod]; - [self.controlChain addTimePeriod:thirdPeriod]; -} - -- (void)tearDown -{ - // Put teardown code here. This method is called after the invocation of each test method in the class. - [super tearDown]; -} - -#pragma mark - Custom Init / Factory Chain --(void)testInitsAndFactories{ - DTTimePeriodChain *initCompareChain = [[DTTimePeriodChain alloc] init]; - DTTimePeriodChain *factoryCompareChain = [DTTimePeriodChain chain]; - - XCTAssertTrue([initCompareChain isEqualToChain:factoryCompareChain], @"%s Failed", __PRETTY_FUNCTION__); -} - -#pragma mark - Chain Existence Manipulation --(void)testAddTimePeriod{ - //Create test chain - DTTimePeriodChain *testChain = [DTTimePeriodChain chain]; - [testChain addTimePeriod:[DTTimePeriod timePeriodWithStartDate:[self.formatter dateFromString:@"2014 11 05 18:15:12.000"] endDate:[self.formatter dateFromString:@"2015 11 05 18:15:12.000"]]]; - [testChain addTimePeriod:[DTTimePeriod timePeriodWithStartDate:[self.formatter dateFromString:@"2015 11 05 18:15:12.000"] endDate:[self.formatter dateFromString:@"2016 11 05 18:15:12.000"]]]; - [testChain addTimePeriod:[DTTimePeriod timePeriodWithStartDate:[self.formatter dateFromString:@"2016 11 05 18:15:12.000"] endDate:[self.formatter dateFromString:@"2017 11 05 18:15:12.000"]]]; - - //Check equal - XCTAssertTrue([self.controlChain isEqualToChain:testChain], @"%s Failed", __PRETTY_FUNCTION__); -} --(void)testInsertTimePeriod{ - //Create test chain - DTTimePeriodChain *testChain = [DTTimePeriodChain chain]; - [testChain addTimePeriod:[DTTimePeriod timePeriodWithStartDate:[self.formatter dateFromString:@"2014 11 05 18:15:12.000"] endDate:[self.formatter dateFromString:@"2015 11 05 18:15:12.000"]]]; - [testChain addTimePeriod:[DTTimePeriod timePeriodWithStartDate:[self.formatter dateFromString:@"2016 11 05 18:15:12.000"] endDate:[self.formatter dateFromString:@"2017 11 05 18:15:12.000"]]]; - [testChain insertTimePeriod:[DTTimePeriod timePeriodWithStartDate:[self.formatter dateFromString:@"2015 11 05 18:15:12.000"] endDate:[self.formatter dateFromString:@"2016 11 05 18:15:12.000"]] atInedx:1]; - - //Check equal - XCTAssertTrue([self.controlChain isEqualToChain:testChain], @"%s Failed", __PRETTY_FUNCTION__); -} --(void)testRemoveTimePeriodAtIndex{ - //Create test chain - DTTimePeriodChain *testChain = [DTTimePeriodChain chain]; - [testChain addTimePeriod:[DTTimePeriod timePeriodWithStartDate:[self.formatter dateFromString:@"2014 11 05 18:15:12.000"] endDate:[self.formatter dateFromString:@"2015 11 05 18:15:12.000"]]]; - [testChain addTimePeriod:[DTTimePeriod timePeriodWithStartDate:[self.formatter dateFromString:@"2016 11 05 18:15:12.000"] endDate:[self.formatter dateFromString:@"2017 11 05 18:15:12.000"]]]; - - [self.controlChain removeTimePeriodAtIndex:1]; - - //Check equal - XCTAssertTrue([self.controlChain isEqualToChain:testChain], @"%s Failed", __PRETTY_FUNCTION__); -} --(void)testRemoveLatestTimePeriod{ - //Create test chain - DTTimePeriodChain *testChain = [DTTimePeriodChain chain]; - [testChain addTimePeriod:[DTTimePeriod timePeriodWithStartDate:[self.formatter dateFromString:@"2014 11 05 18:15:12.000"] endDate:[self.formatter dateFromString:@"2015 11 05 18:15:12.000"]]]; - [testChain addTimePeriod:[DTTimePeriod timePeriodWithStartDate:[self.formatter dateFromString:@"2015 11 05 18:15:12.000"] endDate:[self.formatter dateFromString:@"2016 11 05 18:15:12.000"]]]; - - [self.controlChain removeLatestTimePeriod]; - - //Check equal - XCTAssertTrue([self.controlChain isEqualToChain:testChain], @"%s Failed", __PRETTY_FUNCTION__); -} --(void)testRemoveEarliestTimePeriod{ - //Create test chain - DTTimePeriodChain *testChain = [DTTimePeriodChain chain]; - [testChain addTimePeriod:[DTTimePeriod timePeriodWithStartDate:[self.formatter dateFromString:@"2015 11 05 18:15:12.000"] endDate:[self.formatter dateFromString:@"2016 11 05 18:15:12.000"]]]; - [testChain addTimePeriod:[DTTimePeriod timePeriodWithStartDate:[self.formatter dateFromString:@"2016 11 05 18:15:12.000"] endDate:[self.formatter dateFromString:@"2017 11 05 18:15:12.000"]]]; - [testChain shiftEarlierWithSize:DTTimePeriodSizeSecond amount:[[DTTimePeriod timePeriodWithStartDate:[self.formatter dateFromString:@"2014 11 05 18:15:12.000"] endDate:[self.formatter dateFromString:@"2015 11 05 18:15:12.000"]] durationInSeconds]]; - - [self.controlChain removeEarliestTimePeriod]; - - //Check equal - XCTAssertTrue([self.controlChain isEqualToChain:testChain], @"%s Failed", __PRETTY_FUNCTION__); -} - -#pragma mark - Chain Time Manipulation --(void)testShiftEarlier{ - //Create test chain - DTTimePeriodChain *testChainOriginal = [DTTimePeriodChain chain]; - [testChainOriginal addTimePeriod:[DTTimePeriod timePeriodWithStartDate:[self.formatter dateFromString:@"2014 11 05 18:15:12.000"] endDate:[self.formatter dateFromString:@"2015 11 05 18:15:12.000"]]]; - [testChainOriginal addTimePeriod:[DTTimePeriod timePeriodWithStartDate:[self.formatter dateFromString:@"2015 11 05 18:15:12.000"] endDate:[self.formatter dateFromString:@"2016 11 05 18:15:12.000"]]]; - [testChainOriginal addTimePeriod:[DTTimePeriod timePeriodWithStartDate:[self.formatter dateFromString:@"2016 11 05 18:15:12.000"] endDate:[self.formatter dateFromString:@"2017 11 05 18:15:12.000"]]]; - - //Create test chain - DTTimePeriodChain *testChain = [DTTimePeriodChain chain]; - [testChain addTimePeriod:[DTTimePeriod timePeriodWithStartDate:[self.formatter dateFromString:@"2012 11 05 18:15:12.000"] endDate:[self.formatter dateFromString:@"2013 11 05 18:15:12.000"]]]; - [testChain addTimePeriod:[DTTimePeriod timePeriodWithStartDate:[self.formatter dateFromString:@"2013 11 05 18:15:12.000"] endDate:[self.formatter dateFromString:@"2014 11 05 18:15:12.000"]]]; - [testChain addTimePeriod:[DTTimePeriod timePeriodWithStartDate:[self.formatter dateFromString:@"2014 11 05 18:15:12.000"] endDate:[self.formatter dateFromString:@"2015 11 05 18:15:12.000"]]]; - - //Shift control chain - [self.controlChain shiftEarlierWithSize:DTTimePeriodSizeYear amount:2]; - - //Check equal - XCTAssertTrue([self.controlChain isEqualToChain:testChain], @"%s Failed", __PRETTY_FUNCTION__); - - //Check equal - XCTAssertFalse([self.controlChain isEqualToChain:testChainOriginal], @"%s Failed", __PRETTY_FUNCTION__); -} - --(void)testShiftLater{ - //Create test chain - DTTimePeriodChain *testChainOriginal = [DTTimePeriodChain chain]; - [testChainOriginal addTimePeriod:[DTTimePeriod timePeriodWithStartDate:[self.formatter dateFromString:@"2014 11 05 18:15:12.000"] endDate:[self.formatter dateFromString:@"2015 11 05 18:15:12.000"]]]; - [testChainOriginal addTimePeriod:[DTTimePeriod timePeriodWithStartDate:[self.formatter dateFromString:@"2015 11 05 18:15:12.000"] endDate:[self.formatter dateFromString:@"2016 11 05 18:15:12.000"]]]; - [testChainOriginal addTimePeriod:[DTTimePeriod timePeriodWithStartDate:[self.formatter dateFromString:@"2016 11 05 18:15:12.000"] endDate:[self.formatter dateFromString:@"2017 11 05 18:15:12.000"]]]; - - //Create test chain - DTTimePeriodChain *testChain = [DTTimePeriodChain chain]; - [testChain addTimePeriod:[DTTimePeriod timePeriodWithStartDate:[self.formatter dateFromString:@"2016 11 05 18:15:12.000"] endDate:[self.formatter dateFromString:@"2017 11 05 18:15:12.000"]]]; - [testChain addTimePeriod:[DTTimePeriod timePeriodWithStartDate:[self.formatter dateFromString:@"2017 11 05 18:15:12.000"] endDate:[self.formatter dateFromString:@"2018 11 05 18:15:12.000"]]]; - [testChain addTimePeriod:[DTTimePeriod timePeriodWithStartDate:[self.formatter dateFromString:@"2018 11 05 18:15:12.000"] endDate:[self.formatter dateFromString:@"2019 11 05 18:15:12.000"]]]; - - //Shift control chain - [self.controlChain shiftLaterWithSize:DTTimePeriodSizeYear amount:2]; - - //Check equal - XCTAssertTrue([self.controlChain isEqualToChain:testChain], @"%s Failed", __PRETTY_FUNCTION__); - - //Check equal - XCTAssertFalse([self.controlChain isEqualToChain:testChainOriginal], @"%s Failed", __PRETTY_FUNCTION__); -} - -#pragma mark - Chain Relationship --(void)testIsEqualToChain{ - //Create test chains - DTTimePeriodChain *testChain = [DTTimePeriodChain chain]; - [testChain addTimePeriod:[DTTimePeriod timePeriodWithStartDate:[self.formatter dateFromString:@"2014 11 05 18:15:12.000"] endDate:[self.formatter dateFromString:@"2015 11 05 18:15:12.000"]]]; - [testChain addTimePeriod:[DTTimePeriod timePeriodWithStartDate:[self.formatter dateFromString:@"2015 11 05 18:15:12.000"] endDate:[self.formatter dateFromString:@"2016 11 05 18:15:12.000"]]]; - [testChain addTimePeriod:[DTTimePeriod timePeriodWithStartDate:[self.formatter dateFromString:@"2016 11 05 18:15:12.000"] endDate:[self.formatter dateFromString:@"2017 11 05 18:15:12.000"]]]; - - - DTTimePeriodChain *testChainOutOfOrder = [DTTimePeriodChain chain]; - [testChainOutOfOrder addTimePeriod:[DTTimePeriod timePeriodWithStartDate:[self.formatter dateFromString:@"2015 11 05 18:15:12.000"] endDate:[self.formatter dateFromString:@"2016 11 05 18:15:12.000"]]]; - [testChainOutOfOrder addTimePeriod:[DTTimePeriod timePeriodWithStartDate:[self.formatter dateFromString:@"2016 11 05 18:15:12.000"] endDate:[self.formatter dateFromString:@"2017 11 05 18:15:12.000"]]]; - [testChainOutOfOrder addTimePeriod:[DTTimePeriod timePeriodWithStartDate:[self.formatter dateFromString:@"2014 11 05 18:15:12.000"] endDate:[self.formatter dateFromString:@"2015 11 05 18:15:12.000"]]]; - - //Check equal - XCTAssertTrue([self.controlChain isEqualToChain:testChain], @"%s Failed", __PRETTY_FUNCTION__); - - //Check unequal - [testChain addTimePeriod:[DTTimePeriod timePeriodWithStartDate:[self.formatter dateFromString:@"2014 11 05 18:15:12.000"] endDate:[self.formatter dateFromString:@"2015 11 05 18:15:12.000"]]]; - XCTAssertFalse([self.controlChain isEqualToChain:testChain], @"%s Failed", __PRETTY_FUNCTION__); - - //Check same periods out of order - XCTAssertFalse([self.controlChain isEqualToChain:testChainOutOfOrder], @"%s Failed", __PRETTY_FUNCTION__); -} - -@end diff --git a/DateTools/Tests/DateToolsTests/DateToolsTestsTests/DTTimePeriodCollectionTests.m b/DateTools/Tests/DateToolsTests/DateToolsTestsTests/DTTimePeriodCollectionTests.m deleted file mode 100644 index 6e7c86d8..00000000 --- a/DateTools/Tests/DateToolsTests/DateToolsTestsTests/DTTimePeriodCollectionTests.m +++ /dev/null @@ -1,359 +0,0 @@ -// -// DTTimePeriodCollectionTests.m -// DateToolsExample -// -// Created by Matthew York on 3/21/14. -// -// - -#import -#import "DTTimePeriodCollection.h" - -@interface DTTimePeriodCollectionTests : XCTestCase -@property NSDateFormatter *formatter; -@property DTTimePeriodCollection *controlCollection; -@end - -@implementation DTTimePeriodCollectionTests - -- (void)setUp -{ - [super setUp]; - - //Initialize control DTTimePeriodChain - self.controlCollection = [[DTTimePeriodCollection alloc] init]; - - //Initialize formatter - self.formatter = [[NSDateFormatter alloc] init]; - [self.formatter setDateFormat:@"yyyy MM dd HH:mm:ss.SSS"]; - - //Create test DTTimePeriods - DTTimePeriod *firstPeriod = [DTTimePeriod timePeriodWithStartDate:[self.formatter dateFromString:@"2014 11 05 18:15:12.000"] endDate:[self.formatter dateFromString:@"2015 11 05 18:15:12.000"]]; - DTTimePeriod *secondPeriod = [DTTimePeriod timePeriodWithStartDate:[self.formatter dateFromString:@"2015 11 05 18:15:12.000"] endDate:[self.formatter dateFromString:@"2016 11 05 18:15:12.000"]]; - DTTimePeriod *thirdPeriod = [DTTimePeriod timePeriodWithStartDate:[self.formatter dateFromString:@"2016 11 05 18:15:12.000"] endDate:[self.formatter dateFromString:@"2017 11 05 18:15:12.000"]]; - DTTimePeriod *fourthPeriod = [DTTimePeriod timePeriodWithStartDate:[self.formatter dateFromString:@"2015 4 05 18:15:12.000"] endDate:[self.formatter dateFromString:@"2017 4 05 18:15:12.000"]]; - - //Add test periods - [self.controlCollection addTimePeriod:firstPeriod]; - [self.controlCollection addTimePeriod:secondPeriod]; - [self.controlCollection addTimePeriod:thirdPeriod]; - [self.controlCollection addTimePeriod:fourthPeriod]; -} - -- (void)tearDown -{ - // Put teardown code here. This method is called after the invocation of each test method in the class. - [super tearDown]; -} - - -#pragma mark - Custom Init / Factory Methods --(void)testInitsAndFactories{ - DTTimePeriodCollection *initCompareCollection = [[DTTimePeriodCollection alloc] init]; - DTTimePeriodCollection *factoryCompareCollection = [DTTimePeriodCollection collection]; - - XCTAssertTrue([initCompareCollection isEqualToCollection:factoryCompareCollection considerOrder:YES], @"%s Failed", __PRETTY_FUNCTION__); -} - -#pragma mark - Collection Manipulation --(void)testAddTimePeriod{ - //Initialize control DTTimePeriodChain - DTTimePeriodCollection *testCollection = [[DTTimePeriodCollection alloc] init]; - - //Create test DTTimePeriods that are 1 year long - DTTimePeriod *firstPeriod = [DTTimePeriod timePeriodWithStartDate:[self.formatter dateFromString:@"2014 11 05 18:15:12.000"] endDate:[self.formatter dateFromString:@"2015 11 05 18:15:12.000"]]; - DTTimePeriod *secondPeriod = [DTTimePeriod timePeriodWithStartDate:[self.formatter dateFromString:@"2015 11 05 18:15:12.000"] endDate:[self.formatter dateFromString:@"2016 11 05 18:15:12.000"]]; - DTTimePeriod *thirdPeriod = [DTTimePeriod timePeriodWithStartDate:[self.formatter dateFromString:@"2016 11 05 18:15:12.000"] endDate:[self.formatter dateFromString:@"2017 11 05 18:15:12.000"]]; - DTTimePeriod *fourthPeriod = [DTTimePeriod timePeriodWithStartDate:[self.formatter dateFromString:@"2015 4 05 18:15:12.000"] endDate:[self.formatter dateFromString:@"2017 4 05 18:15:12.000"]]; - - //Add test periods - [testCollection addTimePeriod:firstPeriod]; - [testCollection addTimePeriod:secondPeriod]; - [testCollection addTimePeriod:thirdPeriod]; - [testCollection addTimePeriod:fourthPeriod]; - - XCTAssertTrue([self.controlCollection isEqualToCollection:testCollection considerOrder:YES], @"%s Failed", __PRETTY_FUNCTION__); -} --(void)testInsertTimePeriod{ - //Initialize control DTTimePeriodChain - DTTimePeriodCollection *testCollection = [[DTTimePeriodCollection alloc] init]; - - //Create test DTTimePeriods that are 1 year long - DTTimePeriod *firstPeriod = [DTTimePeriod timePeriodWithStartDate:[self.formatter dateFromString:@"2014 11 05 18:15:12.000"] endDate:[self.formatter dateFromString:@"2015 11 05 18:15:12.000"]]; - DTTimePeriod *secondPeriod = [DTTimePeriod timePeriodWithStartDate:[self.formatter dateFromString:@"2015 11 05 18:15:12.000"] endDate:[self.formatter dateFromString:@"2016 11 05 18:15:12.000"]]; - DTTimePeriod *thirdPeriod = [DTTimePeriod timePeriodWithStartDate:[self.formatter dateFromString:@"2016 11 05 18:15:12.000"] endDate:[self.formatter dateFromString:@"2017 11 05 18:15:12.000"]]; - DTTimePeriod *fourthPeriod = [DTTimePeriod timePeriodWithStartDate:[self.formatter dateFromString:@"2015 4 05 18:15:12.000"] endDate:[self.formatter dateFromString:@"2017 4 05 18:15:12.000"]]; - - //Add test periods - [testCollection addTimePeriod:firstPeriod]; - [testCollection addTimePeriod:secondPeriod]; - [testCollection addTimePeriod:fourthPeriod]; - [testCollection insertTimePeriod:thirdPeriod atIndex:2]; - - XCTAssertTrue([self.controlCollection isEqualToCollection:testCollection considerOrder:YES], @"%s Failed", __PRETTY_FUNCTION__); -} --(void)testRemoveTimePeriodAtIndex{ - //Initialize control DTTimePeriodChain - DTTimePeriodCollection *testCollection = [[DTTimePeriodCollection alloc] init]; - - //Create test DTTimePeriods that are 1 year long - DTTimePeriod *firstPeriod = [DTTimePeriod timePeriodWithStartDate:[self.formatter dateFromString:@"2014 11 05 18:15:12.000"] endDate:[self.formatter dateFromString:@"2015 11 05 18:15:12.000"]]; - DTTimePeriod *thirdPeriod = [DTTimePeriod timePeriodWithStartDate:[self.formatter dateFromString:@"2016 11 05 18:15:12.000"] endDate:[self.formatter dateFromString:@"2017 11 05 18:15:12.000"]]; - DTTimePeriod *fourthPeriod = [DTTimePeriod timePeriodWithStartDate:[self.formatter dateFromString:@"2015 4 05 18:15:12.000"] endDate:[self.formatter dateFromString:@"2017 4 05 18:15:12.000"]]; - - //Add test periods - [testCollection addTimePeriod:firstPeriod]; - [testCollection addTimePeriod:thirdPeriod]; - [testCollection addTimePeriod:fourthPeriod]; - - //Remove time period from control - [self.controlCollection removeTimePeriodAtIndex:1]; - - XCTAssertTrue([self.controlCollection isEqualToCollection:testCollection considerOrder:YES], @"%s Failed", __PRETTY_FUNCTION__); -} - -#pragma mark - Chain Time Manipulation --(void)testShiftEarlier{ - //Create test chain - DTTimePeriodCollection *testCollectionOriginal = [DTTimePeriodCollection collection]; - [testCollectionOriginal addTimePeriod:[DTTimePeriod timePeriodWithStartDate:[self.formatter dateFromString:@"2012 11 05 18:15:12.000"] endDate:[self.formatter dateFromString:@"2013 11 05 18:15:12.000"]]]; - [testCollectionOriginal addTimePeriod:[DTTimePeriod timePeriodWithStartDate:[self.formatter dateFromString:@"2013 11 05 18:15:12.000"] endDate:[self.formatter dateFromString:@"2014 11 05 18:15:12.000"]]]; - [testCollectionOriginal addTimePeriod:[DTTimePeriod timePeriodWithStartDate:[self.formatter dateFromString:@"2014 11 05 18:15:12.000"] endDate:[self.formatter dateFromString:@"2015 11 05 18:15:12.000"]]]; - [testCollectionOriginal addTimePeriod:[DTTimePeriod timePeriodWithStartDate:[self.formatter dateFromString:@"2013 4 05 18:15:12.000"] endDate:[self.formatter dateFromString:@"2015 4 05 18:15:12.000"]]]; - - //Create test chain - DTTimePeriodCollection *controlCopy = [self.controlCollection copy]; - - //Shift control chain - [self.controlCollection shiftEarlierWithSize:DTTimePeriodSizeYear amount:2]; - - //Check equal - XCTAssertTrue([self.controlCollection isEqualToCollection:testCollectionOriginal considerOrder:YES], @"%s Failed", __PRETTY_FUNCTION__); - - //Check equal - XCTAssertFalse([self.controlCollection isEqualToCollection:controlCopy considerOrder:YES], @"%s Failed", __PRETTY_FUNCTION__); -} - --(void)testShiftLater{ - //Create test chain - DTTimePeriodCollection *testCollectionOriginal = [DTTimePeriodCollection collection]; - [testCollectionOriginal addTimePeriod:[DTTimePeriod timePeriodWithStartDate:[self.formatter dateFromString:@"2016 11 05 18:15:12.000"] endDate:[self.formatter dateFromString:@"2017 11 05 18:15:12.000"]]]; - [testCollectionOriginal addTimePeriod:[DTTimePeriod timePeriodWithStartDate:[self.formatter dateFromString:@"2017 11 05 18:15:12.000"] endDate:[self.formatter dateFromString:@"2018 11 05 18:15:12.000"]]]; - [testCollectionOriginal addTimePeriod:[DTTimePeriod timePeriodWithStartDate:[self.formatter dateFromString:@"2018 11 05 18:15:12.000"] endDate:[self.formatter dateFromString:@"2019 11 05 18:15:12.000"]]]; - [testCollectionOriginal addTimePeriod:[DTTimePeriod timePeriodWithStartDate:[self.formatter dateFromString:@"2017 4 05 18:15:12.000"] endDate:[self.formatter dateFromString:@"2019 4 05 18:15:12.000"]]]; - - //Create test chain - DTTimePeriodCollection *controlCopy = [self.controlCollection copy]; - - //Shift control chain - [self.controlCollection shiftLaterWithSize:DTTimePeriodSizeYear amount:2]; - - //Check equal - XCTAssertTrue([self.controlCollection isEqualToCollection:testCollectionOriginal considerOrder:YES], @"%s Failed", __PRETTY_FUNCTION__); - - //Check equal - XCTAssertFalse([self.controlCollection isEqualToCollection:controlCopy considerOrder:YES], @"%s Failed", __PRETTY_FUNCTION__); -} - - -#pragma mark - Sorting --(void)testSortByStartAscending{ - //Create ordered array - DTTimePeriodCollection *testCollectionOrdered = [DTTimePeriodCollection collection]; - [testCollectionOrdered addTimePeriod:[DTTimePeriod timePeriodWithStartDate:[self.formatter dateFromString:@"2014 11 05 18:15:12.000"] endDate:[self.formatter dateFromString:@"2015 11 05 18:15:12.000"]]]; - [testCollectionOrdered addTimePeriod:[DTTimePeriod timePeriodWithStartDate:[self.formatter dateFromString:@"2015 4 05 18:15:12.000"] endDate:[self.formatter dateFromString:@"2017 4 05 18:15:12.000"]]]; - [testCollectionOrdered addTimePeriod:[DTTimePeriod timePeriodWithStartDate:[self.formatter dateFromString:@"2015 11 05 18:15:12.000"] endDate:[self.formatter dateFromString:@"2016 11 05 18:15:12.000"]]]; - [testCollectionOrdered addTimePeriod:[DTTimePeriod timePeriodWithStartDate:[self.formatter dateFromString:@"2016 11 05 18:15:12.000"] endDate:[self.formatter dateFromString:@"2017 11 05 18:15:12.000"]]]; - - //Sort control - [self.controlCollection sortByStartAscending]; - - XCTAssertTrue([self.controlCollection isEqualToCollection:testCollectionOrdered considerOrder:YES], @"%s Failed", __PRETTY_FUNCTION__); -} --(void)testSortByStartDescending{ - //Create ordered array - DTTimePeriodCollection *testCollectionOrdered = [DTTimePeriodCollection collection]; - [testCollectionOrdered addTimePeriod:[DTTimePeriod timePeriodWithStartDate:[self.formatter dateFromString:@"2016 11 05 18:15:12.000"] endDate:[self.formatter dateFromString:@"2017 11 05 18:15:12.000"]]]; - [testCollectionOrdered addTimePeriod:[DTTimePeriod timePeriodWithStartDate:[self.formatter dateFromString:@"2015 11 05 18:15:12.000"] endDate:[self.formatter dateFromString:@"2016 11 05 18:15:12.000"]]]; - [testCollectionOrdered addTimePeriod:[DTTimePeriod timePeriodWithStartDate:[self.formatter dateFromString:@"2015 4 05 18:15:12.000"] endDate:[self.formatter dateFromString:@"2017 4 05 18:15:12.000"]]]; - [testCollectionOrdered addTimePeriod:[DTTimePeriod timePeriodWithStartDate:[self.formatter dateFromString:@"2014 11 05 18:15:12.000"] endDate:[self.formatter dateFromString:@"2015 11 05 18:15:12.000"]]]; - - //Sort control - [self.controlCollection sortByStartDescending]; - - XCTAssertTrue([self.controlCollection isEqualToCollection:testCollectionOrdered considerOrder:YES], @"%s Failed", __PRETTY_FUNCTION__); -} --(void)testSortByEndAscending{ - //Create ordered array - DTTimePeriodCollection *testCollectionOrdered = [DTTimePeriodCollection collection]; - [testCollectionOrdered addTimePeriod:[DTTimePeriod timePeriodWithStartDate:[self.formatter dateFromString:@"2014 11 05 18:15:12.000"] endDate:[self.formatter dateFromString:@"2015 11 05 18:15:12.000"]]]; - [testCollectionOrdered addTimePeriod:[DTTimePeriod timePeriodWithStartDate:[self.formatter dateFromString:@"2015 11 05 18:15:12.000"] endDate:[self.formatter dateFromString:@"2016 11 05 18:15:12.000"]]]; - [testCollectionOrdered addTimePeriod:[DTTimePeriod timePeriodWithStartDate:[self.formatter dateFromString:@"2015 4 05 18:15:12.000"] endDate:[self.formatter dateFromString:@"2017 4 05 18:15:12.000"]]]; - [testCollectionOrdered addTimePeriod:[DTTimePeriod timePeriodWithStartDate:[self.formatter dateFromString:@"2016 11 05 18:15:12.000"] endDate:[self.formatter dateFromString:@"2017 11 05 18:15:12.000"]]]; - - //Sort control - [self.controlCollection sortByEndAscending]; - - XCTAssertTrue([self.controlCollection isEqualToCollection:testCollectionOrdered considerOrder:YES], @"%s Failed", __PRETTY_FUNCTION__); -} --(void)testSortByEndDescending{ - //Create ordered array - DTTimePeriodCollection *testCollectionOrdered = [DTTimePeriodCollection collection]; - [testCollectionOrdered addTimePeriod:[DTTimePeriod timePeriodWithStartDate:[self.formatter dateFromString:@"2016 11 05 18:15:12.000"] endDate:[self.formatter dateFromString:@"2017 11 05 18:15:12.000"]]]; - [testCollectionOrdered addTimePeriod:[DTTimePeriod timePeriodWithStartDate:[self.formatter dateFromString:@"2015 4 05 18:15:12.000"] endDate:[self.formatter dateFromString:@"2017 4 05 18:15:12.000"]]]; - [testCollectionOrdered addTimePeriod:[DTTimePeriod timePeriodWithStartDate:[self.formatter dateFromString:@"2015 11 05 18:15:12.000"] endDate:[self.formatter dateFromString:@"2016 11 05 18:15:12.000"]]]; - [testCollectionOrdered addTimePeriod:[DTTimePeriod timePeriodWithStartDate:[self.formatter dateFromString:@"2014 11 05 18:15:12.000"] endDate:[self.formatter dateFromString:@"2015 11 05 18:15:12.000"]]]; - - //Sort control - [self.controlCollection sortByEndDescending]; - - XCTAssertTrue([self.controlCollection isEqualToCollection:testCollectionOrdered considerOrder:YES], @"%s Failed", __PRETTY_FUNCTION__); -} --(void)testSortByDurationAscending{ - //Create some time periods to sort - DTTimePeriod *period2Days = [DTTimePeriod timePeriodWithStartDate:[self.formatter dateFromString:@"2016 11 04 18:15:12.000"] endDate:[self.formatter dateFromString:@"2016 11 06 18:15:12.000"]]; - DTTimePeriod *period4Months = [DTTimePeriod timePeriodWithStartDate:[self.formatter dateFromString:@"2015 07 05 18:15:12.000"] endDate:[self.formatter dateFromString:@"2015 11 05 18:15:12.000"]]; - DTTimePeriod *period5Months = [DTTimePeriod timePeriodWithStartDate:[self.formatter dateFromString:@"2015 06 05 18:15:12.000"] endDate:[self.formatter dateFromString:@"2015 11 05 18:15:12.000"]]; - DTTimePeriod *period2years = [DTTimePeriod timePeriodWithStartDate:[self.formatter dateFromString:@"2015 4 05 18:15:12.000"] endDate:[self.formatter dateFromString:@"2017 4 05 18:15:12.000"]]; - - //Create unordered array - DTTimePeriodCollection *testCollectionUnordered = [DTTimePeriodCollection collection]; - [testCollectionUnordered addTimePeriod:period2years]; - [testCollectionUnordered addTimePeriod:period5Months]; - [testCollectionUnordered addTimePeriod:period4Months]; - [testCollectionUnordered addTimePeriod:period2Days]; - - //Create ordered array - DTTimePeriodCollection *testCollectionOrdered = [DTTimePeriodCollection collection]; - [testCollectionOrdered addTimePeriod:period2Days]; - [testCollectionOrdered addTimePeriod:period4Months]; - [testCollectionOrdered addTimePeriod:period5Months]; - [testCollectionOrdered addTimePeriod:period2years]; - - //Sort unordered - [testCollectionUnordered sortByDurationAscending]; - - XCTAssertTrue([testCollectionUnordered isEqualToCollection:testCollectionOrdered considerOrder:YES], @"%s Failed", __PRETTY_FUNCTION__); -} --(void)testSortByDurationDescending{ - //Create some time periods to sort - DTTimePeriod *period2Days = [DTTimePeriod timePeriodWithStartDate:[self.formatter dateFromString:@"2016 11 04 18:15:12.000"] endDate:[self.formatter dateFromString:@"2016 11 06 18:15:12.000"]]; - DTTimePeriod *period4Months = [DTTimePeriod timePeriodWithStartDate:[self.formatter dateFromString:@"2015 07 05 18:15:12.000"] endDate:[self.formatter dateFromString:@"2015 11 05 18:15:12.000"]]; - DTTimePeriod *period5Months = [DTTimePeriod timePeriodWithStartDate:[self.formatter dateFromString:@"2015 06 05 18:15:12.000"] endDate:[self.formatter dateFromString:@"2015 11 05 18:15:12.000"]]; - DTTimePeriod *period2years = [DTTimePeriod timePeriodWithStartDate:[self.formatter dateFromString:@"2015 4 05 18:15:12.000"] endDate:[self.formatter dateFromString:@"2017 4 05 18:15:12.000"]]; - - //Create unordered array - DTTimePeriodCollection *testCollectionUnordered = [DTTimePeriodCollection collection]; - [testCollectionUnordered addTimePeriod:period4Months]; - [testCollectionUnordered addTimePeriod:period2Days]; - [testCollectionUnordered addTimePeriod:period2years]; - [testCollectionUnordered addTimePeriod:period5Months]; - - //Create ordered array - DTTimePeriodCollection *testCollectionOrdered = [DTTimePeriodCollection collection]; - [testCollectionOrdered addTimePeriod:period2years]; - [testCollectionOrdered addTimePeriod:period5Months]; - [testCollectionOrdered addTimePeriod:period4Months]; - [testCollectionOrdered addTimePeriod:period2Days]; - - //Sort unordered - [testCollectionUnordered sortByDurationDescending]; - - XCTAssertTrue([testCollectionUnordered isEqualToCollection:testCollectionOrdered considerOrder:YES], @"%s Failed", __PRETTY_FUNCTION__); -} - -#pragma mark - Collection Relationship --(void)testPeriodsInside{ - //Check positve match - DTTimePeriod *testPeriodMatch = [DTTimePeriod timePeriodWithStartDate:[self.formatter dateFromString:@"2014 11 05 18:15:12.000"] endDate:[self.formatter dateFromString:@"2015 11 06 18:15:12.000"]]; - DTTimePeriodCollection *testCollectionMatch = [DTTimePeriodCollection collection]; - [testCollectionMatch addTimePeriod:self.controlCollection[0]]; - - XCTAssertTrue([testCollectionMatch isEqualToCollection:[self.controlCollection periodsInside:testPeriodMatch] considerOrder:YES], @"%s Failed", __PRETTY_FUNCTION__); - - - //Check too narrow - DTTimePeriod *testPeriodNarrow = [DTTimePeriod timePeriodWithStartDate:[self.formatter dateFromString:@"2014 11 06 18:15:12.000"] endDate:[self.formatter dateFromString:@"2015 11 02 18:15:12.000"]]; - DTTimePeriodCollection *testCollectionNarrow = [DTTimePeriodCollection collection]; - - XCTAssertTrue([testCollectionNarrow isEqualToCollection:[self.controlCollection periodsInside:testPeriodNarrow] considerOrder:YES], @"%s Failed", __PRETTY_FUNCTION__); - - //Random no - XCTAssertFalse([self.controlCollection isEqualToCollection:[self.controlCollection periodsInside:testPeriodMatch] considerOrder:YES], @"%s Failed", __PRETTY_FUNCTION__); -} --(void)testPeriodsIntersectedByDate{ - //Check positve match - NSDate *testDate = [self.formatter dateFromString:@"2015 11 05 18:15:12.000"]; - DTTimePeriodCollection *testCollectionMatch = [DTTimePeriodCollection collection]; - [testCollectionMatch addTimePeriod:self.controlCollection[0]]; - [testCollectionMatch addTimePeriod:self.controlCollection[1]]; - [testCollectionMatch addTimePeriod:self.controlCollection[3]]; - - XCTAssertTrue([testCollectionMatch isEqualToCollection:[self.controlCollection periodsIntersectedByDate:testDate] considerOrder:NO], @"%s Failed", __PRETTY_FUNCTION__); -} --(void)testPeriodsIntersectedByPeriod{ - //Check positve match - DTTimePeriod *testPeriodMatch = [DTTimePeriod timePeriodWithStartDate:[self.formatter dateFromString:@"2014 11 05 18:15:12.000"] endDate:[self.formatter dateFromString:@"2015 11 05 18:15:12.000"]]; - DTTimePeriodCollection *testCollectionMatch = [DTTimePeriodCollection collection]; - [testCollectionMatch addTimePeriod:self.controlCollection[0]]; - [testCollectionMatch addTimePeriod:self.controlCollection[1]]; - [testCollectionMatch addTimePeriod:self.controlCollection[3]]; - - XCTAssertTrue([testCollectionMatch isEqualToCollection:[self.controlCollection periodsIntersectedByPeriod:testPeriodMatch] considerOrder:NO], @"%s Failed", __PRETTY_FUNCTION__); - - //Check too early - DTTimePeriod *testPeriodEarly = [DTTimePeriod timePeriodWithStartDate:[self.formatter dateFromString:@"2012 11 06 18:15:12.000"] endDate:[self.formatter dateFromString:@"2013 11 02 18:15:12.000"]]; - DTTimePeriodCollection *testCollectionEarly = [DTTimePeriodCollection collection]; - - XCTAssertTrue([testCollectionEarly isEqualToCollection:[self.controlCollection periodsIntersectedByPeriod:testPeriodEarly] considerOrder:NO], @"%s Failed", __PRETTY_FUNCTION__); - - //Random no - XCTAssertFalse([self.controlCollection isEqualToCollection:[self.controlCollection periodsIntersectedByPeriod:testPeriodMatch] considerOrder:NO], @"%s Failed", __PRETTY_FUNCTION__); -} --(void)testPeriodsOverlappedByPeriod{ - //Check positve match - DTTimePeriod *testPeriodMatch = [DTTimePeriod timePeriodWithStartDate:[self.formatter dateFromString:@"2014 11 05 18:15:12.000"] endDate:[self.formatter dateFromString:@"2015 11 05 18:15:12.000"]]; - DTTimePeriodCollection *testCollectionMatch = [DTTimePeriodCollection collection]; - [testCollectionMatch addTimePeriod:self.controlCollection[0]]; - [testCollectionMatch addTimePeriod:self.controlCollection[3]]; - - XCTAssertTrue([testCollectionMatch isEqualToCollection:[self.controlCollection periodsOverlappedByPeriod:testPeriodMatch] considerOrder:NO], @"%s Failed", __PRETTY_FUNCTION__); - - - //Check too early - DTTimePeriod *testPeriodEarly = [DTTimePeriod timePeriodWithStartDate:[self.formatter dateFromString:@"2012 11 06 18:15:12.000"] endDate:[self.formatter dateFromString:@"2013 11 02 18:15:12.000"]]; - DTTimePeriodCollection *testCollectionEarly = [DTTimePeriodCollection collection]; - - XCTAssertTrue([testCollectionEarly isEqualToCollection:[self.controlCollection periodsOverlappedByPeriod:testPeriodEarly] considerOrder:NO], @"%s Failed", __PRETTY_FUNCTION__); - - //Random no - XCTAssertFalse([self.controlCollection isEqualToCollection:[self.controlCollection periodsOverlappedByPeriod:testPeriodMatch] considerOrder:NO], @"%s Failed", __PRETTY_FUNCTION__); -} --(void)testIsEqualToCollection{ - //Create test chains - DTTimePeriodCollection *testCollection = [DTTimePeriodCollection collection]; - [testCollection addTimePeriod:[DTTimePeriod timePeriodWithStartDate:[self.formatter dateFromString:@"2014 11 05 18:15:12.000"] endDate:[self.formatter dateFromString:@"2015 11 05 18:15:12.000"]]]; - [testCollection addTimePeriod:[DTTimePeriod timePeriodWithStartDate:[self.formatter dateFromString:@"2015 11 05 18:15:12.000"] endDate:[self.formatter dateFromString:@"2016 11 05 18:15:12.000"]]]; - [testCollection addTimePeriod:[DTTimePeriod timePeriodWithStartDate:[self.formatter dateFromString:@"2016 11 05 18:15:12.000"] endDate:[self.formatter dateFromString:@"2017 11 05 18:15:12.000"]]]; - [testCollection addTimePeriod:[DTTimePeriod timePeriodWithStartDate:[self.formatter dateFromString:@"2015 4 05 18:15:12.000"] endDate:[self.formatter dateFromString:@"2017 4 05 18:15:12.000"]]]; - - - DTTimePeriodCollection *testCollectionOutOfOrder = [DTTimePeriodCollection collection]; - [testCollectionOutOfOrder addTimePeriod:[DTTimePeriod timePeriodWithStartDate:[self.formatter dateFromString:@"2015 4 05 18:15:12.000"] endDate:[self.formatter dateFromString:@"2017 4 05 18:15:12.000"]]]; - [testCollectionOutOfOrder addTimePeriod:[DTTimePeriod timePeriodWithStartDate:[self.formatter dateFromString:@"2015 11 05 18:15:12.000"] endDate:[self.formatter dateFromString:@"2016 11 05 18:15:12.000"]]]; - [testCollectionOutOfOrder addTimePeriod:[DTTimePeriod timePeriodWithStartDate:[self.formatter dateFromString:@"2016 11 05 18:15:12.000"] endDate:[self.formatter dateFromString:@"2017 11 05 18:15:12.000"]]]; - [testCollectionOutOfOrder addTimePeriod:[DTTimePeriod timePeriodWithStartDate:[self.formatter dateFromString:@"2014 11 05 18:15:12.000"] endDate:[self.formatter dateFromString:@"2015 11 05 18:15:12.000"]]]; - - //Check equal - XCTAssertTrue([self.controlCollection isEqualToCollection:testCollection considerOrder:YES], @"%s Failed", __PRETTY_FUNCTION__); - - //Check unequal - [testCollection addTimePeriod:[DTTimePeriod timePeriodWithStartDate:[self.formatter dateFromString:@"2014 11 05 18:15:12.000"] endDate:[self.formatter dateFromString:@"2015 11 05 18:15:12.000"]]]; - XCTAssertFalse([self.controlCollection isEqualToCollection:testCollection considerOrder:NO], @"%s Failed", __PRETTY_FUNCTION__); - - //Check same periods out of order - XCTAssertTrue([self.controlCollection isEqualToCollection:testCollectionOutOfOrder considerOrder:NO], @"%s Failed", __PRETTY_FUNCTION__); - XCTAssertFalse([self.controlCollection isEqualToCollection:testCollectionOutOfOrder considerOrder:YES], @"%s Failed", __PRETTY_FUNCTION__); -} - -@end diff --git a/DateTools/Tests/DateToolsTests/DateToolsTestsTests/DTTimePeriodGroupTests.m b/DateTools/Tests/DateToolsTests/DateToolsTestsTests/DTTimePeriodGroupTests.m deleted file mode 100644 index 79ca5a6f..00000000 --- a/DateTools/Tests/DateToolsTests/DateToolsTestsTests/DTTimePeriodGroupTests.m +++ /dev/null @@ -1,106 +0,0 @@ -// -// DTTimePeriodGroupTests.m -// DateToolsExample -// -// Created by Matthew York on 3/22/14. -// -// - -#import -#import "DTTimePeriodCollection.h" -#import "DTTimePeriodChain.h" - -@interface DTTimePeriodGroupTests : XCTestCase -@property NSDateFormatter *formatter; -@property DTTimePeriodCollection *controlCollection; -@end - -@implementation DTTimePeriodGroupTests - -- (void)setUp -{ - [super setUp]; - - //Initialize control DTTimePeriodChain - self.controlCollection = [[DTTimePeriodCollection alloc] init]; - - //Initialize formatter - self.formatter = [[NSDateFormatter alloc] init]; - [self.formatter setDateFormat:@"yyyy MM dd HH:mm:ss.SSS"]; - - //Create test DTTimePeriods that are 1 year long - DTTimePeriod *firstPeriod = [DTTimePeriod timePeriodWithStartDate:[self.formatter dateFromString:@"2014 11 05 18:15:12.000"] endDate:[self.formatter dateFromString:@"2015 11 05 18:15:12.000"]]; - DTTimePeriod *secondPeriod = [DTTimePeriod timePeriodWithStartDate:[self.formatter dateFromString:@"2015 11 05 18:15:12.000"] endDate:[self.formatter dateFromString:@"2016 11 05 18:15:12.000"]]; - DTTimePeriod *thirdPeriod = [DTTimePeriod timePeriodWithStartDate:[self.formatter dateFromString:@"2016 11 05 18:15:12.000"] endDate:[self.formatter dateFromString:@"2017 11 05 18:15:12.000"]]; - DTTimePeriod *fourthPeriod = [DTTimePeriod timePeriodWithStartDate:[self.formatter dateFromString:@"2015 4 05 18:15:12.000"] endDate:[self.formatter dateFromString:@"2017 4 05 18:15:12.000"]]; - - //Add test periods - [self.controlCollection addTimePeriod:firstPeriod]; - [self.controlCollection addTimePeriod:secondPeriod]; - [self.controlCollection addTimePeriod:thirdPeriod]; - [self.controlCollection addTimePeriod:fourthPeriod]; -} - -- (void)tearDown -{ - // Put teardown code here. This method is called after the invocation of each test method in the class. - [super tearDown]; -} - - -#pragma mark - Group Info --(void)testDurationInYears{ - XCTAssertEqual(3, self.controlCollection.durationInYears, @"%s Failed", __PRETTY_FUNCTION__); -} - --(void)testDurationInWeeks{ - XCTAssertEqual(156, self.controlCollection.durationInWeeks, @"%s Failed", __PRETTY_FUNCTION__); -} --(void)testDurationInDays{ - XCTAssertEqual(1096, self.controlCollection.durationInDays, @"%s Failed", __PRETTY_FUNCTION__); -} --(void)testDurationInHours{ - XCTAssertEqual(26304, self.controlCollection.durationInHours, @"%s Failed", __PRETTY_FUNCTION__); -} --(void)testDurationInMinutes{ - XCTAssertEqual(1578240, self.controlCollection.durationInMinutes, @"%s Failed", __PRETTY_FUNCTION__); -} --(void)testDurationInSeconds{ - XCTAssertEqual(94694400, self.controlCollection.durationInSeconds, @"%s Failed", __PRETTY_FUNCTION__); -} - -#pragma mark - Comparison --(void)testHasSameCharacteristicsAs{ - DTTimePeriodCollection *collectionSame = [[DTTimePeriodCollection alloc] init]; - DTTimePeriodChain *chain = [[DTTimePeriodChain alloc] init]; - - //Create test DTTimePeriods to construct same as control - DTTimePeriod *firstPeriod = [DTTimePeriod timePeriodWithStartDate:[self.formatter dateFromString:@"2014 11 05 18:15:12.000"] endDate:[self.formatter dateFromString:@"2015 11 05 18:15:12.000"]]; - DTTimePeriod *secondPeriod = [DTTimePeriod timePeriodWithStartDate:[self.formatter dateFromString:@"2015 11 05 18:15:12.000"] endDate:[self.formatter dateFromString:@"2016 11 05 18:15:12.000"]]; - DTTimePeriod *thirdPeriod = [DTTimePeriod timePeriodWithStartDate:[self.formatter dateFromString:@"2016 11 05 18:15:12.000"] endDate:[self.formatter dateFromString:@"2017 11 05 18:15:12.000"]]; - DTTimePeriod *fourthPeriod = [DTTimePeriod timePeriodWithStartDate:[self.formatter dateFromString:@"2015 4 05 18:15:12.000"] endDate:[self.formatter dateFromString:@"2017 4 05 18:15:12.000"]]; - DTTimePeriod *alternateFourthPeriod = [DTTimePeriod timePeriodWithStartDate:[self.formatter dateFromString:@"2016 4 05 18:15:12.000"] endDate:[self.formatter dateFromString:@"2017 4 05 18:15:12.000"]]; - - //Add test periods - [collectionSame addTimePeriod:firstPeriod]; - [collectionSame addTimePeriod:secondPeriod]; - [collectionSame addTimePeriod:thirdPeriod]; - [collectionSame addTimePeriod:fourthPeriod]; - [chain addTimePeriod:firstPeriod]; - [chain addTimePeriod:secondPeriod]; - [chain addTimePeriod:thirdPeriod]; - [chain addTimePeriod:fourthPeriod]; - - //Test same as control - XCTAssertTrue([self.controlCollection hasSameCharacteristicsAs:collectionSame], @"%s Failed", __PRETTY_FUNCTION__); - - //Test differnt chain - XCTAssertFalse([self.controlCollection hasSameCharacteristicsAs:chain], @"%s Failed", __PRETTY_FUNCTION__); - - //Test alternate - [collectionSame removeTimePeriodAtIndex:3]; - [collectionSame addTimePeriod:alternateFourthPeriod]; - XCTAssertTrue([self.controlCollection hasSameCharacteristicsAs:collectionSame], @"%s Failed", __PRETTY_FUNCTION__); -} - -@end diff --git a/DateTools/Tests/DateToolsTests/DateToolsTestsTests/DTTimePeriodTests.m b/DateTools/Tests/DateToolsTests/DateToolsTestsTests/DTTimePeriodTests.m deleted file mode 100644 index b0e15158..00000000 --- a/DateTools/Tests/DateToolsTests/DateToolsTestsTests/DTTimePeriodTests.m +++ /dev/null @@ -1,634 +0,0 @@ -// -// DTTimePeriodTests.m -// DateToolsExample -// -// Created by Matthew York on 3/19/14. -// -// - -#import -#import "DTTimePeriod.h" -#import "NSDate+DateTools.h" - -@interface DTTimePeriodTests : XCTestCase -@property NSDateFormatter *formatter; -@property DTTimePeriod *controlTimePeriod; -@end - -@implementation DTTimePeriodTests - -- (void)setUp -{ - [super setUp]; - // Put setup code here. This method is called before the invocation of each test method in the class. - self.controlTimePeriod = [[DTTimePeriod alloc] init]; - - //Create TimePeriod that is 2 years long - self.formatter = [[NSDateFormatter alloc] init]; - [self.formatter setDateFormat:@"yyyy MM dd HH:mm:ss.SSS"]; - self.controlTimePeriod.StartDate = [self.formatter dateFromString:@"2014 11 05 18:15:12.000"]; - self.controlTimePeriod.EndDate = [self.formatter dateFromString:@"2016 11 05 18:15:12.000"]; -} - -- (void)tearDown -{ - // Put teardown code here. This method is called after the invocation of each test method in the class. - [super tearDown]; -} - -#pragma mark - Custom Init / Factory Methods --(void)testBasicInitsAndFactoryMethods{ - //Basic init - DTTimePeriod *testPeriodInit = [[DTTimePeriod alloc] initWithStartDate:self.controlTimePeriod.StartDate endDate:self.controlTimePeriod.EndDate]; - XCTAssertTrue([self.controlTimePeriod.StartDate isEqualToDate:testPeriodInit.StartDate] && [self.controlTimePeriod.EndDate isEqualToDate:testPeriodInit.EndDate], @"%s Failed", __PRETTY_FUNCTION__); - - //Basic factory - DTTimePeriod *testPeriodFactoryInit = [DTTimePeriod timePeriodWithStartDate:self.controlTimePeriod.StartDate endDate:self.controlTimePeriod.EndDate]; - XCTAssertTrue([self.controlTimePeriod.StartDate isEqualToDate:testPeriodFactoryInit.StartDate] && [self.controlTimePeriod.EndDate isEqualToDate:testPeriodFactoryInit.EndDate], @"%s Failed", __PRETTY_FUNCTION__); -} --(void)testFactoryStartingAt{ - //Test dates - NSDate *startLaterSecond = [self.formatter dateFromString:@"2014 11 05 18:15:13.000"]; - NSDate *startLaterMinute = [self.formatter dateFromString:@"2014 11 05 18:16:12.000"]; - NSDate *startLaterHour = [self.formatter dateFromString:@"2014 11 05 19:15:12.000"]; - NSDate *startLaterDay = [self.formatter dateFromString:@"2014 11 06 18:15:12.000"]; - NSDate *startLaterWeek = [self.formatter dateFromString:@"2014 11 12 18:15:12.000"]; - NSDate *startLaterMonth = [self.formatter dateFromString:@"2014 12 05 18:15:12.000"]; - NSDate *startLaterYear = [self.formatter dateFromString:@"2015 11 05 18:15:12.000"]; - - //Starting At - //Second time period - DTTimePeriod *testPeriodSecond = [DTTimePeriod timePeriodWithSize:DTTimePeriodSizeSecond startingAt:self.controlTimePeriod.StartDate]; - XCTAssertTrue([testPeriodSecond.StartDate isEqualToDate:self.controlTimePeriod.StartDate] && [testPeriodSecond.EndDate isEqualToDate:startLaterSecond], @"%s Failed", __PRETTY_FUNCTION__); - - //Minute time period - DTTimePeriod *testPeriodMinute = [DTTimePeriod timePeriodWithSize:DTTimePeriodSizeMinute startingAt:self.controlTimePeriod.StartDate]; - XCTAssertTrue([testPeriodMinute.StartDate isEqualToDate:self.controlTimePeriod.StartDate] && [testPeriodMinute.EndDate isEqualToDate:startLaterMinute], @"%s Failed", __PRETTY_FUNCTION__); - - //Hour time period - DTTimePeriod *testPeriodHour = [DTTimePeriod timePeriodWithSize:DTTimePeriodSizeHour startingAt:self.controlTimePeriod.StartDate]; - XCTAssertTrue([testPeriodHour.StartDate isEqualToDate:self.controlTimePeriod.StartDate] && [testPeriodHour.EndDate isEqualToDate:startLaterHour], @"%s Failed", __PRETTY_FUNCTION__); - - //Day time period - DTTimePeriod *testPeriodDay = [DTTimePeriod timePeriodWithSize:DTTimePeriodSizeDay startingAt:self.controlTimePeriod.StartDate]; - XCTAssertTrue([testPeriodDay.StartDate isEqualToDate:self.controlTimePeriod.StartDate] && [testPeriodDay.EndDate isEqualToDate:startLaterDay], @"%s Failed", __PRETTY_FUNCTION__); - - //Week time period - DTTimePeriod *testPeriodWeek = [DTTimePeriod timePeriodWithSize:DTTimePeriodSizeWeek startingAt:self.controlTimePeriod.StartDate]; - XCTAssertTrue([testPeriodWeek.StartDate isEqualToDate:self.controlTimePeriod.StartDate] && [testPeriodWeek.EndDate isEqualToDate:startLaterWeek], @"%s Failed", __PRETTY_FUNCTION__); - - //Month time period - DTTimePeriod *testPeriodMonth = [DTTimePeriod timePeriodWithSize:DTTimePeriodSizeMonth startingAt:self.controlTimePeriod.StartDate]; - XCTAssertTrue([testPeriodMonth.StartDate isEqualToDate:self.controlTimePeriod.StartDate] && [testPeriodMonth.EndDate isEqualToDate:startLaterMonth], @"%s Failed", __PRETTY_FUNCTION__); - - //Year time period - DTTimePeriod *testPeriodYear = [DTTimePeriod timePeriodWithSize:DTTimePeriodSizeYear startingAt:self.controlTimePeriod.StartDate]; - XCTAssertTrue([testPeriodYear.StartDate isEqualToDate:self.controlTimePeriod.StartDate] && [testPeriodYear.EndDate isEqualToDate:startLaterYear], @"%s Failed", __PRETTY_FUNCTION__); -} --(void)testFactoryEndingAt { - //Test End dates - NSDate *endEarlierSecond = [self.formatter dateFromString:@"2016 11 05 18:15:11.000"]; - NSDate *endEarlierMinute = [self.formatter dateFromString:@"2016 11 05 18:14:12.000"]; - NSDate *endEarlierHour = [self.formatter dateFromString:@"2016 11 05 17:15:12.000"]; - NSDate *endEarlierDay = [self.formatter dateFromString:@"2016 11 04 18:15:12.000"]; - NSDate *endEarlierWeek = [self.formatter dateFromString:@"2016 10 29 18:15:12.000"]; - NSDate *endEarlierMonth = [self.formatter dateFromString:@"2016 10 05 18:15:12.000"]; - NSDate *endEarlierYear = [self.formatter dateFromString:@"2015 11 05 18:15:12.000"]; - - //Ending At - //Second time period - DTTimePeriod *testPeriodSecond = [DTTimePeriod timePeriodWithSize:DTTimePeriodSizeSecond endingAt:self.controlTimePeriod.EndDate]; - XCTAssertTrue([testPeriodSecond.StartDate isEqualToDate:endEarlierSecond] && [testPeriodSecond.EndDate isEqualToDate:self.controlTimePeriod.EndDate], @"%s Failed", __PRETTY_FUNCTION__); - - //Minute time period - DTTimePeriod *testPeriodMinute = [DTTimePeriod timePeriodWithSize:DTTimePeriodSizeMinute endingAt:self.controlTimePeriod.EndDate]; - XCTAssertTrue([testPeriodMinute.StartDate isEqualToDate:endEarlierMinute] && [testPeriodMinute.EndDate isEqualToDate:self.controlTimePeriod.EndDate], @"%s Failed", __PRETTY_FUNCTION__); - - //Hour time period - DTTimePeriod *testPeriodHour = [DTTimePeriod timePeriodWithSize:DTTimePeriodSizeHour endingAt:self.controlTimePeriod.EndDate]; - XCTAssertTrue([testPeriodHour.StartDate isEqualToDate:endEarlierHour] && [testPeriodHour.EndDate isEqualToDate:self.controlTimePeriod.EndDate], @"%s Failed", __PRETTY_FUNCTION__); - - //Day time period - DTTimePeriod *testPeriodDay = [DTTimePeriod timePeriodWithSize:DTTimePeriodSizeDay endingAt:self.controlTimePeriod.EndDate]; - XCTAssertTrue([testPeriodDay.StartDate isEqualToDate:endEarlierDay] && [testPeriodDay.EndDate isEqualToDate:self.controlTimePeriod.EndDate], @"%s Failed", __PRETTY_FUNCTION__); - - //Week time period - DTTimePeriod *testPeriodWeek = [DTTimePeriod timePeriodWithSize:DTTimePeriodSizeWeek endingAt:self.controlTimePeriod.EndDate]; - XCTAssertTrue([testPeriodWeek.StartDate isEqualToDate:endEarlierWeek] && [testPeriodWeek.EndDate isEqualToDate:self.controlTimePeriod.EndDate], @"%s Failed", __PRETTY_FUNCTION__); - - //Month time period - DTTimePeriod *testPeriodMonth = [DTTimePeriod timePeriodWithSize:DTTimePeriodSizeMonth endingAt:self.controlTimePeriod.EndDate]; - XCTAssertTrue([testPeriodMonth.StartDate isEqualToDate:endEarlierMonth] && [testPeriodMonth.EndDate isEqualToDate:self.controlTimePeriod.EndDate], @"%s Failed", __PRETTY_FUNCTION__); - - //Year time period - DTTimePeriod *testPeriodYear = [DTTimePeriod timePeriodWithSize:DTTimePeriodSizeYear endingAt:self.controlTimePeriod.EndDate]; - XCTAssertTrue([testPeriodYear.StartDate isEqualToDate:endEarlierYear] && [testPeriodYear.EndDate isEqualToDate:self.controlTimePeriod.EndDate], @"%s Failed", __PRETTY_FUNCTION__); -} - -#pragma mark - Time Period Information --(void)testHasStartDate{ - //Has start date - XCTAssertTrue([self.controlTimePeriod hasStartDate], @"%s Failed", __PRETTY_FUNCTION__); - - //Deosn't have start date - DTTimePeriod *testPeriod = [DTTimePeriod timePeriodWithStartDate:nil endDate:self.controlTimePeriod.EndDate]; - XCTAssertFalse([testPeriod hasStartDate], @"%s Failed", __PRETTY_FUNCTION__); -} --(void)testHasEndDate{ - //Has end date - XCTAssertTrue([self.controlTimePeriod hasEndDate], @"%s Failed", __PRETTY_FUNCTION__); - - //Deosn't have end date - DTTimePeriod *testPeriod = [DTTimePeriod timePeriodWithStartDate:self.controlTimePeriod.StartDate endDate:nil]; - XCTAssertFalse([testPeriod hasEndDate], @"%s Failed", __PRETTY_FUNCTION__); -} --(void)testIsMoment{ - //Is moment - DTTimePeriod *testPeriod = [DTTimePeriod timePeriodWithStartDate:self.controlTimePeriod.StartDate endDate:self.controlTimePeriod.StartDate]; - XCTAssertTrue(testPeriod.isMoment, @"%s Failed", __PRETTY_FUNCTION__); - - //Is not moment - XCTAssertFalse(self.controlTimePeriod.isMoment, @"%s Failed", __PRETTY_FUNCTION__); -} --(void)testDurationInYears{ - XCTAssertEqual(2, [self.controlTimePeriod durationInYears], @"%s Failed", __PRETTY_FUNCTION__); -} --(void)testDurationInWeeks{ - XCTAssertEqual(104, [self.controlTimePeriod durationInWeeks], @"%s Failed", __PRETTY_FUNCTION__); -} --(void)testDurationInDays{ - XCTAssertEqual(731, [self.controlTimePeriod durationInDays], @"%s Failed", __PRETTY_FUNCTION__); -} --(void)testDurationInHours{ - DTTimePeriod *testPeriod = [DTTimePeriod timePeriodWithStartDate:self.controlTimePeriod.StartDate endDate:[self.controlTimePeriod.StartDate dateByAddingHours:4]]; - XCTAssertEqual(4, [testPeriod durationInHours], @"%s Failed", __PRETTY_FUNCTION__); -} --(void)testDurationInMinutes{ - DTTimePeriod *testPeriod = [DTTimePeriod timePeriodWithStartDate:self.controlTimePeriod.StartDate endDate:[self.controlTimePeriod.StartDate dateByAddingHours:4]]; - XCTAssertEqual(240, [testPeriod durationInMinutes], @"%s Failed", __PRETTY_FUNCTION__); -} --(void)testDurationInSeconds{ - DTTimePeriod *testPeriod = [DTTimePeriod timePeriodWithStartDate:self.controlTimePeriod.StartDate endDate:[self.controlTimePeriod.StartDate dateByAddingHours:4]]; - XCTAssertEqual(14400, [testPeriod durationInSeconds], @"%s Failed", __PRETTY_FUNCTION__); -} - -#pragma mark - Time Period Relationship --(void)testIsSamePeriod{ - //Same - XCTAssertTrue([self.controlTimePeriod isEqualToPeriod:self.controlTimePeriod], @"%s Failed", __PRETTY_FUNCTION__); - - //Different ending - DTTimePeriod *differentEndPeriod = [DTTimePeriod timePeriodWithStartDate:self.controlTimePeriod.StartDate endDate:[self.controlTimePeriod.EndDate dateByAddingYears:1]]; - XCTAssertFalse([self.controlTimePeriod isEqualToPeriod:differentEndPeriod], @"%s Failed", __PRETTY_FUNCTION__); - - //Different beginning - DTTimePeriod *differentStartPeriod = [DTTimePeriod timePeriodWithStartDate:[self.controlTimePeriod.StartDate dateBySubtractingYears:1] endDate:self.controlTimePeriod.EndDate]; - XCTAssertFalse([self.controlTimePeriod isEqualToPeriod:differentStartPeriod], @"%s Failed", __PRETTY_FUNCTION__); - - //Both endings different - DTTimePeriod *differentStartAndEndPeriod = [DTTimePeriod timePeriodWithStartDate:[self.controlTimePeriod.StartDate dateBySubtractingYears:1] endDate:[self.controlTimePeriod.EndDate dateBySubtractingWeeks:1]]; - XCTAssertFalse([self.controlTimePeriod isEqualToPeriod:differentStartAndEndPeriod], @"%s Failed", __PRETTY_FUNCTION__); -} --(void)testIsInside{ - //POSITIVE MATCHES - //Test exact match - DTTimePeriod *testTimePeriodExact = [DTTimePeriod timePeriodWithStartDate:[self.formatter dateFromString:@"2014 11 05 18:15:12.000"] endDate:[self.formatter dateFromString:@"2016 11 05 18:15:12.000"]]; - XCTAssertTrue([testTimePeriodExact isInside:self.controlTimePeriod], @"%s Failed", __PRETTY_FUNCTION__); - - //Test same start - DTTimePeriod *testTimePeriodSameStart = [DTTimePeriod timePeriodWithStartDate:[self.formatter dateFromString:@"2014 11 05 18:15:12.000"] endDate:[self.formatter dateFromString:@"2015 11 05 18:15:12.000"]]; - XCTAssertTrue([testTimePeriodSameStart isInside:self.controlTimePeriod], @"%s Failed", __PRETTY_FUNCTION__); - - //Test same end - DTTimePeriod *testTimePeriodSameEnd = [DTTimePeriod timePeriodWithStartDate:[self.formatter dateFromString:@"2015 12 05 18:15:12.000"] endDate:[self.formatter dateFromString:@"2016 11 05 18:15:12.000"]]; - XCTAssertTrue([testTimePeriodSameEnd isInside:self.controlTimePeriod], @"%s Failed", __PRETTY_FUNCTION__); - - //Test completely inside - DTTimePeriod *testTimePeriodCompletelyInside = [DTTimePeriod timePeriodWithStartDate:[self.formatter dateFromString:@"2015 12 05 18:15:12.000"] endDate:[self.formatter dateFromString:@"2016 04 05 18:15:12.000"]]; - XCTAssertTrue([testTimePeriodCompletelyInside isInside:self.controlTimePeriod], @"%s Failed", __PRETTY_FUNCTION__); - - //NEGATIVE MATCHES - //Test before - DTTimePeriod *testTimePeriodBefore = [DTTimePeriod timePeriodWithStartDate:[self.formatter dateFromString:@"2014 11 02 18:15:12.000"] endDate:[self.formatter dateFromString:@"2014 11 04 18:15:12.000"]]; - XCTAssertFalse([testTimePeriodBefore isInside:self.controlTimePeriod], @"%s Failed", __PRETTY_FUNCTION__); - - //Test end same as start - DTTimePeriod *testTimePeriodEndSameStart = [DTTimePeriod timePeriodWithStartDate:[self.formatter dateFromString:@"2013 11 05 18:15:12.000"] endDate:[self.formatter dateFromString:@"2014 11 05 18:15:12.000"]]; - XCTAssertFalse([testTimePeriodEndSameStart isInside:self.controlTimePeriod], @"%s Failed", __PRETTY_FUNCTION__); - - //Test end inside - DTTimePeriod *testTimePeriodEndInside = [DTTimePeriod timePeriodWithStartDate:[self.formatter dateFromString:@"2014 11 02 18:15:12.000"] endDate:[self.formatter dateFromString:@"2014 11 07 18:15:12.000"]]; - XCTAssertFalse([testTimePeriodEndInside isInside:self.controlTimePeriod], @"%s Failed", __PRETTY_FUNCTION__); - - //Test start inside - DTTimePeriod *testTimePeriodStartInside = [DTTimePeriod timePeriodWithStartDate:[self.formatter dateFromString:@"2014 11 07 18:15:12.000"] endDate:[self.formatter dateFromString:@"2016 12 05 18:15:12.000"]]; - XCTAssertFalse([testTimePeriodStartInside isInside:self.controlTimePeriod], @"%s Failed", __PRETTY_FUNCTION__); - - //Test start same as end - DTTimePeriod *testTimePeriodStartSameEnd = [DTTimePeriod timePeriodWithStartDate:[self.formatter dateFromString:@"2016 11 05 18:15:12.000"] endDate:[self.formatter dateFromString:@"2016 11 10 18:15:12.000"]]; - XCTAssertFalse([testTimePeriodStartSameEnd isInside:self.controlTimePeriod], @"%s Failed", __PRETTY_FUNCTION__); - - //Test after - DTTimePeriod *testTimePeriodAfter = [DTTimePeriod timePeriodWithStartDate:[self.formatter dateFromString:@"2016 12 05 18:15:12.000"] endDate:[self.formatter dateFromString:@"2016 12 10 18:15:12.000"]]; - XCTAssertFalse([testTimePeriodAfter isInside:self.controlTimePeriod], @"%s Failed", __PRETTY_FUNCTION__); -} --(void)testContains{ - //POSITIVE MATCHES - //Test exact match - DTTimePeriod *testTimePeriodExact = [DTTimePeriod timePeriodWithStartDate:[self.formatter dateFromString:@"2014 11 05 18:15:12.000"] endDate:[self.formatter dateFromString:@"2016 11 05 18:15:12.000"]]; - XCTAssertTrue([self.controlTimePeriod contains:testTimePeriodExact], @"%s Failed", __PRETTY_FUNCTION__); - - //Test same start - DTTimePeriod *testTimePeriodSameStart = [DTTimePeriod timePeriodWithStartDate:[self.formatter dateFromString:@"2014 11 05 18:15:12.000"] endDate:[self.formatter dateFromString:@"2015 11 05 18:15:12.000"]]; - XCTAssertTrue([self.controlTimePeriod contains:testTimePeriodSameStart], @"%s Failed", __PRETTY_FUNCTION__); - - //Test same end - DTTimePeriod *testTimePeriodSameEnd = [DTTimePeriod timePeriodWithStartDate:[self.formatter dateFromString:@"2015 12 05 18:15:12.000"] endDate:[self.formatter dateFromString:@"2016 11 05 18:15:12.000"]]; - XCTAssertTrue([self.controlTimePeriod contains:testTimePeriodSameEnd], @"%s Failed", __PRETTY_FUNCTION__); - - //Test completely inside - DTTimePeriod *testTimePeriodCompletelyInside = [DTTimePeriod timePeriodWithStartDate:[self.formatter dateFromString:@"2015 12 05 18:15:12.000"] endDate:[self.formatter dateFromString:@"2016 04 05 18:15:12.000"]]; - XCTAssertTrue([self.controlTimePeriod contains:testTimePeriodCompletelyInside], @"%s Failed", __PRETTY_FUNCTION__); - - //NEGATIVE MATCHES - //Test before - DTTimePeriod *testTimePeriodBefore = [DTTimePeriod timePeriodWithStartDate:[self.formatter dateFromString:@"2014 11 02 18:15:12.000"] endDate:[self.formatter dateFromString:@"2014 11 04 18:15:12.000"]]; - XCTAssertFalse([self.controlTimePeriod contains:testTimePeriodBefore], @"%s Failed", __PRETTY_FUNCTION__); - - //Test end same as start - DTTimePeriod *testTimePeriodEndSameStart = [DTTimePeriod timePeriodWithStartDate:[self.formatter dateFromString:@"2013 11 05 18:15:12.000"] endDate:[self.formatter dateFromString:@"2014 11 05 18:15:12.000"]]; - XCTAssertFalse([self.controlTimePeriod contains:testTimePeriodEndSameStart], @"%s Failed", __PRETTY_FUNCTION__); - - //Test end inside - DTTimePeriod *testTimePeriodEndInside = [DTTimePeriod timePeriodWithStartDate:[self.formatter dateFromString:@"2014 11 02 18:15:12.000"] endDate:[self.formatter dateFromString:@"2014 11 07 18:15:12.000"]]; - XCTAssertFalse([self.controlTimePeriod contains:testTimePeriodEndInside], @"%s Failed", __PRETTY_FUNCTION__); - - //Test start inside - DTTimePeriod *testTimePeriodStartInside = [DTTimePeriod timePeriodWithStartDate:[self.formatter dateFromString:@"2014 11 07 18:15:12.000"] endDate:[self.formatter dateFromString:@"2016 12 05 18:15:12.000"]]; - XCTAssertFalse([self.controlTimePeriod contains:testTimePeriodStartInside], @"%s Failed", __PRETTY_FUNCTION__); - - //Test start same as end - DTTimePeriod *testTimePeriodStartSameEnd = [DTTimePeriod timePeriodWithStartDate:[self.formatter dateFromString:@"2016 11 05 18:15:12.000"] endDate:[self.formatter dateFromString:@"2016 11 10 18:15:12.000"]]; - XCTAssertFalse([self.controlTimePeriod contains:testTimePeriodStartSameEnd], @"%s Failed", __PRETTY_FUNCTION__); - - //Test after - DTTimePeriod *testTimePeriodAfter = [DTTimePeriod timePeriodWithStartDate:[self.formatter dateFromString:@"2016 12 05 18:15:12.000"] endDate:[self.formatter dateFromString:@"2016 12 10 18:15:12.000"]]; - XCTAssertFalse([self.controlTimePeriod contains:testTimePeriodAfter], @"%s Failed", __PRETTY_FUNCTION__); -} --(void)testOverlapsWith{ - //POSITIVE MATCHES - //Test exact match - DTTimePeriod *testTimePeriodExact = [DTTimePeriod timePeriodWithStartDate:[self.formatter dateFromString:@"2014 11 05 18:15:12.000"] endDate:[self.formatter dateFromString:@"2016 11 05 18:15:12.000"]]; - XCTAssertTrue([self.controlTimePeriod overlapsWith:testTimePeriodExact], @"%s Failed", __PRETTY_FUNCTION__); - - //Test same start - DTTimePeriod *testTimePeriodSameStart = [DTTimePeriod timePeriodWithStartDate:[self.formatter dateFromString:@"2014 11 05 18:15:12.000"] endDate:[self.formatter dateFromString:@"2015 11 05 18:15:12.000"]]; - XCTAssertTrue([self.controlTimePeriod overlapsWith:testTimePeriodSameStart], @"%s Failed", __PRETTY_FUNCTION__); - - //Test same end - DTTimePeriod *testTimePeriodSameEnd = [DTTimePeriod timePeriodWithStartDate:[self.formatter dateFromString:@"2015 12 05 18:15:12.000"] endDate:[self.formatter dateFromString:@"2016 11 05 18:15:12.000"]]; - XCTAssertTrue([self.controlTimePeriod overlapsWith:testTimePeriodSameEnd], @"%s Failed", __PRETTY_FUNCTION__); - - //Test completely inside - DTTimePeriod *testTimePeriodCompletelyInside = [DTTimePeriod timePeriodWithStartDate:[self.formatter dateFromString:@"2015 12 05 18:15:12.000"] endDate:[self.formatter dateFromString:@"2016 04 05 18:15:12.000"]]; - XCTAssertTrue([self.controlTimePeriod overlapsWith:testTimePeriodCompletelyInside], @"%s Failed", __PRETTY_FUNCTION__); - - //Test start inside - DTTimePeriod *testTimePeriodStartInside = [DTTimePeriod timePeriodWithStartDate:[self.formatter dateFromString:@"2014 11 07 18:15:12.000"] endDate:[self.formatter dateFromString:@"2016 12 05 18:15:12.000"]]; - XCTAssertTrue([self.controlTimePeriod overlapsWith:testTimePeriodStartInside], @"%s Failed", __PRETTY_FUNCTION__); - - //Test end inside - DTTimePeriod *testTimePeriodEndInside = [DTTimePeriod timePeriodWithStartDate:[self.formatter dateFromString:@"2014 11 02 18:15:12.000"] endDate:[self.formatter dateFromString:@"2014 11 07 18:15:12.000"]]; - XCTAssertTrue([self.controlTimePeriod overlapsWith:testTimePeriodEndInside], @"%s Failed", __PRETTY_FUNCTION__); - - //NEGATIVE MATCHES - //Test before - DTTimePeriod *testTimePeriodBefore = [DTTimePeriod timePeriodWithStartDate:[self.formatter dateFromString:@"2014 11 02 18:15:12.000"] endDate:[self.formatter dateFromString:@"2014 11 04 18:15:12.000"]]; - XCTAssertFalse([self.controlTimePeriod overlapsWith:testTimePeriodBefore], @"%s Failed", __PRETTY_FUNCTION__); - - //Test end same as start - DTTimePeriod *testTimePeriodEndSameStart = [DTTimePeriod timePeriodWithStartDate:[self.formatter dateFromString:@"2013 11 05 18:15:12.000"] endDate:[self.formatter dateFromString:@"2014 11 05 18:15:12.000"]]; - XCTAssertFalse([self.controlTimePeriod overlapsWith:testTimePeriodEndSameStart], @"%s Failed", __PRETTY_FUNCTION__); - - //Test start same as end - DTTimePeriod *testTimePeriodStartSameEnd = [DTTimePeriod timePeriodWithStartDate:[self.formatter dateFromString:@"2016 11 05 18:15:12.000"] endDate:[self.formatter dateFromString:@"2016 11 10 18:15:12.000"]]; - XCTAssertFalse([self.controlTimePeriod overlapsWith:testTimePeriodStartSameEnd], @"%s Failed", __PRETTY_FUNCTION__); - - //Test after - DTTimePeriod *testTimePeriodAfter = [DTTimePeriod timePeriodWithStartDate:[self.formatter dateFromString:@"2016 12 05 18:15:12.000"] endDate:[self.formatter dateFromString:@"2016 12 10 18:15:12.000"]]; - XCTAssertFalse([self.controlTimePeriod overlapsWith:testTimePeriodAfter], @"%s Failed", __PRETTY_FUNCTION__); - -} --(void)testIntersects{ - //POSITIVE MATCHES - //Test exact match - DTTimePeriod *testTimePeriodExact = [DTTimePeriod timePeriodWithStartDate:[self.formatter dateFromString:@"2014 11 05 18:15:12.000"] endDate:[self.formatter dateFromString:@"2016 11 05 18:15:12.000"]]; - XCTAssertTrue([self.controlTimePeriod intersects:testTimePeriodExact], @"%s Failed", __PRETTY_FUNCTION__); - - //Test same start - DTTimePeriod *testTimePeriodSameStart = [DTTimePeriod timePeriodWithStartDate:[self.formatter dateFromString:@"2014 11 05 18:15:12.000"] endDate:[self.formatter dateFromString:@"2015 11 05 18:15:12.000"]]; - XCTAssertTrue([self.controlTimePeriod intersects:testTimePeriodSameStart], @"%s Failed", __PRETTY_FUNCTION__); - - //Test same end - DTTimePeriod *testTimePeriodSameEnd = [DTTimePeriod timePeriodWithStartDate:[self.formatter dateFromString:@"2015 12 05 18:15:12.000"] endDate:[self.formatter dateFromString:@"2016 11 05 18:15:12.000"]]; - XCTAssertTrue([self.controlTimePeriod intersects:testTimePeriodSameEnd], @"%s Failed", __PRETTY_FUNCTION__); - - //Test completely inside - DTTimePeriod *testTimePeriodCompletelyInside = [DTTimePeriod timePeriodWithStartDate:[self.formatter dateFromString:@"2015 12 05 18:15:12.000"] endDate:[self.formatter dateFromString:@"2016 04 05 18:15:12.000"]]; - XCTAssertTrue([self.controlTimePeriod intersects:testTimePeriodCompletelyInside], @"%s Failed", __PRETTY_FUNCTION__); - - //Test start inside - DTTimePeriod *testTimePeriodStartInside = [DTTimePeriod timePeriodWithStartDate:[self.formatter dateFromString:@"2014 11 07 18:15:12.000"] endDate:[self.formatter dateFromString:@"2016 12 05 18:15:12.000"]]; - XCTAssertTrue([self.controlTimePeriod intersects:testTimePeriodStartInside], @"%s Failed", __PRETTY_FUNCTION__); - - //Test end inside - DTTimePeriod *testTimePeriodEndInside = [DTTimePeriod timePeriodWithStartDate:[self.formatter dateFromString:@"2014 11 02 18:15:12.000"] endDate:[self.formatter dateFromString:@"2014 11 07 18:15:12.000"]]; - XCTAssertTrue([self.controlTimePeriod intersects:testTimePeriodEndInside], @"%s Failed", __PRETTY_FUNCTION__); - - //Test end same as start - DTTimePeriod *testTimePeriodEndSameStart = [DTTimePeriod timePeriodWithStartDate:[self.formatter dateFromString:@"2013 11 05 18:15:12.000"] endDate:[self.formatter dateFromString:@"2014 11 05 18:15:12.000"]]; - XCTAssertTrue([self.controlTimePeriod intersects:testTimePeriodEndSameStart], @"%s Failed", __PRETTY_FUNCTION__); - - //Test start same as end - DTTimePeriod *testTimePeriodStartSameEnd = [DTTimePeriod timePeriodWithStartDate:[self.formatter dateFromString:@"2016 11 05 18:15:12.000"] endDate:[self.formatter dateFromString:@"2016 11 10 18:15:12.000"]]; - XCTAssertTrue([self.controlTimePeriod intersects:testTimePeriodStartSameEnd], @"%s Failed", __PRETTY_FUNCTION__); - - //NEGATIVE MATCHES - //Test before - DTTimePeriod *testTimePeriodBefore = [DTTimePeriod timePeriodWithStartDate:[self.formatter dateFromString:@"2014 11 02 18:15:12.000"] endDate:[self.formatter dateFromString:@"2014 11 04 18:15:12.000"]]; - XCTAssertFalse([self.controlTimePeriod intersects:testTimePeriodBefore], @"%s Failed", __PRETTY_FUNCTION__); - - //Test after - DTTimePeriod *testTimePeriodAfter = [DTTimePeriod timePeriodWithStartDate:[self.formatter dateFromString:@"2016 12 05 18:15:12.000"] endDate:[self.formatter dateFromString:@"2016 12 10 18:15:12.000"]]; - XCTAssertFalse([self.controlTimePeriod intersects:testTimePeriodAfter], @"%s Failed", __PRETTY_FUNCTION__); -} --(void)testRelationToPeriod{ - //Test exact match - DTTimePeriod *testTimePeriodExact = [DTTimePeriod timePeriodWithStartDate:[self.formatter dateFromString:@"2014 11 05 18:15:12.000"] endDate:[self.formatter dateFromString:@"2016 11 05 18:15:12.000"]]; - XCTAssertEqual(DTTimePeriodRelationExactMatch, [testTimePeriodExact relationToPeriod:self.controlTimePeriod], @"%s Failed", __PRETTY_FUNCTION__); - - //Test same start - DTTimePeriod *testTimePeriodSameStart = [DTTimePeriod timePeriodWithStartDate:[self.formatter dateFromString:@"2014 11 05 18:15:12.000"] endDate:[self.formatter dateFromString:@"2015 11 05 18:15:12.000"]]; - XCTAssertEqual(DTTimePeriodRelationInsideStartTouching, [testTimePeriodSameStart relationToPeriod:self.controlTimePeriod], @"%s Failed", __PRETTY_FUNCTION__); - - //Test same end - DTTimePeriod *testTimePeriodSameEnd = [DTTimePeriod timePeriodWithStartDate:[self.formatter dateFromString:@"2015 12 05 18:15:12.000"] endDate:[self.formatter dateFromString:@"2016 11 05 18:15:12.000"]]; - XCTAssertEqual(DTTimePeriodRelationInsideEndTouching, [testTimePeriodSameEnd relationToPeriod:self.controlTimePeriod], @"%s Failed", __PRETTY_FUNCTION__); - - //Test completely inside - DTTimePeriod *testTimePeriodCompletelyInside = [DTTimePeriod timePeriodWithStartDate:[self.formatter dateFromString:@"2015 12 05 18:15:12.000"] endDate:[self.formatter dateFromString:@"2016 04 05 18:15:12.000"]]; - XCTAssertEqual(DTTimePeriodRelationInside, [testTimePeriodCompletelyInside relationToPeriod:self.controlTimePeriod], @"%s Failed", __PRETTY_FUNCTION__); - - //NEGATIVE MATCHES - //Test before - DTTimePeriod *testTimePeriodBefore = [DTTimePeriod timePeriodWithStartDate:[self.formatter dateFromString:@"2014 11 02 18:15:12.000"] endDate:[self.formatter dateFromString:@"2014 11 04 18:15:12.000"]]; - XCTAssertEqual(DTTimePeriodRelationBefore, [testTimePeriodBefore relationToPeriod:self.controlTimePeriod], @"%s Failed", __PRETTY_FUNCTION__); - - //Test end same as start - DTTimePeriod *testTimePeriodEndSameStart = [DTTimePeriod timePeriodWithStartDate:[self.formatter dateFromString:@"2013 11 05 18:15:12.000"] endDate:[self.formatter dateFromString:@"2014 11 05 18:15:12.000"]]; - XCTAssertEqual(DTTimePeriodRelationEndTouching, [testTimePeriodEndSameStart relationToPeriod:self.controlTimePeriod], @"%s Failed", __PRETTY_FUNCTION__); - - //Test end inside - DTTimePeriod *testTimePeriodEndInside = [DTTimePeriod timePeriodWithStartDate:[self.formatter dateFromString:@"2014 11 02 18:15:12.000"] endDate:[self.formatter dateFromString:@"2014 11 07 18:15:12.000"]]; - XCTAssertEqual(DTTimePeriodRelationEndInside, [testTimePeriodEndInside relationToPeriod:self.controlTimePeriod], @"%s Failed", __PRETTY_FUNCTION__); - - //Test start inside - DTTimePeriod *testTimePeriodStartInside = [DTTimePeriod timePeriodWithStartDate:[self.formatter dateFromString:@"2014 11 07 18:15:12.000"] endDate:[self.formatter dateFromString:@"2016 12 05 18:15:12.000"]]; - XCTAssertEqual(DTTimePeriodRelationStartInside, [testTimePeriodStartInside relationToPeriod:self.controlTimePeriod], @"%s Failed", __PRETTY_FUNCTION__); - - //Test start same as end - DTTimePeriod *testTimePeriodStartSameEnd = [DTTimePeriod timePeriodWithStartDate:[self.formatter dateFromString:@"2016 11 05 18:15:12.000"] endDate:[self.formatter dateFromString:@"2016 11 10 18:15:12.000"]]; - XCTAssertEqual(DTTimePeriodRelationStartTouching, [testTimePeriodStartSameEnd relationToPeriod:self.controlTimePeriod], @"%s Failed", __PRETTY_FUNCTION__); - - //Test after - DTTimePeriod *testTimePeriodAfter = [DTTimePeriod timePeriodWithStartDate:[self.formatter dateFromString:@"2016 12 05 18:15:12.000"] endDate:[self.formatter dateFromString:@"2016 12 10 18:15:12.000"]]; - XCTAssertEqual(DTTimePeriodRelationAfter, [testTimePeriodAfter relationToPeriod:self.controlTimePeriod], @"%s Failed", __PRETTY_FUNCTION__); -} --(void)testGapBetween{ - //We are going to treat some of these as False=noGap and True=gap - - //No Gap Same - XCTAssertFalse([self.controlTimePeriod gapBetween:self.controlTimePeriod], @"%s Failed", __PRETTY_FUNCTION__); - - //No Gap End Inside - DTTimePeriod *testPeriodNoGap = [DTTimePeriod timePeriodWithStartDate:[self.controlTimePeriod.StartDate dateBySubtractingDays:1] endDate:[self.controlTimePeriod.EndDate dateBySubtractingDays:1]]; - XCTAssertFalse([self.controlTimePeriod gapBetween:testPeriodNoGap], @"%s Failed", __PRETTY_FUNCTION__); - - //Gap receiver early - DTTimePeriod *testPeriodReceiverEarly = [DTTimePeriod timePeriodWithSize:DTTimePeriodSizeWeek startingAt:[self.controlTimePeriod.EndDate dateByAddingYears:1]]; - XCTAssertTrue([self.controlTimePeriod gapBetween:testPeriodReceiverEarly], @"%s Failed", __PRETTY_FUNCTION__); - - //Gap parameter early - DTTimePeriod *testPeriodParameterEarly = [DTTimePeriod timePeriodWithSize:DTTimePeriodSizeWeek endingAt:[self.controlTimePeriod.StartDate dateBySubtractingYears:1]]; - XCTAssertTrue([self.controlTimePeriod gapBetween:testPeriodParameterEarly], @"%s Failed", __PRETTY_FUNCTION__); - - //Gap of 1 minute - DTTimePeriod *testPeriodParameter1MinuteEarly = [DTTimePeriod timePeriodWithSize:DTTimePeriodSizeSecond endingAt:[self.controlTimePeriod.StartDate dateBySubtractingMinutes:1]]; - XCTAssertEqual(60, [self.controlTimePeriod gapBetween:testPeriodParameter1MinuteEarly], @"%s Failed", __PRETTY_FUNCTION__); -} - -#pragma mark - Date Relationships --(void)testContainsDate{ - NSDate *testDateBefore = [self.formatter dateFromString:@"2014 10 05 18:15:12.000"]; - NSDate *testDateBetween = [self.formatter dateFromString:@"2015 11 05 18:15:12.000"]; - NSDate *testDateAfter = [self.formatter dateFromString:@"2016 12 05 18:15:12.000"]; - - //Test before - XCTAssertFalse([self.controlTimePeriod containsDate:testDateBefore interval:DTTimePeriodIntervalOpen], @"%s Failed", __PRETTY_FUNCTION__); - XCTAssertFalse([self.controlTimePeriod containsDate:testDateBefore interval:DTTimePeriodIntervalClosed], @"%s Failed", __PRETTY_FUNCTION__); - - //Test on start date - XCTAssertFalse([self.controlTimePeriod containsDate:self.controlTimePeriod.StartDate interval:DTTimePeriodIntervalOpen], @"%s Failed", __PRETTY_FUNCTION__); - XCTAssertTrue([self.controlTimePeriod containsDate:self.controlTimePeriod.StartDate interval:DTTimePeriodIntervalClosed], @"%s Failed", __PRETTY_FUNCTION__); - - //Test in middle - XCTAssertTrue([self.controlTimePeriod containsDate:testDateBetween interval:DTTimePeriodIntervalClosed], @"%s Failed", __PRETTY_FUNCTION__); - XCTAssertTrue([self.controlTimePeriod containsDate:testDateBetween interval:DTTimePeriodIntervalClosed], @"%s Failed", __PRETTY_FUNCTION__); - - //Test on end date - XCTAssertFalse([self.controlTimePeriod containsDate:self.controlTimePeriod.EndDate interval:DTTimePeriodIntervalOpen], @"%s Failed", __PRETTY_FUNCTION__); - XCTAssertTrue([self.controlTimePeriod containsDate:self.controlTimePeriod.EndDate interval:DTTimePeriodIntervalClosed], @"%s Failed", __PRETTY_FUNCTION__); - - //Test after - XCTAssertFalse([self.controlTimePeriod containsDate:testDateAfter interval:DTTimePeriodIntervalOpen], @"%s Failed", __PRETTY_FUNCTION__); - XCTAssertFalse([self.controlTimePeriod containsDate:testDateAfter interval:DTTimePeriodIntervalClosed], @"%s Failed", __PRETTY_FUNCTION__); -} - - -#pragma mark - Period Manipulation -#pragma mark Shift Earlier --(void)testShiftSecondEarlier{ - NSDate *startEarlierSecond = [self.formatter dateFromString:@"2014 11 05 18:15:11.000"]; - NSDate *endEarlierSecond = [self.formatter dateFromString:@"2016 11 05 18:15:11.000"]; - - //Second time period - DTTimePeriod *testPeriod = [DTTimePeriod timePeriodWithStartDate:startEarlierSecond endDate:endEarlierSecond]; - [self.controlTimePeriod shiftEarlierWithSize:DTTimePeriodSizeSecond]; - XCTAssertTrue([testPeriod.StartDate isEqualToDate:self.controlTimePeriod.StartDate] && [testPeriod.EndDate isEqualToDate:self.controlTimePeriod.EndDate], @"%s Failed", __PRETTY_FUNCTION__); -} --(void)testShiftMinuteEarlier{ - NSDate *startEarlier = [self.formatter dateFromString:@"2014 11 05 18:14:12.000"]; - NSDate *endEarlier = [self.formatter dateFromString:@"2016 11 05 18:14:12.000"]; - - DTTimePeriod *testPeriod = [DTTimePeriod timePeriodWithStartDate:startEarlier endDate:endEarlier]; - [self.controlTimePeriod shiftEarlierWithSize:DTTimePeriodSizeMinute]; - XCTAssertTrue([testPeriod.StartDate isEqualToDate:self.controlTimePeriod.StartDate] && [testPeriod.EndDate isEqualToDate:self.controlTimePeriod.EndDate], @"%s Failed", __PRETTY_FUNCTION__); -} --(void)testShiftHourEarlier{ - NSDate *startEarlier = [self.formatter dateFromString:@"2014 11 05 17:15:12.000"]; - NSDate *endEarlier = [self.formatter dateFromString:@"2016 11 05 17:15:12.000"]; - - DTTimePeriod *testPeriod = [DTTimePeriod timePeriodWithStartDate:startEarlier endDate:endEarlier]; - [self.controlTimePeriod shiftEarlierWithSize:DTTimePeriodSizeHour]; - XCTAssertTrue([testPeriod.StartDate isEqualToDate:self.controlTimePeriod.StartDate] && [testPeriod.EndDate isEqualToDate:self.controlTimePeriod.EndDate], @"%s Failed", __PRETTY_FUNCTION__); -} --(void)testShiftDayEarlier{ - NSDate *startEarlier = [self.formatter dateFromString:@"2014 11 04 18:15:12.000"]; - NSDate *endEarlier = [self.formatter dateFromString:@"2016 11 04 18:15:12.000"]; - - DTTimePeriod *testPeriod = [DTTimePeriod timePeriodWithStartDate:startEarlier endDate:endEarlier]; - [self.controlTimePeriod shiftEarlierWithSize:DTTimePeriodSizeDay]; - XCTAssertTrue([testPeriod.StartDate isEqualToDate:self.controlTimePeriod.StartDate] && [testPeriod.EndDate isEqualToDate:self.controlTimePeriod.EndDate], @"%s Failed", __PRETTY_FUNCTION__); -} --(void)testShiftWeekEarlier{ - NSDate *startEarlier = [self.formatter dateFromString:@"2014 10 29 18:15:12.000"]; - NSDate *endEarlier = [self.formatter dateFromString:@"2016 10 29 18:15:12.000"]; - - DTTimePeriod *testPeriod = [DTTimePeriod timePeriodWithStartDate:startEarlier endDate:endEarlier]; - [self.controlTimePeriod shiftEarlierWithSize:DTTimePeriodSizeWeek]; - XCTAssertTrue([testPeriod.StartDate isEqualToDate:self.controlTimePeriod.StartDate] && [testPeriod.EndDate isEqualToDate:self.controlTimePeriod.EndDate], @"%s Failed", __PRETTY_FUNCTION__); -} --(void)testShiftMonthEarlier{ - NSDate *startEarlier = [self.formatter dateFromString:@"2014 10 05 18:15:12.000"]; - NSDate *endEarlier = [self.formatter dateFromString:@"2016 10 05 18:15:12.000"]; - - DTTimePeriod *testPeriod = [DTTimePeriod timePeriodWithStartDate:startEarlier endDate:endEarlier]; - [self.controlTimePeriod shiftEarlierWithSize:DTTimePeriodSizeMonth]; - XCTAssertTrue([testPeriod.StartDate isEqualToDate:self.controlTimePeriod.StartDate] && [testPeriod.EndDate isEqualToDate:self.controlTimePeriod.EndDate], @"%s Failed", __PRETTY_FUNCTION__); -} --(void)testShiftYearEarlier{ - NSDate *startEarlier = [self.formatter dateFromString:@"2013 11 05 18:15:12.000"]; - NSDate *endEarlier = [self.formatter dateFromString:@"2015 11 05 18:15:12.000"]; - - DTTimePeriod *testPeriod = [DTTimePeriod timePeriodWithStartDate:startEarlier endDate:endEarlier]; - [self.controlTimePeriod shiftEarlierWithSize:DTTimePeriodSizeYear]; - XCTAssertTrue([testPeriod.StartDate isEqualToDate:self.controlTimePeriod.StartDate] && [testPeriod.EndDate isEqualToDate:self.controlTimePeriod.EndDate], @"%s Failed", __PRETTY_FUNCTION__); -} - -#pragma mark Shift Later --(void)testShiftSecondLater{ - NSDate *startLater = [self.formatter dateFromString:@"2014 11 05 18:15:13.000"]; - NSDate *endLater = [self.formatter dateFromString:@"2016 11 05 18:15:13.000"]; - - //Second time period - DTTimePeriod *testPeriod = [DTTimePeriod timePeriodWithStartDate:startLater endDate:endLater]; - [self.controlTimePeriod shiftLaterWithSize:DTTimePeriodSizeSecond]; - XCTAssertTrue([testPeriod.StartDate isEqualToDate:self.controlTimePeriod.StartDate] && [testPeriod.EndDate isEqualToDate:self.controlTimePeriod.EndDate], @"%s Failed", __PRETTY_FUNCTION__); -} --(void)testShiftMinuteLater{ - NSDate *startLater = [self.formatter dateFromString:@"2014 11 05 18:16:12.000"]; - NSDate *endLater = [self.formatter dateFromString:@"2016 11 05 18:16:12.000"]; - - DTTimePeriod *testPeriod = [DTTimePeriod timePeriodWithStartDate:startLater endDate:endLater]; - [self.controlTimePeriod shiftLaterWithSize:DTTimePeriodSizeMinute]; - XCTAssertTrue([testPeriod.StartDate isEqualToDate:self.controlTimePeriod.StartDate] && [testPeriod.EndDate isEqualToDate:self.controlTimePeriod.EndDate], @"%s Failed", __PRETTY_FUNCTION__); -} --(void)testShiftHourLater{ - NSDate *startLater = [self.formatter dateFromString:@"2014 11 05 19:15:12.000"]; - NSDate *endLater = [self.formatter dateFromString:@"2016 11 05 19:15:12.000"]; - - DTTimePeriod *testPeriod = [DTTimePeriod timePeriodWithStartDate:startLater endDate:endLater]; - [self.controlTimePeriod shiftLaterWithSize:DTTimePeriodSizeHour]; - XCTAssertTrue([testPeriod.StartDate isEqualToDate:self.controlTimePeriod.StartDate] && [testPeriod.EndDate isEqualToDate:self.controlTimePeriod.EndDate], @"%s Failed", __PRETTY_FUNCTION__); -} --(void)testShiftDayLater{ - NSDate *startLater = [self.formatter dateFromString:@"2014 11 06 18:15:12.000"]; - NSDate *endLater = [self.formatter dateFromString:@"2016 11 06 18:15:12.000"]; - - DTTimePeriod *testPeriod = [DTTimePeriod timePeriodWithStartDate:startLater endDate:endLater]; - [self.controlTimePeriod shiftLaterWithSize:DTTimePeriodSizeDay]; - XCTAssertTrue([testPeriod.StartDate isEqualToDate:self.controlTimePeriod.StartDate] && [testPeriod.EndDate isEqualToDate:self.controlTimePeriod.EndDate], @"%s Failed", __PRETTY_FUNCTION__); -} --(void)testShiftWeekLater{ - NSDate *startLater = [self.formatter dateFromString:@"2014 11 12 18:15:12.000"]; - NSDate *endLater = [self.formatter dateFromString:@"2016 11 12 18:15:12.000"]; - - DTTimePeriod *testPeriod = [DTTimePeriod timePeriodWithStartDate:startLater endDate:endLater]; - [self.controlTimePeriod shiftLaterWithSize:DTTimePeriodSizeWeek]; - XCTAssertTrue([testPeriod.StartDate isEqualToDate:self.controlTimePeriod.StartDate] && [testPeriod.EndDate isEqualToDate:self.controlTimePeriod.EndDate], @"%s Failed", __PRETTY_FUNCTION__); -} --(void)testShiftMonthLater{ - NSDate *startLater = [self.formatter dateFromString:@"2014 12 05 18:15:12.000"]; - NSDate *endLater = [self.formatter dateFromString:@"2016 12 05 18:15:12.000"]; - - DTTimePeriod *testPeriod = [DTTimePeriod timePeriodWithStartDate:startLater endDate:endLater]; - [self.controlTimePeriod shiftLaterWithSize:DTTimePeriodSizeMonth]; - XCTAssertTrue([testPeriod.StartDate isEqualToDate:self.controlTimePeriod.StartDate] && [testPeriod.EndDate isEqualToDate:self.controlTimePeriod.EndDate], @"%s Failed", __PRETTY_FUNCTION__); -} --(void)testShiftYearLater{ - NSDate *startLater = [self.formatter dateFromString:@"2015 11 05 18:15:12.000"]; - NSDate *endLater = [self.formatter dateFromString:@"2017 11 05 18:15:12.000"]; - - DTTimePeriod *testPeriod = [DTTimePeriod timePeriodWithStartDate:startLater endDate:endLater]; - [self.controlTimePeriod shiftLaterWithSize:DTTimePeriodSizeYear]; - XCTAssertTrue([testPeriod.StartDate isEqualToDate:self.controlTimePeriod.StartDate] && [testPeriod.EndDate isEqualToDate:self.controlTimePeriod.EndDate], @"%s Failed", __PRETTY_FUNCTION__); -} - -#pragma mark Lengthen / Shorten --(void)testLengthenAnchorStart{ - //Test dates - NSDate *lengthenedEnd = [self.formatter dateFromString:@"2016 11 05 18:15:14.000"]; - - DTTimePeriod *testPeriod = [DTTimePeriod timePeriodWithStartDate:self.controlTimePeriod.StartDate endDate:lengthenedEnd]; - [self.controlTimePeriod lengthenWithAnchorDate:DTTimePeriodAnchorStart size:DTTimePeriodSizeSecond amount:2]; - XCTAssertTrue([testPeriod.StartDate isEqualToDate:self.controlTimePeriod.StartDate] && [testPeriod.EndDate isEqualToDate:self.controlTimePeriod.EndDate], @"%s Failed", __PRETTY_FUNCTION__); -} --(void)testLengthenAnchorCenter{ - //Test dates - NSDate *lengthenedStart = [self.formatter dateFromString:@"2014 11 05 18:15:11.000"]; - NSDate *lengthenedEnd = [self.formatter dateFromString:@"2016 11 05 18:15:13.000"]; - - DTTimePeriod *testPeriod = [DTTimePeriod timePeriodWithStartDate:lengthenedStart endDate:lengthenedEnd]; - [self.controlTimePeriod lengthenWithAnchorDate:DTTimePeriodAnchorCenter size:DTTimePeriodSizeSecond amount:2]; - XCTAssertTrue([testPeriod.StartDate isEqualToDate:self.controlTimePeriod.StartDate] && [testPeriod.EndDate isEqualToDate:self.controlTimePeriod.EndDate], @"%s Failed", __PRETTY_FUNCTION__); - -} --(void)testLengthenAnchorEnd{ - //Test dates - NSDate *lengthenedStart = [self.formatter dateFromString:@"2014 11 05 18:15:10.000"]; - - DTTimePeriod *testPeriod = [DTTimePeriod timePeriodWithStartDate:lengthenedStart endDate:self.controlTimePeriod.EndDate]; - [self.controlTimePeriod lengthenWithAnchorDate:DTTimePeriodAnchorEnd size:DTTimePeriodSizeSecond amount:2]; - XCTAssertTrue([testPeriod.StartDate isEqualToDate:self.controlTimePeriod.StartDate] && [testPeriod.EndDate isEqualToDate:self.controlTimePeriod.EndDate], @"%s Failed", __PRETTY_FUNCTION__); - -} --(void)testShortenAnchorStart{ - //Test dates - NSDate *shortenedEnd = [self.formatter dateFromString:@"2016 11 05 18:15:10.000"]; - - DTTimePeriod *testPeriod = [DTTimePeriod timePeriodWithStartDate:self.controlTimePeriod.StartDate endDate:shortenedEnd]; - [self.controlTimePeriod shortenWithAnchorDate:DTTimePeriodAnchorStart size:DTTimePeriodSizeSecond amount:2]; - XCTAssertTrue([testPeriod.StartDate isEqualToDate:self.controlTimePeriod.StartDate] && [testPeriod.EndDate isEqualToDate:self.controlTimePeriod.EndDate], @"%s Failed", __PRETTY_FUNCTION__); -} --(void)testShortenAnchorCenter{ - //Test dates - NSDate *shortenedStart = [self.formatter dateFromString:@"2014 11 05 18:15:13.000"]; - NSDate *shortenedEnd = [self.formatter dateFromString:@"2016 11 05 18:15:11.000"]; - - DTTimePeriod *testPeriod = [DTTimePeriod timePeriodWithStartDate:shortenedStart endDate:shortenedEnd]; - [self.controlTimePeriod shortenWithAnchorDate:DTTimePeriodAnchorCenter size:DTTimePeriodSizeSecond amount:2]; - XCTAssertTrue([testPeriod.StartDate isEqualToDate:self.controlTimePeriod.StartDate] && [testPeriod.EndDate isEqualToDate:self.controlTimePeriod.EndDate], @"%s Failed", __PRETTY_FUNCTION__); - -} --(void)testShortenAnchorEnd{ - //Test dates - NSDate *shortenedStart = [self.formatter dateFromString:@"2014 11 05 18:15:14.000"]; - - DTTimePeriod *testPeriod = [DTTimePeriod timePeriodWithStartDate:shortenedStart endDate:self.controlTimePeriod.EndDate]; - [self.controlTimePeriod shortenWithAnchorDate:DTTimePeriodAnchorEnd size:DTTimePeriodSizeSecond amount:2]; - XCTAssertTrue([testPeriod.StartDate isEqualToDate:self.controlTimePeriod.StartDate] && [testPeriod.EndDate isEqualToDate:self.controlTimePeriod.EndDate], @"%s Failed", __PRETTY_FUNCTION__); - -} - - -@end diff --git a/DateTools/Tests/DateToolsTests/DateToolsTestsTests/DateToolsTests.m b/DateTools/Tests/DateToolsTests/DateToolsTestsTests/DateToolsTests.m deleted file mode 100644 index f9192742..00000000 --- a/DateTools/Tests/DateToolsTests/DateToolsTestsTests/DateToolsTests.m +++ /dev/null @@ -1,693 +0,0 @@ -// -// DateToolsTests.m -// DateToolsExample -// -// Created by Matthew York on 3/19/14. -// -// - -#import -#import "NSDate+DateTools.h" - -@interface DateToolsTests : XCTestCase -@property NSDateFormatter *formatter; -@property NSDate *controlDate; -@end - -@implementation DateToolsTests - -- (void)setUp -{ - [super setUp]; - // Put setup code here. This method is called before the invocation of each test method in the class. - - self.formatter = [[NSDateFormatter alloc] init]; - [self.formatter setDateFormat:@"yyyy MM dd HH:mm:ss.SSS"]; - self.controlDate = [self.formatter dateFromString:@"2014 11 05 18:15:12.000"]; -} - -- (void)tearDown -{ - // Put teardown code here. This method is called after the invocation of each test method in the class. - [super tearDown]; -} - -#pragma mark - Date Components - -- (void)testEra { - XCTAssertEqual(1, [[NSDate date] era], @"%s Failed", __PRETTY_FUNCTION__); -} -- (void)testYear{ - XCTAssertEqual(2014, self.controlDate.year, @"%s Failed", __PRETTY_FUNCTION__); -} -- (void)testMonth{ - XCTAssertEqual(11, self.controlDate.month, @"%s Failed", __PRETTY_FUNCTION__); -} -- (void)testDay{ - XCTAssertEqual(5, self.controlDate.day, @"%s Failed", __PRETTY_FUNCTION__); -} -- (void)testHour{ - XCTAssertEqual(18, self.controlDate.hour, @"%s Failed", __PRETTY_FUNCTION__); -} -- (void)testMinute{ - XCTAssertEqual(15, self.controlDate.minute, @"%s Failed", __PRETTY_FUNCTION__); -} -- (void)testSecond{ - XCTAssertEqual(12, self.controlDate.second, @"%s Failed", __PRETTY_FUNCTION__); -} -- (void)testWeekday{ - XCTAssertEqual(4, self.controlDate.weekday, @"%s Failed", __PRETTY_FUNCTION__); -} -- (void)testWeekdayOrdinal{ - XCTAssertEqual(1, self.controlDate.weekdayOrdinal, @"%s Failed", __PRETTY_FUNCTION__); -} -- (void)testQuarter{ - //Quarter is a little funky right now - //XCTAssertEqual(4, self.testDate.quarter, @"%s Failed", __PRETTY_FUNCTION__); -} -- (void)testWeekOfMonth{ - XCTAssertEqual(2, self.controlDate.weekOfMonth, @"%s Failed", __PRETTY_FUNCTION__); -} -- (void)testWeekOfYear{ - XCTAssertEqual(45, self.controlDate.weekOfYear, @"%s Failed", __PRETTY_FUNCTION__); -} -- (void)testYearForWeekOfYear{ - XCTAssertEqual(2014, self.controlDate.yearForWeekOfYear, @"%s Failed", __PRETTY_FUNCTION__); -} -- (void)testDaysInMonth{ - XCTAssertEqual(30, self.controlDate.daysInMonth, @"%s Failed", __PRETTY_FUNCTION__); -} -- (void)testDaysInYear{ - //Non leap year (2014) - XCTAssertEqual(365, self.controlDate.daysInYear, @"%s Failed", __PRETTY_FUNCTION__); - - //Leap year (2000) - XCTAssertEqual(366, [self.controlDate dateBySubtractingYears:14].daysInYear, @"%s Failed", __PRETTY_FUNCTION__); -} -- (void)testIsInLeapYear{ - //Not leap year - XCTAssertFalse([self.controlDate isInLeapYear], @"%s Failed", __PRETTY_FUNCTION__); - - //Is leap year (%400) 2000 - XCTAssertTrue([[self.controlDate dateBySubtractingYears:14] isInLeapYear], @"%s Failed", __PRETTY_FUNCTION__); - - //Not leap year (%100) 1900 - XCTAssertFalse([[self.controlDate dateBySubtractingYears:114] isInLeapYear], @"%s Failed", __PRETTY_FUNCTION__); - - //Is leap year (%4) 2016 - XCTAssertTrue([[self.controlDate dateByAddingYears:2] isInLeapYear], @"%s Failed", __PRETTY_FUNCTION__); -} --(void)testIsToday{ - //Test true now - XCTAssertTrue([NSDate date].isToday, @"%s Failed", __PRETTY_FUNCTION__); - - //Test true past (Technically, could fail if you ran the test precisely at midnight, but...) - XCTAssertTrue([[NSDate date] dateBySubtractingSeconds:1].isToday, @"%s Failed", __PRETTY_FUNCTION__); - - //Test true future (Technically, could fail if you ran the test precisely at midnight, but...) - XCTAssertTrue([[NSDate date] dateByAddingSeconds:1].isToday, @"%s Failed", __PRETTY_FUNCTION__); - - //Tests false past - XCTAssertFalse([[NSDate date] dateBySubtractingDays:2].isToday, @"%s Failed", __PRETTY_FUNCTION__); - - //Tests false future - XCTAssertFalse([[NSDate date] dateByAddingDays:1].isToday, @"%s Failed", __PRETTY_FUNCTION__); -} --(void)testIsTomorrow{ - //Test false with now - XCTAssertFalse([NSDate date].isTomorrow, @"%s Failed", __PRETTY_FUNCTION__); - - //Test false past - XCTAssertFalse([[NSDate date] dateBySubtractingDays:1].isTomorrow, @"%s Failed", __PRETTY_FUNCTION__); - - //Test true future - XCTAssertTrue([[NSDate date] dateByAddingDays:1].isTomorrow, @"%s Failed", __PRETTY_FUNCTION__); - - //Tests false future - XCTAssertFalse([[NSDate date] dateByAddingDays:2].isTomorrow, @"%s Failed", __PRETTY_FUNCTION__); - -} --(void)testIsYesterday{ - //Test false with now - XCTAssertFalse([NSDate date].isYesterday, @"%s Failed", __PRETTY_FUNCTION__); - - //Test true past - XCTAssertTrue([[NSDate date] dateBySubtractingDays:1].isYesterday, @"%s Failed", __PRETTY_FUNCTION__); - - //Test false future - XCTAssertFalse([[NSDate date] dateByAddingDays:1].isYesterday, @"%s Failed", __PRETTY_FUNCTION__); - - //Tests false future - XCTAssertFalse([[NSDate date] dateBySubtractingDays:2].isYesterday, @"%s Failed", __PRETTY_FUNCTION__); -} - --(void)testIsWeekend{ - //Created test dates - NSDate *testFriday = [self.formatter dateFromString:@"2015 09 04 12:45:12.000"]; - NSDate *testMonday = [self.formatter dateFromString:@"2015 02 16 00:00:00.000"]; - NSDate *testWeekend = [self.formatter dateFromString:@"2015 09 05 17:45:12.000"]; - - //Test false with friday and monday - XCTAssertFalse(testFriday.isWeekend, @"%s Failed", __PRETTY_FUNCTION__); - XCTAssertFalse(testMonday.isWeekend, @"%s Failed", __PRETTY_FUNCTION__); - - //Test true past - XCTAssertTrue(testWeekend.isWeekend, @"%s Failed", __PRETTY_FUNCTION__); -} - --(void)testIsSameDay { - //Test same time stamp - XCTAssertTrue([[NSDate date] isSameDay:[NSDate date]], @"%s Failed", __PRETTY_FUNCTION__); - - //Test true same day - NSDate *testSameDay1 = [self.formatter dateFromString:@"2014 11 05 12:45:12.000"]; - NSDate *testSameDay2 = [self.formatter dateFromString:@"2014 11 05 17:45:12.000"]; - XCTAssertTrue([testSameDay1 isSameDay:testSameDay2], @"%s Failed", __PRETTY_FUNCTION__); - - //Test false 1 day ahead - XCTAssertFalse([testSameDay1 isSameDay:[[NSDate date] dateByAddingDays:1]], @"%s Failed", __PRETTY_FUNCTION__); - - //Test false 1 day before - XCTAssertFalse([testSameDay1 isSameDay:[[NSDate date] dateBySubtractingDays:1]], @"%s Failed", __PRETTY_FUNCTION__); -} - --(void)testIsSameDayStatic { - //Test true same time stamp - XCTAssertTrue([NSDate isSameDay:[NSDate date] asDate:[NSDate date]], @"%s Failed", __PRETTY_FUNCTION__); - - //Test true same day - NSDate *testSameDay1 = [self.formatter dateFromString:@"2014 11 05 12:45:12.000"]; - NSDate *testSameDay2 = [self.formatter dateFromString:@"2014 11 05 17:45:12.000"]; - XCTAssertTrue([NSDate isSameDay:testSameDay1 asDate:testSameDay2], @"%s Failed", __PRETTY_FUNCTION__); - - //Test false 1 day ahead - XCTAssertFalse([NSDate isSameDay:[NSDate date] asDate:[[NSDate date] dateByAddingDays:1]], @"%s Failed", __PRETTY_FUNCTION__); - - //Test false 1 day before - XCTAssertFalse([NSDate isSameDay:[NSDate date] asDate:[[NSDate date] dateBySubtractingDays:1]], @"%s Failed", __PRETTY_FUNCTION__); -} - -#pragma mark - Date Editing -#pragma mark Date Creating - -- (void)testDateWithYearMonthDayHourMinuteSecond{ - XCTAssertEqual(YES, [self.controlDate isEqualToDate:[NSDate dateWithYear:2014 month:11 day:5 hour:18 minute:15 second:12]], @"%s Failed", __PRETTY_FUNCTION__); -} - -- (void)testDateWithStringFormatStringTimeZone { - NSDate *testDate = [NSDate dateWithString:@"2015-02-27T18:15:00" - formatString:@"yyyy-MM-dd'T'HH:mm:ss" - timeZone:[NSTimeZone timeZoneWithName:@"UTC"]]; - - XCTAssertEqual(YES, [testDate isEqualToDate:[NSDate dateWithString:@"2015-02-27T19:15:00" - formatString:@"yyyy-MM-dd'T'HH:mm:ss" - timeZone:[NSTimeZone timeZoneWithName:@"Europe/Warsaw"]]], @"%s Failed", __PRETTY_FUNCTION__); -} - -#pragma mark Date By Adding -- (void)testDateByAddingYears{ - NSDate *testDate = [self.formatter dateFromString:@"2016 11 05 18:15:12.000"]; - XCTAssertEqual(YES, [[self.controlDate dateByAddingYears:2] isEqualToDate:testDate], @"%s Failed", __PRETTY_FUNCTION__); -} -- (void)testDateByAddingMonths{ - NSDate *testDate = [self.formatter dateFromString:@"2015 01 05 18:15:12.000"]; - XCTAssertEqual(YES, [[self.controlDate dateByAddingMonths:2] isEqualToDate:testDate], @"%s Failed", __PRETTY_FUNCTION__); -} -- (void)testDateByAddingWeeks{ - NSDate *testDate = [self.formatter dateFromString:@"2014 11 12 18:15:12.000"]; - XCTAssertEqual(YES, [[self.controlDate dateByAddingWeeks:1] isEqualToDate:testDate], @"%s Failed", __PRETTY_FUNCTION__); -} -- (void)testDateByAddingDays{ - NSDate *testDate = [self.formatter dateFromString:@"2014 11 07 18:15:12.000"]; - XCTAssertEqual(YES, [[self.controlDate dateByAddingDays:2] isEqualToDate:testDate], @"%s Failed", __PRETTY_FUNCTION__); -} -- (void)testDateByAddingHours{ - NSDate *testDate = [self.formatter dateFromString:@"2014 11 06 6:15:12.000"]; - XCTAssertEqual(YES, [[self.controlDate dateByAddingHours:12] isEqualToDate:testDate], @"%s Failed", __PRETTY_FUNCTION__); -} -- (void)testDateByAddingMinutes{ - NSDate *testDate = [self.formatter dateFromString:@"2014 11 05 18:30:12.000"]; - XCTAssertEqual(YES, [[self.controlDate dateByAddingMinutes:15] isEqualToDate:testDate], @"%s Failed", __PRETTY_FUNCTION__); -} -- (void)testDateByAddingSeconds{ - NSDate *testDate = [self.formatter dateFromString:@"2014 11 05 18:16:12.000"]; - XCTAssertEqual(YES, [[self.controlDate dateByAddingSeconds:60] isEqualToDate:testDate], @"%s Failed", __PRETTY_FUNCTION__); -} - -#pragma mark Date By Subtracting -- (void)testDateBySubtractingYears{ - NSDate *testDate = [self.formatter dateFromString:@"2000 11 05 18:15:12.000"]; - XCTAssertEqual(YES, [[self.controlDate dateBySubtractingYears:14] isEqualToDate:testDate], @"%s Failed", __PRETTY_FUNCTION__); -} -- (void)testDateBySubtractingMonths{ - NSDate *testDate = [self.formatter dateFromString:@"2014 4 05 18:15:12.000"]; - XCTAssertEqual(YES, [[self.controlDate dateBySubtractingMonths:7] isEqualToDate:testDate], @"%s Failed", __PRETTY_FUNCTION__); -} -- (void)testDateBySubtractingWeeks{ - NSDate *testDate = [self.formatter dateFromString:@"2014 10 29 18:15:12.000"]; - XCTAssertEqual(YES, [[self.controlDate dateBySubtractingWeeks:1] isEqualToDate:testDate], @"%s Failed", __PRETTY_FUNCTION__); -} -- (void)testDateBySubtractingDays{ - NSDate *testDate = [self.formatter dateFromString:@"2014 11 01 18:15:12.000"]; - XCTAssertEqual(YES, [[self.controlDate dateBySubtractingDays:4] isEqualToDate:testDate], @"%s Failed", __PRETTY_FUNCTION__); -} -- (void)testDateBySubtractingHours{ - NSDate *testDate = [self.formatter dateFromString:@"2014 11 05 00:15:12.000"]; - XCTAssertEqual(YES, [[self.controlDate dateBySubtractingHours:18] isEqualToDate:testDate], @"%s Failed", __PRETTY_FUNCTION__); -} -- (void)testDateBySubtractingMinutes{ - NSDate *testDate = [self.formatter dateFromString:@"2014 11 05 17:45:12.000"]; - XCTAssertEqual(YES, [[self.controlDate dateBySubtractingMinutes:30] isEqualToDate:testDate], @"%s Failed", __PRETTY_FUNCTION__); -} -- (void)testDateBySubtractingSeconds{ - NSDate *testDate = [self.formatter dateFromString:@"2014 11 05 18:14:12.000"]; - XCTAssertEqual(YES, [[self.controlDate dateBySubtractingSeconds:60] isEqualToDate:testDate], @"%s Failed", __PRETTY_FUNCTION__); -} - -#pragma mark - Date Comparison -#pragma mark Time From --(void)testYearsFrom{ - //Under a year - NSDate *testDate = [self.formatter dateFromString:@"2014 11 12 18:15:12.000"]; - XCTAssertEqual(0, [self.controlDate yearsFrom:testDate], @"%s Failed", __PRETTY_FUNCTION__); - - //Exactly a year - NSDate *testDate2 = [self.formatter dateFromString:@"2015 11 05 18:15:12.000"]; - XCTAssertEqual(-1, [self.controlDate yearsFrom:testDate2], @"%s Failed", __PRETTY_FUNCTION__); - - //Year number later, still less than a year - NSDate *testDate3 = [self.formatter dateFromString:@"2015 11 04 18:15:12.000"]; - XCTAssertEqual(0, [self.controlDate yearsFrom:testDate3], @"%s Failed", __PRETTY_FUNCTION__); - - //Year number earlier, still less than a year - NSDate *testDate5 = [self.formatter dateFromString:@"2013 11 06 18:15:12.000"]; - XCTAssertEqual(0, [self.controlDate yearsFrom:testDate5], @"%s Failed", __PRETTY_FUNCTION__); - - //Over a year earlier - NSDate *testDate6 = [self.formatter dateFromString:@"2012 11 04 18:15:12.000"]; - XCTAssertEqual(2, [self.controlDate yearsFrom:testDate6], @"%s Failed", __PRETTY_FUNCTION__); - - ///Over a year later - NSDate *testDate7 = [self.formatter dateFromString:@"2017 11 12 18:15:12.000"]; - XCTAssertEqual(-3, [self.controlDate yearsFrom:testDate7], @"%s Failed", __PRETTY_FUNCTION__); - - ///Over a year later, but less than a year in final comparison year - NSDate *testDate8 = [self.formatter dateFromString:@"2017 11 3 18:15:12.000"]; - XCTAssertEqual(-2, [self.controlDate yearsFrom:testDate8], @"%s Failed", __PRETTY_FUNCTION__); - - ///Over a year earlier, but less than a year in final comparison year - NSDate *testDate9 = [self.formatter dateFromString:@"2012 11 8 18:15:12.000"]; - XCTAssertEqual(1, [self.controlDate yearsFrom:testDate9], @"%s Failed", __PRETTY_FUNCTION__); -} --(void)testMonthsFrom{ - //Under a month - NSDate *testDate = [self.formatter dateFromString:@"2014 11 12 18:15:12.000"]; - XCTAssertEqual(0, [self.controlDate monthsFrom:testDate], @"%s Failed", __PRETTY_FUNCTION__); - - //Exactly a month - NSDate *testDate2 = [self.formatter dateFromString:@"2014 12 05 18:15:12.000"]; - XCTAssertEqual(-1, [self.controlDate monthsFrom:testDate2], @"%s Failed", __PRETTY_FUNCTION__); - - //Year number later, still less than a year - NSDate *testDate3 = [self.formatter dateFromString:@"2015 11 04 18:15:12.000"]; - XCTAssertEqual(-11, [self.controlDate monthsFrom:testDate3], @"%s Failed", __PRETTY_FUNCTION__); - - //Year number earlier, still less than a year - NSDate *testDate5 = [self.formatter dateFromString:@"2013 11 06 18:15:12.000"]; - XCTAssertEqual(11, [self.controlDate monthsFrom:testDate5], @"%s Failed", __PRETTY_FUNCTION__); - - //Over a year earlier - NSDate *testDate6 = [self.formatter dateFromString:@"2012 11 04 18:15:12.000"]; - XCTAssertEqual(24, [self.controlDate monthsFrom:testDate6], @"%s Failed", __PRETTY_FUNCTION__); - - ///Over a year later - NSDate *testDate7 = [self.formatter dateFromString:@"2017 11 12 18:15:12.000"]; - XCTAssertEqual(-36, [self.controlDate monthsFrom:testDate7], @"%s Failed", __PRETTY_FUNCTION__); -} --(void)testWeeksFrom{ - //Same week - NSDate *testSameDate = [self.formatter dateFromString:@"2014 11 06 18:15:12.000"]; - XCTAssertEqual(0, [self.controlDate weeksFrom:testSameDate], @"%s Failed", __PRETTY_FUNCTION__); - - //Same year - NSDate *testDate = [self.formatter dateFromString:@"2014 11 12 18:15:12.000"]; - XCTAssertEqual(-1, [self.controlDate weeksFrom:testDate], @"%s Failed", __PRETTY_FUNCTION__); - - //Eariler year - NSDate *testDate2 = [self.formatter dateFromString:@"2013 11 12 18:15:12.000"]; - XCTAssertEqual(51, [self.controlDate weeksFrom:testDate2], @"%s Failed", __PRETTY_FUNCTION__); - - //Later year - NSDate *testDate3 = [self.formatter dateFromString:@"2015 11 12 18:15:12.000"]; - XCTAssertEqual(-53, [self.controlDate weeksFrom:testDate3], @"%s Failed", __PRETTY_FUNCTION__); -} --(void)testDaysFrom{ - //Same day - NSDate *testSameDate = [self.formatter dateFromString:@"2014 11 05 18:15:12.000"]; - XCTAssertEqual(0, [self.controlDate daysFrom:testSameDate], @"%s Failed", __PRETTY_FUNCTION__); - - //Same year - NSDate *testDate = [self.formatter dateFromString:@"2014 11 12 18:15:12.000"]; - XCTAssertEqual(-7, [self.controlDate daysFrom:testDate], @"%s Failed", __PRETTY_FUNCTION__); - - //Eariler year - NSDate *testDate2 = [self.formatter dateFromString:@"2013 11 12 18:15:12.000"]; - XCTAssertEqual(358, [self.controlDate daysFrom:testDate2], @"%s Failed", __PRETTY_FUNCTION__); - - //Later year - NSDate *testDate3 = [self.formatter dateFromString:@"2015 11 12 18:15:12.000"]; - XCTAssertEqual(-372, [self.controlDate daysFrom:testDate3], @"%s Failed", __PRETTY_FUNCTION__); -} --(void)testHoursFrom{ - //Later - NSDate *testDate = [self.formatter dateFromString:@"2014 11 05 20:15:12.000"]; - XCTAssertEqual(-2, [self.controlDate hoursFrom:testDate], @"%s Failed", __PRETTY_FUNCTION__); - - //Earlier - NSDate *testDate2 = [self.formatter dateFromString:@"2014 11 05 15:15:12.000"]; - XCTAssertEqual(3, [self.controlDate hoursFrom:testDate2], @"%s Failed", __PRETTY_FUNCTION__); -} --(void)testMinutesFrom{ - //Later - NSDate *testDate = [self.formatter dateFromString:@"2014 11 05 20:15:12.000"]; - XCTAssertEqual(-120, [self.controlDate minutesFrom:testDate], @"%s Failed", __PRETTY_FUNCTION__); - - //Earlier - NSDate *testDate2 = [self.formatter dateFromString:@"2014 11 05 15:15:12.000"]; - XCTAssertEqual(180, [self.controlDate minutesFrom:testDate2], @"%s Failed", __PRETTY_FUNCTION__); -} --(void)testSecondsFrom{ - //Later - NSDate *testDate = [self.formatter dateFromString:@"2014 11 05 20:15:12.000"]; - XCTAssertEqual(-7200, [self.controlDate secondsFrom:testDate], @"%s Failed", __PRETTY_FUNCTION__); - - //Earlier - NSDate *testDate2 = [self.formatter dateFromString:@"2014 11 05 15:15:12.000"]; - XCTAssertEqual(10800, [self.controlDate secondsFrom:testDate2], @"%s Failed", __PRETTY_FUNCTION__); -} - -#pragma mark Earlier Than --(void)testYearsEarlierThan{ - //Under a year - NSDate *testDate = [self.formatter dateFromString:@"2014 11 12 18:15:12.000"]; - XCTAssertEqual(0, [self.controlDate yearsEarlierThan:testDate], @"%s Failed", __PRETTY_FUNCTION__); - - //Exactly a year - NSDate *testDate2 = [self.formatter dateFromString:@"2015 11 05 18:15:12.000"]; - XCTAssertEqual(1, [self.controlDate yearsEarlierThan:testDate2], @"%s Failed", __PRETTY_FUNCTION__); - - //Year number later, still less than a year - NSDate *testDate3 = [self.formatter dateFromString:@"2015 11 04 18:15:12.000"]; - XCTAssertEqual(0, [self.controlDate yearsEarlierThan:testDate3], @"%s Failed", __PRETTY_FUNCTION__); - - //Year number earlier, still less than a year - NSDate *testDate5 = [self.formatter dateFromString:@"2013 11 06 18:15:12.000"]; - XCTAssertEqual(0, [self.controlDate yearsEarlierThan:testDate5], @"%s Failed", __PRETTY_FUNCTION__); - - //Over a year earlier - NSDate *testDate6 = [self.formatter dateFromString:@"2012 11 04 18:15:12.000"]; - XCTAssertEqual(0, [self.controlDate yearsEarlierThan:testDate6], @"%s Failed", __PRETTY_FUNCTION__); - - ///Over a year later - NSDate *testDate7 = [self.formatter dateFromString:@"2017 11 12 18:15:12.000"]; - XCTAssertEqual(3, [self.controlDate yearsEarlierThan:testDate7], @"%s Failed", __PRETTY_FUNCTION__); - - ///Over a year later, but less than a year in final comparison year - NSDate *testDate8 = [self.formatter dateFromString:@"2017 11 3 18:15:12.000"]; - XCTAssertEqual(2, [self.controlDate yearsEarlierThan:testDate8], @"%s Failed", __PRETTY_FUNCTION__); - - ///Over a year earlier, but less than a year in final comparison year - NSDate *testDate9 = [self.formatter dateFromString:@"2012 11 8 18:15:12.000"]; - XCTAssertEqual(0, [self.controlDate yearsEarlierThan:testDate9], @"%s Failed", __PRETTY_FUNCTION__); -} --(void)testMonthsEarlerThan{ - //Under a month - NSDate *testDate = [self.formatter dateFromString:@"2014 11 12 18:15:12.000"]; - XCTAssertEqual(0, [self.controlDate monthsEarlierThan:testDate], @"%s Failed", __PRETTY_FUNCTION__); - - //Exactly a month - NSDate *testDate2 = [self.formatter dateFromString:@"2014 12 05 18:15:12.000"]; - XCTAssertEqual(1, [self.controlDate monthsEarlierThan:testDate2], @"%s Failed", __PRETTY_FUNCTION__); - - //Year number later, still less than a year - NSDate *testDate3 = [self.formatter dateFromString:@"2015 11 04 18:15:12.000"]; - XCTAssertEqual(11, [self.controlDate monthsEarlierThan:testDate3], @"%s Failed", __PRETTY_FUNCTION__); - - //Year number earlier, still less than a year - NSDate *testDate5 = [self.formatter dateFromString:@"2013 11 06 18:15:12.000"]; - XCTAssertEqual(0, [self.controlDate monthsEarlierThan:testDate5], @"%s Failed", __PRETTY_FUNCTION__); - - //Over a year earlier - NSDate *testDate6 = [self.formatter dateFromString:@"2012 11 04 18:15:12.000"]; - XCTAssertEqual(0, [self.controlDate monthsEarlierThan:testDate6], @"%s Failed", __PRETTY_FUNCTION__); - - ///Over a year later - NSDate *testDate7 = [self.formatter dateFromString:@"2017 11 12 18:15:12.000"]; - XCTAssertEqual(36, [self.controlDate monthsEarlierThan:testDate7], @"%s Failed", __PRETTY_FUNCTION__); -} --(void)testWeeksEarlierThan{ - //Same week - NSDate *testSameDate = [self.formatter dateFromString:@"2014 11 06 18:15:12.000"]; - XCTAssertEqual(0, [self.controlDate weeksEarlierThan:testSameDate], @"%s Failed", __PRETTY_FUNCTION__); - - //Same year - NSDate *testDate = [self.formatter dateFromString:@"2014 11 12 18:15:12.000"]; - XCTAssertEqual(1, [self.controlDate weeksEarlierThan:testDate], @"%s Failed", __PRETTY_FUNCTION__); - - //Eariler year - NSDate *testDate2 = [self.formatter dateFromString:@"2013 11 12 18:15:12.000"]; - XCTAssertEqual(0, [self.controlDate weeksEarlierThan:testDate2], @"%s Failed", __PRETTY_FUNCTION__); - - //Later year - NSDate *testDate3 = [self.formatter dateFromString:@"2015 11 12 18:15:12.000"]; - XCTAssertEqual(53, [self.controlDate weeksEarlierThan:testDate3], @"%s Failed", __PRETTY_FUNCTION__); -} --(void)testDaysEarlierThan{ - //Same day - NSDate *testSameDate = [self.formatter dateFromString:@"2014 11 05 18:15:12.000"]; - XCTAssertEqual(0, [self.controlDate daysEarlierThan:testSameDate], @"%s Failed", __PRETTY_FUNCTION__); - - //Same year - NSDate *testDate = [self.formatter dateFromString:@"2014 11 12 18:15:12.000"]; - XCTAssertEqual(7, [self.controlDate daysEarlierThan:testDate], @"%s Failed", __PRETTY_FUNCTION__); - - //Eariler year - NSDate *testDate2 = [self.formatter dateFromString:@"2013 11 12 18:15:12.000"]; - XCTAssertEqual(0, [self.controlDate daysEarlierThan:testDate2], @"%s Failed", __PRETTY_FUNCTION__); - - //Later year - NSDate *testDate3 = [self.formatter dateFromString:@"2015 11 12 18:15:12.000"]; - XCTAssertEqual(372, [self.controlDate daysEarlierThan:testDate3], @"%s Failed", __PRETTY_FUNCTION__); -} --(void)testHoursEarlierThan{ - //Later - NSDate *testDate = [self.formatter dateFromString:@"2014 11 05 20:15:12.000"]; - XCTAssertEqual(2, [self.controlDate hoursEarlierThan:testDate], @"%s Failed", __PRETTY_FUNCTION__); - - //Earlier - NSDate *testDate2 = [self.formatter dateFromString:@"2014 11 05 15:15:12.000"]; - XCTAssertEqual(0, [self.controlDate hoursEarlierThan:testDate2], @"%s Failed", __PRETTY_FUNCTION__); -} --(void)testMinutesEarlierThan{ - //Later - NSDate *testDate = [self.formatter dateFromString:@"2014 11 05 20:15:12.000"]; - XCTAssertEqual(120, [self.controlDate minutesEarlierThan:testDate], @"%s Failed", __PRETTY_FUNCTION__); - - //Earlier - NSDate *testDate2 = [self.formatter dateFromString:@"2014 11 05 15:15:12.000"]; - XCTAssertEqual(0, [self.controlDate minutesEarlierThan:testDate2], @"%s Failed", __PRETTY_FUNCTION__); -} --(void)testSecondsEarlierThan{ - //Later - NSDate *testDate = [self.formatter dateFromString:@"2014 11 05 20:15:12.000"]; - XCTAssertEqual(7200, [self.controlDate secondsEarlierThan:testDate], @"%s Failed", __PRETTY_FUNCTION__); - - //Earlier - NSDate *testDate2 = [self.formatter dateFromString:@"2014 11 05 15:15:12.000"]; - XCTAssertEqual(0, [self.controlDate secondsEarlierThan:testDate2], @"%s Failed", __PRETTY_FUNCTION__); -} - -#pragma mark Later Than --(void)testYearsLaterThan{ - //Under a year - NSDate *testDate = [self.formatter dateFromString:@"2014 11 12 18:15:12.000"]; - XCTAssertEqual(0, [self.controlDate yearsLaterThan:testDate], @"%s Failed", __PRETTY_FUNCTION__); - - //Exactly a year later - NSDate *testDate2 = [self.formatter dateFromString:@"2015 11 05 18:15:12.000"]; - XCTAssertEqual(0, [self.controlDate yearsLaterThan:testDate2], @"%s Failed", __PRETTY_FUNCTION__); - - //Exactly a year earlier - NSDate *testDate3 = [self.formatter dateFromString:@"2013 11 05 18:15:12.000"]; - XCTAssertEqual(1, [self.controlDate yearsLaterThan:testDate3], @"%s Failed", __PRETTY_FUNCTION__); - - //Year number later, still less than a year - NSDate *testDate4 = [self.formatter dateFromString:@"2015 11 04 18:15:12.000"]; - XCTAssertEqual(0, [self.controlDate yearsLaterThan:testDate4], @"%s Failed", __PRETTY_FUNCTION__); - - //Year number earlier, still less than a year - NSDate *testDate5 = [self.formatter dateFromString:@"2013 11 06 18:15:12.000"]; - XCTAssertEqual(0, [self.controlDate yearsLaterThan:testDate5], @"%s Failed", __PRETTY_FUNCTION__); - - //Over a year earlier - NSDate *testDate6 = [self.formatter dateFromString:@"2012 11 04 18:15:12.000"]; - XCTAssertEqual(2, [self.controlDate yearsLaterThan:testDate6], @"%s Failed", __PRETTY_FUNCTION__); - - ///Over a year later - NSDate *testDate7 = [self.formatter dateFromString:@"2017 11 12 18:15:12.000"]; - XCTAssertEqual(0, [self.controlDate yearsLaterThan:testDate7], @"%s Failed", __PRETTY_FUNCTION__); - - ///Over a year later, but less than a year in final comparison year - NSDate *testDate8 = [self.formatter dateFromString:@"2017 11 3 18:15:12.000"]; - XCTAssertEqual(0, [self.controlDate yearsLaterThan:testDate8], @"%s Failed", __PRETTY_FUNCTION__); - - ///Over a year earlier, but less than a year in final comparison year - NSDate *testDate9 = [self.formatter dateFromString:@"2012 11 8 18:15:12.000"]; - XCTAssertEqual(1, [self.controlDate yearsLaterThan:testDate9], @"%s Failed", __PRETTY_FUNCTION__); -} --(void)testMonthsLaterThan{ - //Under a month - NSDate *testDate = [self.formatter dateFromString:@"2014 11 12 18:15:12.000"]; - XCTAssertEqual(0, [self.controlDate monthsLaterThan:testDate], @"%s Failed", __PRETTY_FUNCTION__); - - //Exactly a month - NSDate *testDate2 = [self.formatter dateFromString:@"2014 12 05 18:15:12.000"]; - XCTAssertEqual(0, [self.controlDate monthsLaterThan:testDate2], @"%s Failed", __PRETTY_FUNCTION__); - - //Year number later, still less than a year - NSDate *testDate3 = [self.formatter dateFromString:@"2015 11 04 18:15:12.000"]; - XCTAssertEqual(0, [self.controlDate monthsLaterThan:testDate3], @"%s Failed", __PRETTY_FUNCTION__); - - //Year number earlier, still less than a year - NSDate *testDate5 = [self.formatter dateFromString:@"2013 11 06 18:15:12.000"]; - XCTAssertEqual(11, [self.controlDate monthsLaterThan:testDate5], @"%s Failed", __PRETTY_FUNCTION__); - - //Over a year earlier - NSDate *testDate6 = [self.formatter dateFromString:@"2012 11 04 18:15:12.000"]; - XCTAssertEqual(24, [self.controlDate monthsLaterThan:testDate6], @"%s Failed", __PRETTY_FUNCTION__); - - ///Over a year later - NSDate *testDate7 = [self.formatter dateFromString:@"2017 11 12 18:15:12.000"]; - XCTAssertEqual(0, [self.controlDate monthsLaterThan:testDate7], @"%s Failed", __PRETTY_FUNCTION__); -} --(void)testWeeksLaterThan{ - //Same week - NSDate *testSameDate = [self.formatter dateFromString:@"2014 11 06 18:15:12.000"]; - XCTAssertEqual(0, [self.controlDate weeksLaterThan:testSameDate], @"%s Failed", __PRETTY_FUNCTION__); - - //Same year later - NSDate *testDate = [self.formatter dateFromString:@"2014 11 12 18:15:12.000"]; - XCTAssertEqual(0, [self.controlDate weeksLaterThan:testDate], @"%s Failed", __PRETTY_FUNCTION__); - - //Same year earlier - NSDate *testDate2 = [self.formatter dateFromString:@"2014 10 24 18:15:12.000"]; - XCTAssertEqual(1, [self.controlDate weeksLaterThan:testDate2], @"%s Failed", __PRETTY_FUNCTION__); - - //Eariler year - NSDate *testDate3 = [self.formatter dateFromString:@"2013 11 12 18:15:12.000"]; - XCTAssertEqual(51, [self.controlDate weeksLaterThan:testDate3], @"%s Failed", __PRETTY_FUNCTION__); - - //Later year - NSDate *testDate4 = [self.formatter dateFromString:@"2015 11 12 18:15:12.000"]; - XCTAssertEqual(0, [self.controlDate weeksLaterThan:testDate4], @"%s Failed", __PRETTY_FUNCTION__); -} --(void)testDaysLaterThan{ - //Same day - NSDate *testSameDate = [self.formatter dateFromString:@"2014 11 05 18:15:12.000"]; - XCTAssertEqual(0, [self.controlDate daysLaterThan:testSameDate], @"%s Failed", __PRETTY_FUNCTION__); - - //Same year later - NSDate *testDate = [self.formatter dateFromString:@"2014 11 12 18:15:12.000"]; - XCTAssertEqual(0, [self.controlDate daysLaterThan:testDate], @"%s Failed", __PRETTY_FUNCTION__); - - //Same year earlier - NSDate *testDate2 = [self.formatter dateFromString:@"2014 11 3 18:15:12.000"]; - XCTAssertEqual(2, [self.controlDate daysLaterThan:testDate2], @"%s Failed", __PRETTY_FUNCTION__); - - //Eariler year - NSDate *testDate3 = [self.formatter dateFromString:@"2013 11 12 18:15:12.000"]; - XCTAssertEqual(358, [self.controlDate daysLaterThan:testDate3], @"%s Failed", __PRETTY_FUNCTION__); - - //Later year - NSDate *testDate4 = [self.formatter dateFromString:@"2015 11 12 18:15:12.000"]; - XCTAssertEqual(0, [self.controlDate daysLaterThan:testDate4], @"%s Failed", __PRETTY_FUNCTION__); -} --(void)testHoursLaterThan{ - //Later - NSDate *testDate = [self.formatter dateFromString:@"2014 11 05 20:15:12.000"]; - XCTAssertEqual(0, [self.controlDate hoursLaterThan:testDate], @"%s Failed", __PRETTY_FUNCTION__); - - //Earlier - NSDate *testDate2 = [self.formatter dateFromString:@"2014 11 05 15:15:12.000"]; - XCTAssertEqual(3, [self.controlDate hoursLaterThan:testDate2], @"%s Failed", __PRETTY_FUNCTION__); -} --(void)testMinutesLaterThan{ - //Later - NSDate *testDate = [self.formatter dateFromString:@"2014 11 05 20:15:12.000"]; - XCTAssertEqual(0, [self.controlDate minutesLaterThan:testDate], @"%s Failed", __PRETTY_FUNCTION__); - - //Earlier - NSDate *testDate2 = [self.formatter dateFromString:@"2014 11 05 15:15:12.000"]; - XCTAssertEqual(180, [self.controlDate minutesLaterThan:testDate2], @"%s Failed", __PRETTY_FUNCTION__); -} --(void)testSecondsLaterThan{ - //Later - NSDate *testDate = [self.formatter dateFromString:@"2014 11 05 20:15:12.000"]; - XCTAssertEqual(0, [self.controlDate secondsLaterThan:testDate], @"%s Failed", __PRETTY_FUNCTION__); - - //Earlier - NSDate *testDate2 = [self.formatter dateFromString:@"2014 11 05 15:15:12.000"]; - XCTAssertEqual(10800, [self.controlDate secondsLaterThan:testDate2], @"%s Failed", __PRETTY_FUNCTION__); -} - -#pragma mark Comparators --(void)testIsEarlierThan{ - //Later - NSDate *testDate = [self.formatter dateFromString:@"2014 11 05 20:15:12.000"]; - XCTAssertEqual(YES, [self.controlDate isEarlierThan:testDate], @"%s Failed", __PRETTY_FUNCTION__); - - //Earlier - NSDate *testDate2 = [self.formatter dateFromString:@"2014 11 05 15:15:12.000"]; - XCTAssertEqual(NO, [self.controlDate isEarlierThan:testDate2], @"%s Failed", __PRETTY_FUNCTION__); - - //Same - XCTAssertEqual(NO, [self.controlDate isEarlierThan:self.controlDate], @"%s Failed", __PRETTY_FUNCTION__); -} --(void)testIsLaterThan{ - //Later - NSDate *testDate = [self.formatter dateFromString:@"2014 11 05 20:15:12.000"]; - XCTAssertEqual(NO, [self.controlDate isLaterThan:testDate], @"%s Failed", __PRETTY_FUNCTION__); - - //Earlier - NSDate *testDate2 = [self.formatter dateFromString:@"2014 11 05 15:15:12.000"]; - XCTAssertEqual(YES, [self.controlDate isLaterThan:testDate2], @"%s Failed", __PRETTY_FUNCTION__); - - //Same - XCTAssertEqual(NO, [self.controlDate isLaterThan:self.controlDate], @"%s Failed", __PRETTY_FUNCTION__); -} --(void)testisEarlierThanOrEqualTo{ - //Later - NSDate *testDate = [self.formatter dateFromString:@"2014 11 05 20:15:12.000"]; - XCTAssertEqual(YES, [self.controlDate isEarlierThanOrEqualTo:testDate], @"%s Failed", __PRETTY_FUNCTION__); - - //Earlier - NSDate *testDate2 = [self.formatter dateFromString:@"2014 11 05 15:15:12.000"]; - XCTAssertEqual(NO, [self.controlDate isEarlierThanOrEqualTo:testDate2], @"%s Failed", __PRETTY_FUNCTION__); - - //Same - XCTAssertEqual(YES, [self.controlDate isEarlierThanOrEqualTo:self.controlDate], @"%s Failed", __PRETTY_FUNCTION__); -} --(void)testIsLaterOrEqualToDate{ - //Later - NSDate *testDate = [self.formatter dateFromString:@"2014 11 05 20:15:12.000"]; - XCTAssertEqual(NO, [self.controlDate isLaterThanOrEqualTo:testDate], @"%s Failed", __PRETTY_FUNCTION__); - - //Earlier - NSDate *testDate2 = [self.formatter dateFromString:@"2014 11 05 15:15:12.000"]; - XCTAssertEqual(YES, [self.controlDate isLaterThanOrEqualTo:testDate2], @"%s Failed", __PRETTY_FUNCTION__); - - //Same - XCTAssertEqual(YES, [self.controlDate isLaterThanOrEqualTo:self.controlDate], @"%s Failed", __PRETTY_FUNCTION__); -} - -@end diff --git a/DateTools/Tests/DateToolsTests/DateToolsTestsTests/DateToolsTestsTests-Info.plist b/DateTools/Tests/DateToolsTests/DateToolsTestsTests/DateToolsTestsTests-Info.plist deleted file mode 100644 index c34963a6..00000000 --- a/DateTools/Tests/DateToolsTests/DateToolsTestsTests/DateToolsTestsTests-Info.plist +++ /dev/null @@ -1,22 +0,0 @@ - - - - - CFBundleDevelopmentRegion - en - CFBundleExecutable - ${EXECUTABLE_NAME} - CFBundleIdentifier - com.mattyork.${PRODUCT_NAME:rfc1034identifier} - CFBundleInfoDictionaryVersion - 6.0 - CFBundlePackageType - BNDL - CFBundleShortVersionString - 1.0 - CFBundleSignature - ???? - CFBundleVersion - 1 - - diff --git a/DateTools/Tests/DateToolsTests/DateToolsTestsTests/en.lproj/InfoPlist.strings b/DateTools/Tests/DateToolsTests/DateToolsTestsTests/en.lproj/InfoPlist.strings deleted file mode 100644 index 477b28ff..00000000 --- a/DateTools/Tests/DateToolsTests/DateToolsTestsTests/en.lproj/InfoPlist.strings +++ /dev/null @@ -1,2 +0,0 @@ -/* Localized versions of Info.plist keys */ - diff --git a/DateTools/Tests/DateToolsTests/DateToolsTestsTests/es.lproj/InfoPlist.strings b/DateTools/Tests/DateToolsTests/DateToolsTestsTests/es.lproj/InfoPlist.strings deleted file mode 100644 index 477b28ff..00000000 --- a/DateTools/Tests/DateToolsTests/DateToolsTestsTests/es.lproj/InfoPlist.strings +++ /dev/null @@ -1,2 +0,0 @@ -/* Localized versions of Info.plist keys */ - diff --git a/DateTools/Tests/DateToolsTests/DateToolsTestsTests/ja.lproj/InfoPlist.strings b/DateTools/Tests/DateToolsTests/DateToolsTestsTests/ja.lproj/InfoPlist.strings deleted file mode 100644 index 477b28ff..00000000 --- a/DateTools/Tests/DateToolsTests/DateToolsTestsTests/ja.lproj/InfoPlist.strings +++ /dev/null @@ -1,2 +0,0 @@ -/* Localized versions of Info.plist keys */ - diff --git a/DateToolsSwift/DateTools/DateTools.bundle/am.lproj/DateTools.strings b/DateToolsSwift/DateTools/DateTools.bundle/am.lproj/DateTools.strings deleted file mode 100755 index a80463e4..00000000 --- a/DateToolsSwift/DateTools/DateTools.bundle/am.lproj/DateTools.strings +++ /dev/null @@ -1,89 +0,0 @@ -/* No comment provided by engineer. */ -"%d days ago" = "%d ቀናት በፊት"; - -/* No comment provided by engineer. */ -"%d hours ago" = "%d ሰዓታት በፊት"; - -/* No comment provided by engineer. */ -"%d minutes ago" = "%d ደቂቃዎች በፊት"; - -/* No comment provided by engineer. */ -"%d months ago" = "%d ወሮች በፊት"; - -/* No comment provided by engineer. */ -"%d seconds ago" = "%d ሰከንዶች በፊት"; - -/* No comment provided by engineer. */ -"%d weeks ago" = "%d ሳምንታት በፊት"; - -/* No comment provided by engineer. */ -"%d years ago" = "%d አመታት በፊት"; - -/* No comment provided by engineer. */ -"A minute ago" = "አንድ ደቂቃ በፊት"; - -/* No comment provided by engineer. */ -"An hour ago" = "አንድ ሰዓት በፊት"; - -/* No comment provided by engineer. */ -"Just now" = "ልክ አሁን"; - -/* No comment provided by engineer. */ -"Last month" = "ያለፈው ወር"; - -/* No comment provided by engineer. */ -"Last week" = "ያለፈው ሳምንት"; - -/* No comment provided by engineer. */ -"Last year" = "ያለፈው አመት"; - -/* No comment provided by engineer. */ -"Yesterday" = "ትናንትና"; - -/* No comment provided by engineer. */ -"1 year ago" = "አንድ አመት በፊት"; - -/* No comment provided by engineer. */ -"1 month ago" = "አንድ ወር በፊት"; - -/* No comment provided by engineer. */ -"1 week ago" = "አንድ ሳምንት በፊት"; - -/* No comment provided by engineer. */ -"1 day ago" = "አንድ ቀን በፊት"; - -/* No comment provided by engineer. */ -"1 hour ago" = "አንድ ሰዓት በፊት"; - -/* No comment provided by engineer. */ -"1 minute ago" = "አንድ ደቂቃ በፊት"; - -/* No comment provided by engineer. */ -"1 second ago" = "አንድ ሰከንድ በፊት"; - -/* No comment provided by engineer. */ -"This morning" = "ዛሬ ጠዋት"; - -/* No comment provided by engineer. */ -"This afternoon" = "ዛሬ ከሰዓት"; - -/* No comment provided by engineer. */ -"Today" = "ዛሬ"; - -/* No comment provided by engineer. */ -"This week" = "በዚህ ሳምንት"; - -/* No comment provided by engineer. */ -"This month" = "በዚህ ወር"; - -/* No comment provided by engineer. */ -"This year" = "በዚህ አመት"; - -/* Short format for */ -"%dy" = "%dy"; // year -"%dM" = "%dM"; // month -"%dw" = "%dw"; // week -"%dd" = "%dd"; // day -"%dh" = "%dh"; // hour -"%dm" = "%dm"; // minute -"%ds" = "%ds"; // second diff --git a/DateToolsSwift/DateTools/DateTools.bundle/ar.lproj/DateTools.strings b/DateToolsSwift/DateTools/DateTools.bundle/ar.lproj/DateTools.strings deleted file mode 100644 index 4c6a3dc2a2626f0d9b508d26dfdb33ccba82c9b1..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 3332 zcmchZO;5r=5QgV82Yy9EqkI^w1T_-l0b{|`kCPXVRS<}wH6RlHy!y_T&6Y?*FJnkI zWmxFL%=^yl&v!sg^5~ILtgl#Sc#SBbPrU!2IU-*)r6FQNL|$l(RX!ghn&57PJ;#VO zDWD2f>A>t8QjDDo#AEDC5%=f{SCvBU^9g&KeLhEAUS53gO%5}sR6mr9NShd`J4`pP}b`EzPS)QJG*(13RL2{0&=+jsqZL^4H z>QHDGQ{sPltcSLFWFCb7#PV$BflP%tI-bl>$Kr#cqgItRTw?!!u}iXCXemP&oI;B! zbSIBcSY;M7IF)KYOGNmb_Pq;lpP=QKIMS+2J6#u;2&=$kZ=~4gy diff --git a/DateToolsSwift/DateTools/DateTools.bundle/bg.lproj/DateTools.strings b/DateToolsSwift/DateTools/DateTools.bundle/bg.lproj/DateTools.strings deleted file mode 100644 index b40d6b79..00000000 --- a/DateToolsSwift/DateTools/DateTools.bundle/bg.lproj/DateTools.strings +++ /dev/null @@ -1,71 +0,0 @@ -/* No comment provided by engineer. */ -"%d days ago" = "преди %d дена"; - -/* No comment provided by engineer. */ -"%d hours ago" = "преди %d часа"; - -/* No comment provided by engineer. */ -"%d minutes ago" = "преди %d минути"; - -/* No comment provided by engineer. */ -"%d months ago" = "преди %d месеца"; - -/* No comment provided by engineer. */ -"%d seconds ago" = "преди %d секунди"; - -/* No comment provided by engineer. */ -"%d weeks ago" = "преди %d седмици"; - -/* No comment provided by engineer. */ -"%d years ago" = "преди %d години"; - -/* No comment provided by engineer. */ -"A minute ago" = "преди минута"; - -/* No comment provided by engineer. */ -"An hour ago" = "преди час"; - -/* No comment provided by engineer. */ -"Just now" = "току що"; - -/* No comment provided by engineer. */ -"Last month" = "през последния месец"; - -/* No comment provided by engineer. */ -"Last week" = "през последната седмица"; - -/* No comment provided by engineer. */ -"Last year" = "през последната година"; - -/* No comment provided by engineer. */ -"Yesterday" = "вчера"; - -/* No comment provided by engineer. */ -"1 year ago" = "преди 1 година"; - -/* No comment provided by engineer. */ -"1 month ago" = "преди 1 месец"; - -/* No comment provided by engineer. */ -"1 week ago" = "преди 1 седмица"; - -/* No comment provided by engineer. */ -"1 day ago" = "преди 1 ден"; - -/* No comment provided by engineer. */ -"This morning" = "тази сутрин"; - -/* No comment provided by engineer. */ -"This afternoon" = "тази вечер"; - -/* No comment provided by engineer. */ -"Today" = "днес"; - -/* No comment provided by engineer. */ -"This week" = "тази седмица"; - -/* No comment provided by engineer. */ -"This month" = "този месец"; - -/* No comment provided by engineer. */ -"This year" = "тази година"; diff --git a/DateToolsSwift/DateTools/DateTools.bundle/ca.lproj/DateTools.strings b/DateToolsSwift/DateTools/DateTools.bundle/ca.lproj/DateTools.strings deleted file mode 100644 index b5d6ef01..00000000 --- a/DateToolsSwift/DateTools/DateTools.bundle/ca.lproj/DateTools.strings +++ /dev/null @@ -1,71 +0,0 @@ -/* No comment provided by engineer. */ -"%d days ago" = "Fa %d dies"; - -/* No comment provided by engineer. */ -"%d hours ago" = "Fa %d hores"; - -/* No comment provided by engineer. */ -"%d minutes ago" = "Fa %d minuts"; - -/* No comment provided by engineer. */ -"%d months ago" = "Fa %d mesos"; - -/* No comment provided by engineer. */ -"%d seconds ago" = "Fa %d segons"; - -/* No comment provided by engineer. */ -"%d weeks ago" = "Fa %d setmanes"; - -/* No comment provided by engineer. */ -"%d years ago" = "Fa %d anys"; - -/* No comment provided by engineer. */ -"A minute ago" = "Fa un minut"; - -/* No comment provided by engineer. */ -"An hour ago" = "Fa una hora"; - -/* No comment provided by engineer. */ -"Just now" = "Fa un moment"; - -/* No comment provided by engineer. */ -"Last month" = "El mes passat"; - -/* No comment provided by engineer. */ -"Last week" = "La setmana passada"; - -/* No comment provided by engineer. */ -"Last year" = "L'any passat"; - -/* No comment provided by engineer. */ -"Yesterday" = "Ahir"; - -/* No comment provided by engineer. */ -"1 year ago" = "Fa un any"; - -/* No comment provided by engineer. */ -"1 month ago" = "Fa un mes"; - -/* No comment provided by engineer. */ -"1 week ago" = "Fa una setmana"; - -/* No comment provided by engineer. */ -"1 day ago" = "Fa un dia"; - -/* No comment provided by engineer. */ -"This morning" = "Aquest matí"; - -/* No comment provided by engineer. */ -"This afternoon" = "Aquesta tarda"; - -/* No comment provided by engineer. */ -"Today" = "Avui"; - -/* No comment provided by engineer. */ -"This week" = "Aquesta setmana"; - -/* No comment provided by engineer. */ -"This month" = "Aquest mes"; - -/* No comment provided by engineer. */ -"This year" = "Aquest any"; diff --git a/DateToolsSwift/DateTools/DateTools.bundle/cs.lproj/DateTools.strings b/DateToolsSwift/DateTools/DateTools.bundle/cs.lproj/DateTools.strings deleted file mode 100644 index 30285ac4..00000000 --- a/DateToolsSwift/DateTools/DateTools.bundle/cs.lproj/DateTools.strings +++ /dev/null @@ -1,80 +0,0 @@ -/* No comment provided by engineer. */ -"%d days ago" = "Před %d dny"; - -/* No comment provided by engineer. */ -"%d hours ago" = "Před %d hodinami"; - -/* No comment provided by engineer. */ -"%d minutes ago" = "Před %d minutami"; - -/* No comment provided by engineer. */ -"%d months ago" = "Před %d měsíci"; - -/* No comment provided by engineer. */ -"%d seconds ago" = "Před %d sekundami"; - -/* No comment provided by engineer. */ -"%d weeks ago" = "Před %d týdny"; - -/* No comment provided by engineer. */ -"%d years ago" = "Před %d lety"; - -/* No comment provided by engineer. */ -"A minute ago" = "Před minutou"; - -/* No comment provided by engineer. */ -"An hour ago" = "Před hodinou"; - -/* No comment provided by engineer. */ -"Just now" = "Právě teď"; - -/* No comment provided by engineer. */ -"Last month" = "Minulý měsíc"; - -/* No comment provided by engineer. */ -"Last week" = "Minulý týden"; - -/* No comment provided by engineer. */ -"Last year" = "Minulý rok"; - -/* No comment provided by engineer. */ -"Yesterday" = "Včera"; - -/* No comment provided by engineer. */ -"1 year ago" = "Před rokem"; - -/* No comment provided by engineer. */ -"1 month ago" = "Před měsícem"; - -/* No comment provided by engineer. */ -"1 week ago" = "Před týdnem"; - -/* No comment provided by engineer. */ -"1 day ago" = "Předevčírem"; - -/* No comment provided by engineer. */ -"This morning" = "Dnes dopoledne"; - -/* No comment provided by engineer. */ -"This afternoon" = "Dnes odpoledne"; - -/* No comment provided by engineer. */ -"Today" = "Dnes"; - -/* No comment provided by engineer. */ -"This week" = "Tento týden"; - -/* No comment provided by engineer. */ -"This month" = "Tento měsíc"; - -/* No comment provided by engineer. */ -"This year" = "Letos"; - -/* Short format for */ -"%dy" = "%dr"; // year -"%dM" = "%dM"; // month -"%dw" = "%dt"; // week -"%dd" = "%dd"; // day -"%dh" = "%dh"; // hour -"%dm" = "%dm"; // minute -"%ds" = "%ds"; // second diff --git a/DateToolsSwift/DateTools/DateTools.bundle/cy.lproj/DateTools.strings b/DateToolsSwift/DateTools/DateTools.bundle/cy.lproj/DateTools.strings deleted file mode 100644 index 97005468..00000000 --- a/DateToolsSwift/DateTools/DateTools.bundle/cy.lproj/DateTools.strings +++ /dev/null @@ -1,71 +0,0 @@ -/* No comment provided by engineer. */ -"%d days ago" = "%d diwrnod yn ôl"; - -/* No comment provided by engineer. */ -"%d hours ago" = "%d awr yn ôl"; - -/* No comment provided by engineer. */ -"%d minutes ago" = "%d munud yn ôl"; - -/* No comment provided by engineer. */ -"%d months ago" = "%d mis yn ôl"; - -/* No comment provided by engineer. */ -"%d seconds ago" = "%d eiliad yn ôl"; - -/* No comment provided by engineer. */ -"%d weeks ago" = "%d wythnos yn ôl"; - -/* No comment provided by engineer. */ -"%d years ago" = "%d mlynydd yn ôl"; - -/* No comment provided by engineer. */ -"A minute ago" = "Un munud yn ôl"; - -/* No comment provided by engineer. */ -"An hour ago" = "Un awr yn ôl"; - -/* No comment provided by engineer. */ -"Just now" = "Nawr"; - -/* No comment provided by engineer. */ -"Last month" = "Mis diwethaf"; - -/* No comment provided by engineer. */ -"Last week" = "Wythnos diwethaf"; - -/* No comment provided by engineer. */ -"Last year" = "Llynedd"; - -/* No comment provided by engineer. */ -"Yesterday" = "Ddoe"; - -/* No comment provided by engineer. */ -"1 year ago" = "1 flynydd yn ôl"; - -/* No comment provided by engineer. */ -"1 month ago" = "1 mis yn ôl"; - -/* No comment provided by engineer. */ -"1 week ago" = "1 wythnos yn ôl"; - -/* No comment provided by engineer. */ -"1 day ago" = "1 diwrnod yn ôl"; - -/* No comment provided by engineer. */ -"This morning" = "Y bore ma"; - -/* No comment provided by engineer. */ -"This afternoon" = "Y penwythnos hon"; - -/* No comment provided by engineer. */ -"Today" = "Heddiw"; - -/* No comment provided by engineer. */ -"This week" = "Yr wythnos hon"; - -/* No comment provided by engineer. */ -"This month" = "Y mis hon"; - -/* No comment provided by engineer. */ -"This year" = "Eleni"; diff --git a/DateToolsSwift/DateTools/DateTools.bundle/da.lproj/DateTools.strings b/DateToolsSwift/DateTools/DateTools.bundle/da.lproj/DateTools.strings deleted file mode 100644 index d75138ed..00000000 --- a/DateToolsSwift/DateTools/DateTools.bundle/da.lproj/DateTools.strings +++ /dev/null @@ -1,71 +0,0 @@ -/* No comment provided by engineer. */ - "%d days ago" = "%d dage siden"; - - /* No comment provided by engineer. */ - "%d hours ago" = "%d timer siden"; - - /* No comment provided by engineer. */ - "%d minutes ago" = "%d minutter siden"; - - /* No comment provided by engineer. */ - "%d months ago" = "%d måneder siden"; - - /* No comment provided by engineer. */ - "%d seconds ago" = "%d sekunder siden"; - - /* No comment provided by engineer. */ - "%d weeks ago" = "%d uger siden"; - - /* No comment provided by engineer. */ - "%d years ago" = "%d år siden"; - - /* No comment provided by engineer. */ - "A minute ago" = "Et minut siden"; - - /* No comment provided by engineer. */ - "An hour ago" = "En time siden"; - -/* No comment provided by engineer. */ -"Just now" = "Lige nu"; - -/* No comment provided by engineer. */ -"Last month" = "Sidste måned"; - -/* No comment provided by engineer. */ -"Last week" = "Sidste uge"; - -/* No comment provided by engineer. */ -"Last year" = "Sidste år"; - -/* No comment provided by engineer. */ -"Yesterday" = "I går"; - -/* No comment provided by engineer. */ -"1 year ago" = "1 år siden"; - -/* No comment provided by engineer. */ -"1 month ago" = "1 måned siden"; - -/* No comment provided by engineer. */ -"1 week ago" = "1 uge siden"; - -/* No comment provided by engineer. */ -"1 day ago" = "1 dag siden"; - -/* No comment provided by engineer. */ -"This morning" = "Her til morgen"; - -/* No comment provided by engineer. */ -"This afternoon" = "Her til eftermiddag"; - -/* No comment provided by engineer. */ -"Today" = "I dag"; - -/* No comment provided by engineer. */ -"This week" = "Denne uge"; - -/* No comment provided by engineer. */ -"This month" = "Denne måned"; - -/* No comment provided by engineer. */ -"This year" = "Dette år"; \ No newline at end of file diff --git a/DateToolsSwift/DateTools/DateTools.bundle/de.lproj/DateTools.strings b/DateToolsSwift/DateTools/DateTools.bundle/de.lproj/DateTools.strings deleted file mode 100644 index f742b3fb..00000000 --- a/DateToolsSwift/DateTools/DateTools.bundle/de.lproj/DateTools.strings +++ /dev/null @@ -1,80 +0,0 @@ -/* No comment provided by engineer. */ - "%d days ago" = "Vor %d Tagen"; - - /* No comment provided by engineer. */ - "%d hours ago" = "Vor %d Stunden"; - - /* No comment provided by engineer. */ - "%d minutes ago" = "Vor %d Minuten"; - - /* No comment provided by engineer. */ - "%d months ago" = "Vor %d Monaten"; - - /* No comment provided by engineer. */ - "%d seconds ago" = "Vor %d Sekunden"; - - /* No comment provided by engineer. */ - "%d weeks ago" = "Vor %d Wochen"; - - /* No comment provided by engineer. */ - "%d years ago" = "Vor %d Jahren"; - - /* No comment provided by engineer. */ - "A minute ago" = "Vor einer Minute"; - - /* No comment provided by engineer. */ - "An hour ago" = "Vor einer Stunde"; - -/* No comment provided by engineer. */ -"Just now" = "Gerade eben"; - -/* No comment provided by engineer. */ -"Last month" = "Letzten Monat"; - -/* No comment provided by engineer. */ -"Last week" = "Letzte Woche"; - -/* No comment provided by engineer. */ -"Last year" = "Letztes Jahr"; - -/* No comment provided by engineer. */ -"Yesterday" = "Gestern"; - -/* No comment provided by engineer. */ -"1 year ago" = "Vor 1 Jahr"; - -/* No comment provided by engineer. */ -"1 month ago" = "Vor 1 Monat"; - -/* No comment provided by engineer. */ -"1 week ago" = "Vor 1 Woche"; - -/* No comment provided by engineer. */ -"1 day ago" = "Vor 1 Tag"; - -/* No comment provided by engineer. */ -"This morning" = "Heute Morgen"; - -/* No comment provided by engineer. */ -"This afternoon" = "Heute Nachmittag"; - -/* No comment provided by engineer. */ -"Today" = "Heute"; - -/* No comment provided by engineer. */ -"This week" = "Diese Woche"; - -/* No comment provided by engineer. */ -"This month" = "Diesen Monat"; - -/* No comment provided by engineer. */ -"This year" = "Dieses Jahr"; - -/* Short format for */ -"%dy" = "%dJ"; // year -"%dM" = "%dM"; // month -"%dw" = "%dW"; // week -"%dd" = "%dT"; // day -"%dh" = "%dh"; // hour -"%dm" = "%dm"; // minute -"%ds" = "%ds"; // second diff --git a/DateToolsSwift/DateTools/DateTools.bundle/en.lproj/DateTools.strings b/DateToolsSwift/DateTools/DateTools.bundle/en.lproj/DateTools.strings deleted file mode 100644 index dc4cfa90..00000000 --- a/DateToolsSwift/DateTools/DateTools.bundle/en.lproj/DateTools.strings +++ /dev/null @@ -1,106 +0,0 @@ -/* No comment provided by engineer. */ -"%d days ago" = "%d days ago"; - -/* No comment provided by engineer. */ -"%d hours ago" = "%d hours ago"; - -/* No comment provided by engineer. */ -"%d minutes ago" = "%d minutes ago"; - -/* No comment provided by engineer. */ -"%d months ago" = "%d months ago"; - -/* No comment provided by engineer. */ -"%d seconds ago" = "%d seconds ago"; - -/* No comment provided by engineer. */ -"%d weeks ago" = "%d weeks ago"; - -/* No comment provided by engineer. */ -"%d years ago" = "%d years ago"; - -/* No comment provided by engineer. */ -"A minute ago" = "A minute ago"; - -/* No comment provided by engineer. */ -"An hour ago" = "An hour ago"; - -/* No comment provided by engineer. */ -"Just now" = "Just now"; - -/* No comment provided by engineer. */ -"Last month" = "Last month"; - -/* No comment provided by engineer. */ -"Last week" = "Last week"; - -/* No comment provided by engineer. */ -"Last year" = "Last year"; - -/* No comment provided by engineer. */ -"Yesterday" = "Yesterday"; - -/* No comment provided by engineer. */ -"1 year ago" = "1 year ago"; - -/* No comment provided by engineer. */ -"1 month ago" = "1 month ago"; - -/* No comment provided by engineer. */ -"1 week ago" = "1 week ago"; - -/* No comment provided by engineer. */ -"1 day ago" = "1 day ago"; - -/* No comment provided by engineer. */ -"1 hour ago" = "1 hour ago"; - -/* No comment provided by engineer. */ -"1 minute ago" = "1 minute ago"; - -/* No comment provided by engineer. */ -"1 second ago" = "1 second ago"; - -/* No comment provided by engineer. */ -"This morning" = "This morning"; - -/* No comment provided by engineer. */ -"This afternoon" = "This afternoon"; - -/* No comment provided by engineer. */ -"Today" = "Today"; - -/* No comment provided by engineer. */ -"This week" = "This week"; - -/* No comment provided by engineer. */ -"This month" = "This month"; - -/* No comment provided by engineer. */ -"This year" = "This year"; - -/* Short format for */ -"%dy" = "%dy"; // year -"%dM" = "%dM"; // month -"%dw" = "%dw"; // week -"%dd" = "%dd"; // day -"%dh" = "%dh"; // hour -"%dm" = "%dm"; // minute -"%ds" = "%ds"; // second - -/* Week format for */ -"Mon" = "Mon"; -"Tue" = "Tue"; -"Wed" = "Wed"; -"Thu" = "Thu"; -"Fri" = "Fri"; -"Sat" = "Sat"; -"Sun" = "Sun"; - -"周一" = "星期一"; -"周二" = "星期二"; -"周三" = "星期三"; -"周四" = "星期四"; -"周五" = "星期五"; -"周六" = "星期六"; -"周日" = "星期日"; \ No newline at end of file diff --git a/DateToolsSwift/DateTools/DateTools.bundle/es.lproj/DateTools.strings b/DateToolsSwift/DateTools/DateTools.bundle/es.lproj/DateTools.strings deleted file mode 100644 index 2aeffc05..00000000 --- a/DateToolsSwift/DateTools/DateTools.bundle/es.lproj/DateTools.strings +++ /dev/null @@ -1,83 +0,0 @@ -/* No comment provided by engineer. */ -"%d days ago" = "Hace %d días"; - -/* No comment provided by engineer. */ -"%d hours ago" = "Hace %d horas"; - -/* No comment provided by engineer. */ -"%d minutes ago" = "Hace %d minutos"; - -/* No comment provided by engineer. */ -"%d months ago" = "Hace %d meses"; - -/* No comment provided by engineer. */ -"%d seconds ago" = "Hace %d segundos"; - -/* No comment provided by engineer. */ -"%d weeks ago" = "Hace %d semanas"; - -/* No comment provided by engineer. */ -"%d years ago" = "Hace %d años"; - -/* No comment provided by engineer. */ -"A minute ago" = "Hace un minuto"; - -/* No comment provided by engineer. */ -"An hour ago" = "Hace una hora"; - -/* No comment provided by engineer. */ -"Just now" = "Ahora mismo"; - -/* No comment provided by engineer. */ -"Last month" = "El mes pasado"; - -/* No comment provided by engineer. */ -"Last week" = "La semana pasada"; - -/* No comment provided by engineer. */ -"Last year" = "El año pasado"; - -/* No comment provided by engineer. */ -"Yesterday" = "Ayer"; - -/* No comment provided by engineer. */ -"1 year ago" = "Hace un año"; - -/* No comment provided by engineer. */ -"1 month ago" = "Hace un mes"; - -/* No comment provided by engineer. */ -"1 week ago" = "Hace una semana"; - -/* No comment provided by engineer. */ -"1 day ago" = "Hace un día"; - -/* No comment provided by engineer. */ -"1 hour ago" = "Hace 1 hora"; - -/* No comment provided by engineer. */ -"This morning" = "Esta mañana"; - -/* No comment provided by engineer. */ -"This afternoon" = "Esta tarde"; - -/* No comment provided by engineer. */ -"Today" = "Hoy"; - -/* No comment provided by engineer. */ -"This week" = "Esta semana"; - -/* No comment provided by engineer. */ -"This month" = "Este mes"; - -/* No comment provided by engineer. */ -"This year" = "Este año"; - -/* Short format for */ -"%dy" = "%da"; // year -"%dM" = "%dM"; // month -"%dw" = "%dS"; // week -"%dd" = "%dd"; // day -"%dh" = "%dh"; // hour -"%dm" = "%dm"; // minute -"%ds" = "%ds"; // second diff --git a/DateToolsSwift/DateTools/DateTools.bundle/eu.lproj/DateTools.strings b/DateToolsSwift/DateTools/DateTools.bundle/eu.lproj/DateTools.strings deleted file mode 100644 index bdf22748..00000000 --- a/DateToolsSwift/DateTools/DateTools.bundle/eu.lproj/DateTools.strings +++ /dev/null @@ -1,71 +0,0 @@ -/* No comment provided by engineer. */ -"%d days ago" = "Orain dela %d egun"; - -/* No comment provided by engineer. */ -"%d hours ago" = "Orain dela %d ordu"; - -/* No comment provided by engineer. */ -"%d minutes ago" = "Orain dela %d minutu"; - -/* No comment provided by engineer. */ -"%d months ago" = "Orain dela %d hile"; - -/* No comment provided by engineer. */ -"%d seconds ago" = "Orain dela %d segundu"; - -/* No comment provided by engineer. */ -"%d weeks ago" = "Orain dela %d aste"; - -/* No comment provided by engineer. */ -"%d years ago" = "Orain dela %d urte"; - -/* No comment provided by engineer. */ -"A minute ago" = "Orain dela minutu bat"; - -/* No comment provided by engineer. */ -"An hour ago" = "Orain dela ordu bat"; - -/* No comment provided by engineer. */ -"Just now" = "Oraintxe bertan"; - -/* No comment provided by engineer. */ -"Last month" = "Pasa den hilean"; - -/* No comment provided by engineer. */ -"Last week" = "Pasa den astean"; - -/* No comment provided by engineer. */ -"Last year" = "Pasa den urtean"; - -/* No comment provided by engineer. */ -"Yesterday" = "Atzo"; - -/* No comment provided by engineer. */ -"1 year ago" = "Orain dela urte bat"; - -/* No comment provided by engineer. */ -"1 month ago" = "Orain dela hile bat"; - -/* No comment provided by engineer. */ -"1 week ago" = "Orain dela aste bat"; - -/* No comment provided by engineer. */ -"1 day ago" = "Orain dela egun bat"; - -/* No comment provided by engineer. */ -"This morning" = "Gaur goizean"; - -/* No comment provided by engineer. */ -"This afternoon" = "Gaur arratsaldean"; - -/* No comment provided by engineer. */ -"Today" = "Gaur"; - -/* No comment provided by engineer. */ -"This week" = "Aste honetan"; - -/* No comment provided by engineer. */ -"This month" = "Hile honetan"; - -/* No comment provided by engineer. */ -"This year" = "Urte honetan"; diff --git a/DateToolsSwift/DateTools/DateTools.bundle/fi.lproj/DateTools.strings b/DateToolsSwift/DateTools/DateTools.bundle/fi.lproj/DateTools.strings deleted file mode 100644 index 91072c30..00000000 --- a/DateToolsSwift/DateTools/DateTools.bundle/fi.lproj/DateTools.strings +++ /dev/null @@ -1,71 +0,0 @@ -/* No comment provided by engineer. */ -"%d days ago" = "%d päivää sitten"; - -/* No comment provided by engineer. */ -"%d hours ago" = "%d tuntia sitten"; - -/* No comment provided by engineer. */ -"%d minutes ago" = "%d minuuttia sitten"; - -/* No comment provided by engineer. */ -"%d months ago" = "%d kuukautta sitten"; - -/* No comment provided by engineer. */ -"%d seconds ago" = "%d sekuntia sitten"; - -/* No comment provided by engineer. */ -"%d weeks ago" = "%d viikkoa sitten"; - -/* No comment provided by engineer. */ -"%d years ago" = "%d vuotta sitten"; - -/* No comment provided by engineer. */ -"A minute ago" = "Minuutti sitten"; - -/* No comment provided by engineer. */ -"An hour ago" = "Tunti sitten"; - -/* No comment provided by engineer. */ -"Just now" = "Juuri äsken"; - -/* No comment provided by engineer. */ -"Last month" = "Viime kuussa"; - -/* No comment provided by engineer. */ -"Last week" = "Viime viikolla"; - -/* No comment provided by engineer. */ -"Last year" = "Viime vuonna"; - -/* No comment provided by engineer. */ -"Yesterday" = "Eilen"; - -/* No comment provided by engineer. */ -"1 year ago" = "Vuosi sitten"; - -/* No comment provided by engineer. */ -"1 month ago" = "Kuukausi sitten"; - -/* No comment provided by engineer. */ -"1 week ago" = "Viikko sitten"; - -/* No comment provided by engineer. */ -"1 day ago" = "Vuorokausi sitten"; - -/* No comment provided by engineer. */ -"This morning" = "Tänä aamuna"; - -/* No comment provided by engineer. */ -"This afternoon" = "Tänä iltapäivänä"; - -/* No comment provided by engineer. */ -"Today" = "Tänään"; - -/* No comment provided by engineer. */ -"This week" = "Tällä viikolla"; - -/* No comment provided by engineer. */ -"This month" = "Tässä kuussa"; - -/* No comment provided by engineer. */ -"This year" = "Tänä vuonna"; diff --git a/DateToolsSwift/DateTools/DateTools.bundle/fr.lproj/DateTools.strings b/DateToolsSwift/DateTools/DateTools.bundle/fr.lproj/DateTools.strings deleted file mode 100644 index 861d00aa..00000000 --- a/DateToolsSwift/DateTools/DateTools.bundle/fr.lproj/DateTools.strings +++ /dev/null @@ -1,80 +0,0 @@ -/* No comment provided by engineer. */ -"%d days ago" = "Il y a %d jours"; - -/* No comment provided by engineer. */ -"%d hours ago" = "Il y a %d heures"; - -/* No comment provided by engineer. */ -"%d minutes ago" = "Il y a %d minutes"; - -/* No comment provided by engineer. */ -"%d months ago" = "Il y a %d mois"; - -/* No comment provided by engineer. */ -"%d seconds ago" = "Il y a %d secondes"; - -/* No comment provided by engineer. */ -"%d weeks ago" = "Il y a %d semaines"; - -/* No comment provided by engineer. */ -"%d years ago" = "Il y a %d ans"; - -/* No comment provided by engineer. */ -"A minute ago" = "Il y a une minute"; - -/* No comment provided by engineer. */ -"An hour ago" = "Il y a une heure"; - -/* No comment provided by engineer. */ -"Just now" = "A l'instant"; - -/* No comment provided by engineer. */ -"Last month" = "Le mois dernier"; - -/* No comment provided by engineer. */ -"Last week" = "La semaine dernière"; - -/* No comment provided by engineer. */ -"Last year" = "L'année dernière"; - -/* No comment provided by engineer. */ -"Yesterday" = "Hier"; - -/* No comment provided by engineer. */ -"1 year ago" = "Il y a 1 an"; - -/* No comment provided by engineer. */ -"1 month ago" = "Il y a 1 mois"; - -/* No comment provided by engineer. */ -"1 week ago" = "Il y a 1 semaine"; - -/* No comment provided by engineer. */ -"1 day ago" = "Il y a 1 jour"; - -/* No comment provided by engineer. */ -"1 hour ago" = "Il y a 1 heure"; - -/* No comment provided by engineer. */ -"1 minute ago" = "Il y a 1 minute"; - -/* No comment provided by engineer. */ -"1 second ago" = "Il y a 1 seconde"; - -/* No comment provided by engineer. */ -"This morning" = "Ce matin"; - -/* No comment provided by engineer. */ -"This afternoon" = "Cet après-midi"; - -/* No comment provided by engineer. */ -"Today" = "Aujourd'hui"; - -/* No comment provided by engineer. */ -"This week" = "Cette semaine"; - -/* No comment provided by engineer. */ -"This month" = "Ce mois-ci"; - -/* No comment provided by engineer. */ -"This year" = "Cette année"; diff --git a/DateToolsSwift/DateTools/DateTools.bundle/gre.lproj/DateTools.strings b/DateToolsSwift/DateTools/DateTools.bundle/gre.lproj/DateTools.strings deleted file mode 100644 index 994e9f726640963cada0c58cf2292251c461a4e4..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 3494 zcmchZPfJ2k5XA>(*Qa<0ZCWI)qlMduR&H8ano9T#&BTw(sTsf5ZYF+-@h_c z5{LS5Sd<=iz%+(hUG#FwR=c*cc2zSIN0A7-e9IjkVged?)mN|vwp7Fkm>AU_F{^rt zC6EZ=8JL$AO?a%0)UbV=s`W7ehk5XRkQVcp27F_fBrWt*+D2-XO&Ave%T5pt3)^-#_OG--AJK58l8`+5bInrevMXo}ro+ z@+;2Ai+Hr%D>T-(i&&QBR$&TUvWUo@;PfUZi8Rie9aVZ(LO#pcGaK^nCC(s{Hj=}V zg_1dvMQ=!Gt$A`(DLOP~I3X+I;V&R-;}kbVM#}kQpty4+!7@APVWsqyv95MWb7szD kEz_kSmzU*e*Dp8uvs}|(_h`?&qp_*zSgw)8;$fS{-$$@|mjD0& diff --git a/DateToolsSwift/DateTools/DateTools.bundle/gu.lproj/DateTools.strings b/DateToolsSwift/DateTools/DateTools.bundle/gu.lproj/DateTools.strings deleted file mode 100644 index af064753..00000000 --- a/DateToolsSwift/DateTools/DateTools.bundle/gu.lproj/DateTools.strings +++ /dev/null @@ -1,89 +0,0 @@ -/* No comment provided by engineer. */ -"%d days ago" = "%d દિવસ પહેલા"; - -/* No comment provided by engineer. */ -"%d hours ago" = "%d કલાક પહેલા"; - -/* No comment provided by engineer. */ -"%d minutes ago" = "%d મિનિટ પહેલા"; - -/* No comment provided by engineer. */ -"%d months ago" = "%d મહિના પહેલા"; - -/* No comment provided by engineer. */ -"%d seconds ago" = "%d સેકન્ડ પહેલા"; - -/* No comment provided by engineer. */ -"%d weeks ago" = "%d અઠવાડિયા પહેલા"; - -/* No comment provided by engineer. */ -"%d years ago" = "%d વર્ષ પહેલા"; - -/* No comment provided by engineer. */ -"A minute ago" = "એક મિનિટ પહેલા"; - -/* No comment provided by engineer. */ -"An hour ago" = "એક કલાક પહેલા"; - -/* No comment provided by engineer. */ -"Just now" = "હમણાં"; - -/* No comment provided by engineer. */ -"Last month" = "ગયા મહિને"; - -/* No comment provided by engineer. */ -"Last week" = "ગયા અઠવાડિયે"; - -/* No comment provided by engineer. */ -"Last year" = "ગયા વર્ષે"; - -/* No comment provided by engineer. */ -"Yesterday" = "ગઈ કાલે"; - -/* No comment provided by engineer. */ -"1 year ago" = "1 વર્ષ પહેલાં"; - -/* No comment provided by engineer. */ -"1 month ago" = "1 મહિનો પહેલા"; - -/* No comment provided by engineer. */ -"1 week ago" = "1 અઠવાડિયું પહેલા"; - -/* No comment provided by engineer. */ -"1 day ago" = "1 દિવસ પહેલાં"; - -/* No comment provided by engineer. */ -"1 hour ago" = "1 કલાક પહેલા"; - -/* No comment provided by engineer. */ -"1 minute ago" = "1 મિનિટ પહેલા"; - -/* No comment provided by engineer. */ -"1 second ago" = "1 સેકન્ડ પહેલા"; - -/* No comment provided by engineer. */ -"This morning" = "આ સવારે"; - -/* No comment provided by engineer. */ -"This afternoon" = "આજે બપોરે"; - -/* No comment provided by engineer. */ -"Today" = "આજે"; - -/* No comment provided by engineer. */ -"This week" = "આ અઠવાડિયેું"; - -/* No comment provided by engineer. */ -"This month" = "આ મહિને"; - -/* No comment provided by engineer. */ -"This year" = "આ વર્ષે"; - -/* Short format for */ -"%dy" = "%dy"; // year -"%dM" = "%dM"; // month -"%dw" = "%dw"; // week -"%dd" = "%dd"; // day -"%dh" = "%dh"; // hour -"%dm" = "%dm"; // minute -"%ds" = "%ds"; // second diff --git a/DateToolsSwift/DateTools/DateTools.bundle/he.lproj/DateTools.strings b/DateToolsSwift/DateTools/DateTools.bundle/he.lproj/DateTools.strings deleted file mode 100755 index 65e536c2..00000000 --- a/DateToolsSwift/DateTools/DateTools.bundle/he.lproj/DateTools.strings +++ /dev/null @@ -1,71 +0,0 @@ -/* No comment provided by engineer. */ -"%d days ago" = "לפני %d ימים"; - -/* No comment provided by engineer. */ -"%d hours ago" = "לפני %d שעות"; - -/* No comment provided by engineer. */ -"%d minutes ago" = "לפני %d דקות"; - -/* No comment provided by engineer. */ -"%d months ago" = "לפני %d חודשים"; - -/* No comment provided by engineer. */ -"%d seconds ago" = "לפני %d שניות"; - -/* No comment provided by engineer. */ -"%d weeks ago" = "לפני %d שבועות"; - -/* No comment provided by engineer. */ -"%d years ago" = "לפני %d שנים"; - -/* No comment provided by engineer. */ -"A minute ago" = "לפני דקה"; - -/* No comment provided by engineer. */ -"An hour ago" = "לפני שעה"; - -/* No comment provided by engineer. */ -"Just now" = "ממש עכשיו"; - -/* No comment provided by engineer. */ -"Last month" = "בחודש שעבר"; - -/* No comment provided by engineer. */ -"Last week" = "בשבוע שעבר"; - -/* No comment provided by engineer. */ -"Last year" = "בשנה שעברה"; - -/* No comment provided by engineer. */ -"Yesterday" = "אתמול"; - -/* No comment provided by engineer. */ -"1 year ago" = "לפני שנה"; - -/* No comment provided by engineer. */ -"1 month ago" = "לפני חודש"; - -/* No comment provided by engineer. */ -"1 week ago" = "לפני שבוע"; - -/* No comment provided by engineer. */ -"1 day ago" = "לפני יום"; - -/* No comment provided by engineer. */ -"This morning" = "הבוקר"; - -/* No comment provided by engineer. */ -"This afternoon" = "בצהריים"; - -/* No comment provided by engineer. */ -"Today" = "היום"; - -/* No comment provided by engineer. */ -"This week" = "השבוע"; - -/* No comment provided by engineer. */ -"This month" = "החודש"; - -/* No comment provided by engineer. */ -"This year" = "השנה"; diff --git a/DateToolsSwift/DateTools/DateTools.bundle/hi.lproj/DateTools.strings b/DateToolsSwift/DateTools/DateTools.bundle/hi.lproj/DateTools.strings deleted file mode 100644 index 20d63c64..00000000 --- a/DateToolsSwift/DateTools/DateTools.bundle/hi.lproj/DateTools.strings +++ /dev/null @@ -1,89 +0,0 @@ -/* No comment provided by engineer. */ -"%d days ago" = "%d दिन पहले"; - -/* No comment provided by engineer. */ -"%d hours ago" = "%d घंटे पहले"; - -/* No comment provided by engineer. */ -"%d minutes ago" = "%d मिनट पहले"; - -/* No comment provided by engineer. */ -"%d months ago" = "%d महीन पहले"; - -/* No comment provided by engineer. */ -"%d seconds ago" = "%d सेकंड पहले"; - -/* No comment provided by engineer. */ -"%d weeks ago" = "%d हफ्ते पहले"; - -/* No comment provided by engineer. */ -"%d years ago" = "%d साल पहले"; - -/* No comment provided by engineer. */ -"A minute ago" = "एक मिनट पहले"; - -/* No comment provided by engineer. */ -"An hour ago" = "एक घंटे पहले"; - -/* No comment provided by engineer. */ -"Just now" = "बस अभी"; - -/* No comment provided by engineer. */ -"Last month" = "पिछले महीने"; - -/* No comment provided by engineer. */ -"Last week" = "पिछले हफ्ते"; - -/* No comment provided by engineer. */ -"Last year" = "पिछले साल"; - -/* No comment provided by engineer. */ -"Yesterday" = "कल"; - -/* No comment provided by engineer. */ -"1 year ago" = "1 साल पहले"; - -/* No comment provided by engineer. */ -"1 month ago" = "1 महीने पहले"; - -/* No comment provided by engineer. */ -"1 week ago" = "1 हफ्ते पहले"; - -/* No comment provided by engineer. */ -"1 day ago" = "1 दिन पहले"; - -/* No comment provided by engineer. */ -"1 hour ago" = "1 घंटे पहले"; - -/* No comment provided by engineer. */ -"1 minute ago" = "1 मिनट पहले"; - -/* No comment provided by engineer. */ -"1 second ago" = "1 सेकंड पहले"; - -/* No comment provided by engineer. */ -"This morning" = "आज सुबह"; - -/* No comment provided by engineer. */ -"This afternoon" = "यह दोपहर"; - -/* No comment provided by engineer. */ -"Today" = "आज"; - -/* No comment provided by engineer. */ -"This week" = "इस सप्ताह"; - -/* No comment provided by engineer. */ -"This month" = "इस महीने"; - -/* No comment provided by engineer. */ -"This year" = "इस साल"; - -/* Short format for */ -"%dy" = "%dy"; // year -"%dM" = "%dM"; // month -"%dw" = "%dw"; // week -"%dd" = "%dd"; // day -"%dh" = "%dh"; // hour -"%dm" = "%dm"; // minute -"%ds" = "%ds"; // second diff --git a/DateToolsSwift/DateTools/DateTools.bundle/hr.lproj/DateTools.strings b/DateToolsSwift/DateTools/DateTools.bundle/hr.lproj/DateTools.strings deleted file mode 100644 index 960cf740..00000000 --- a/DateToolsSwift/DateTools/DateTools.bundle/hr.lproj/DateTools.strings +++ /dev/null @@ -1,44 +0,0 @@ -/* No comment provided by engineer. */ -"%d days ago" = "%d dana"; - -/* No comment provided by engineer. */ -"%d hours ago" = "%d prime sati"; - -/* No comment provided by engineer. */ -"%d minutes ago" = "%d prije minuta"; - -/* No comment provided by engineer. */ -"%d months ago" = "%d prije nekoliko mjeseci"; - -/* No comment provided by engineer. */ -"%d seconds ago" = "%d sekunde prije"; - -/* No comment provided by engineer. */ -"%d weeks ago" = "%d prije nekoliko tjedana"; - -/* No comment provided by engineer. */ -"%d years ago" = "%d prije nekoliko godina"; - -/* No comment provided by engineer. */ -"A minute ago" = "prije minute"; - -/* No comment provided by engineer. */ -"An hour ago" = "prije sat vremena"; - -/* No comment provided by engineer. */ -"Just now" = "upravo sada"; - -/* No comment provided by engineer. */ -"Last month" = "prosli mjesec"; - -/* No comment provided by engineer. */ -"Last week" = "prosli tjedan"; - -/* No comment provided by engineer. */ -"Last year" = "prosle godine"; - -/* No comment provided by engineer. */ -"Yesterday" = "jucer"; - -/* No comment provided by engineer. */ -"1 year ago" = "Prije 1 godina"; diff --git a/DateToolsSwift/DateTools/DateTools.bundle/hu.lproj/DateTools.strings b/DateToolsSwift/DateTools/DateTools.bundle/hu.lproj/DateTools.strings deleted file mode 100644 index 98a5ad60..00000000 --- a/DateToolsSwift/DateTools/DateTools.bundle/hu.lproj/DateTools.strings +++ /dev/null @@ -1,71 +0,0 @@ -/* No comment provided by engineer. */ -"%d days ago" = "%d napja"; - -/* No comment provided by engineer. */ -"%d hours ago" = "%d órája"; - -/* No comment provided by engineer. */ -"%d minutes ago" = "%d perce"; - -/* No comment provided by engineer. */ -"%d months ago" = "%d hónapja"; - -/* No comment provided by engineer. */ -"%d seconds ago" = "%d másodperce"; - -/* No comment provided by engineer. */ -"%d weeks ago" = "%d hete"; - -/* No comment provided by engineer. */ -"%d years ago" = "%d éve"; - -/* No comment provided by engineer. */ -"A minute ago" = "Egy perccel ezelőtt"; - -/* No comment provided by engineer. */ -"An hour ago" = "Egy órával ezelőtt"; - -/* No comment provided by engineer. */ -"Just now" = "Az imént"; - -/* No comment provided by engineer. */ -"Last month" = "Az előző hónapban"; - -/* No comment provided by engineer. */ -"Last week" = "Az előző héten"; - -/* No comment provided by engineer. */ -"Last year" = "Tavaly"; - -/* No comment provided by engineer. */ -"Yesterday" = "Tegnap"; - -/* No comment provided by engineer. */ -"1 year ago" = "Tavaly"; - -/* No comment provided by engineer. */ -"1 month ago" = "Egy hónapja"; - -/* No comment provided by engineer. */ -"1 week ago" = "Egy hete"; - -/* No comment provided by engineer. */ -"1 day ago" = "Tegnap"; - -/* No comment provided by engineer. */ -"This morning" = "Ma reggel"; - -/* No comment provided by engineer. */ -"This afternoon" = "Ma délután"; - -/* No comment provided by engineer. */ -"Today" = "Ma"; - -/* No comment provided by engineer. */ -"This week" = "Ezen a héten"; - -/* No comment provided by engineer. */ -"This month" = "Ebben a hónapban"; - -/* No comment provided by engineer. */ -"This year" = "Idén"; diff --git a/DateToolsSwift/DateTools/DateTools.bundle/id.lproj/DateTools.strings b/DateToolsSwift/DateTools/DateTools.bundle/id.lproj/DateTools.strings deleted file mode 100644 index 0f18f83f..00000000 --- a/DateToolsSwift/DateTools/DateTools.bundle/id.lproj/DateTools.strings +++ /dev/null @@ -1,71 +0,0 @@ -/* No comment provided by engineer. */ -"%d days ago" = "%d hari yang lalu"; - -/* No comment provided by engineer. */ -"%d hours ago" = "%d jam yang lalu"; - -/* No comment provided by engineer. */ -"%d minutes ago" = "%d menit yang lalu"; - -/* No comment provided by engineer. */ -"%d months ago" = "%d bulan yang lalu"; - -/* No comment provided by engineer. */ -"%d seconds ago" = "%d detik yang lalu"; - -/* No comment provided by engineer. */ -"%d weeks ago" = "%d minggu yang lalu"; - -/* No comment provided by engineer. */ -"%d years ago" = "%d tahun yang lalu"; - -/* No comment provided by engineer. */ -"A minute ago" = "Semenit yang lalu"; - -/* No comment provided by engineer. */ -"An hour ago" = "Sejam yang lalu"; - -/* No comment provided by engineer. */ -"Just now" = "Sekarang"; - -/* No comment provided by engineer. */ -"Last month" = "Bulan lalu"; - -/* No comment provided by engineer. */ -"Last week" = "Minggu lalu"; - -/* No comment provided by engineer. */ -"Last year" = "Tahun lalu"; - -/* No comment provided by engineer. */ -"Yesterday" = "Kemarin"; - -/* No comment provided by engineer. */ -"1 year ago" = "1 tahun yang lalu"; - -/* No comment provided by engineer. */ -"1 month ago" = "1 bulan yang lalu"; - -/* No comment provided by engineer. */ -"1 week ago" = "1 minggu yang lalu"; - -/* No comment provided by engineer. */ -"1 day ago" = "1 hari yang lalu"; - -/* No comment provided by engineer. */ -"This morning" = "Pagi ini"; - -/* No comment provided by engineer. */ -"This afternoon" = "Sore ini"; - -/* No comment provided by engineer. */ -"Today" = "Hari ini"; - -/* No comment provided by engineer. */ -"This week" = "Minggu ini"; - -/* No comment provided by engineer. */ -"This month" = "Bulan ini"; - -/* No comment provided by engineer. */ -"This year" = "Tahun ini"; diff --git a/DateToolsSwift/DateTools/DateTools.bundle/is.lproj/DateTools.strings b/DateToolsSwift/DateTools/DateTools.bundle/is.lproj/DateTools.strings deleted file mode 100644 index 242f0f45..00000000 --- a/DateToolsSwift/DateTools/DateTools.bundle/is.lproj/DateTools.strings +++ /dev/null @@ -1,71 +0,0 @@ -/* No comment provided by engineer. */ -"%d days ago" = "%d dögum síðan"; - -/* No comment provided by engineer. */ -"%d hours ago" = "%d klst. síðan"; - -/* No comment provided by engineer. */ -"%d minutes ago" = "%d mínútum síðan"; - -/* No comment provided by engineer. */ -"%d months ago" = "%d mánuðum síðan"; - -/* No comment provided by engineer. */ -"%d seconds ago" = "%d sekúndum síðan"; - -/* No comment provided by engineer. */ -"%d weeks ago" = "%d vikum síðan"; - -/* No comment provided by engineer. */ -"%d years ago" = "%d árum síðan"; - -/* No comment provided by engineer. */ -"A minute ago" = "Einni mínútu síðan"; - -/* No comment provided by engineer. */ -"An hour ago" = "Einni klst. síðan"; - -/* No comment provided by engineer. */ -"Just now" = "Rétt í þessu"; - -/* No comment provided by engineer. */ -"Last month" = "Í síðasta mánuði"; - -/* No comment provided by engineer. */ -"Last week" = "Í síðustu viku"; - -/* No comment provided by engineer. */ -"Last year" = "Á síðasta ári"; - -/* No comment provided by engineer. */ -"Yesterday" = "Í gær"; - -/* No comment provided by engineer. */ -"1 year ago" = "1 ári síðan"; - -/* No comment provided by engineer. */ -"1 month ago" = "1 mánuði síðan"; - -/* No comment provided by engineer. */ -"1 week ago" = "1 viku síðan"; - -/* No comment provided by engineer. */ -"1 day ago" = "1 degi síðan"; - -/* No comment provided by engineer. */ -"This morning" = "Í morgun"; - -/* No comment provided by engineer. */ -"This afternoon" = "Síðdegis"; - -/* No comment provided by engineer. */ -"Today" = "Í dag"; - -/* No comment provided by engineer. */ -"This week" = "Í þessari viku"; - -/* No comment provided by engineer. */ -"This month" = "Í þessum mánuði"; - -/* No comment provided by engineer. */ -"This year" = "Á þessu ári"; diff --git a/DateToolsSwift/DateTools/DateTools.bundle/it.lproj/DateTools.strings b/DateToolsSwift/DateTools/DateTools.bundle/it.lproj/DateTools.strings deleted file mode 100644 index c33d90b5..00000000 --- a/DateToolsSwift/DateTools/DateTools.bundle/it.lproj/DateTools.strings +++ /dev/null @@ -1,71 +0,0 @@ -/* No comment provided by engineer. */ -"%d days ago" = "%d giorni fa"; - -/* No comment provided by engineer. */ -"%d hours ago" = "%d ore fa"; - -/* No comment provided by engineer. */ -"%d minutes ago" = "%d minuti fa"; - -/* No comment provided by engineer. */ -"%d months ago" = "%d mesi fa"; - -/* No comment provided by engineer. */ -"%d seconds ago" = "%d secondi fa"; - -/* No comment provided by engineer. */ -"%d weeks ago" = "%d settimane fa"; - -/* No comment provided by engineer. */ -"%d years ago" = "%d anni fa"; - -/* No comment provided by engineer. */ -"A minute ago" = "Un minuto fa"; - -/* No comment provided by engineer. */ -"An hour ago" = "Un'ora fa"; - -/* No comment provided by engineer. */ -"Just now" = "Ora"; - -/* No comment provided by engineer. */ -"Last month" = "Il mese scorso"; - -/* No comment provided by engineer. */ -"Last week" = "La settimana scorsa"; - -/* No comment provided by engineer. */ -"Last year" = "L'anno scorso"; - -/* No comment provided by engineer. */ -"Yesterday" = "Ieri"; - -/* No comment provided by engineer. */ -"1 year ago" = "Un anno fa"; - -/* No comment provided by engineer. */ -"1 month ago" = "Un mese fa"; - -/* No comment provided by engineer. */ -"1 week ago" = "Una settimana fa"; - -/* No comment provided by engineer. */ -"1 day ago" = "Un giorno fa"; - -/* No comment provided by engineer. */ -"This morning" = "Questa mattina"; - -/* No comment provided by engineer. */ -"This afternoon" = "Questo pomeriggio"; - -/* No comment provided by engineer. */ -"Today" = "Oggi"; - -/* No comment provided by engineer. */ -"This week" = "Questa settimana"; - -/* No comment provided by engineer. */ -"This month" = "Questo mese"; - -/* No comment provided by engineer. */ -"This year" = "Quest'anno"; diff --git a/DateToolsSwift/DateTools/DateTools.bundle/ja.lproj/DateTools.strings b/DateToolsSwift/DateTools/DateTools.bundle/ja.lproj/DateTools.strings deleted file mode 100644 index ba2482f4..00000000 --- a/DateToolsSwift/DateTools/DateTools.bundle/ja.lproj/DateTools.strings +++ /dev/null @@ -1,90 +0,0 @@ -/* No comment provided by engineer. */ -"%d days ago" = "%d日前"; - -/* No comment provided by engineer. */ -"%d hours ago" = "%d時間前"; - -/* No comment provided by engineer. */ -"%d minutes ago" = "%d分前"; - -/* No comment provided by engineer. */ -"%d months ago" = "%dヶ月前"; - -/* No comment provided by engineer. */ -"%d seconds ago" = "%d秒前"; - -/* No comment provided by engineer. */ -"%d weeks ago" = "%d週間前"; - -/* No comment provided by engineer. */ -"%d years ago" = "%d年前"; - -/* No comment provided by engineer. */ -"A minute ago" = "1分前"; - -/* No comment provided by engineer. */ -"An hour ago" = "1時間前"; - -/* No comment provided by engineer. */ -"Just now" = "たった今"; - -/* No comment provided by engineer. */ -"Last month" = "先月"; - -/* No comment provided by engineer. */ -"Last week" = "先週"; - -/* No comment provided by engineer. */ -"Last year" = "去年"; - -/* No comment provided by engineer. */ -"Yesterday" = "昨日"; - -/* No comment provided by engineer. */ -"1 year ago" = "1年前"; - -/* No comment provided by engineer. */ -"1 month ago" = "1ヶ月前"; - -/* No comment provided by engineer. */ -"1 week ago" = "1週間前"; - -/* No comment provided by engineer. */ -"1 day ago" = "1日前"; - -/* No comment provided by engineer. */ -"1 hour ago" = "1時間前"; - -/* No comment provided by engineer. */ -"1 minute ago" = "1分前"; - -/* No comment provided by engineer. */ -"1 second ago" = "1秒前"; - -/* No comment provided by engineer. */ -"This morning" = "午前"; - -/* No comment provided by engineer. */ -"This afternoon" = "午後"; - -/* No comment provided by engineer. */ -"Today" = "今日"; - -/* No comment provided by engineer. */ -"This week" = "今週"; - -/* No comment provided by engineer. */ -"This month" = "今月"; - -/* No comment provided by engineer. */ -"This year" = "今年"; - -/* Short format for */ -"%dy" = "%d年"; // year -"%dM" = "%d月"; // month -"%dw" = "%d週"; // week -"%dd" = "%d日"; // day -"%dh" = "%d時間"; // hour -"%dm" = "%d分"; // minute -"%ds" = "%d秒"; // second - diff --git a/DateToolsSwift/DateTools/DateTools.bundle/ko.lproj/DateTools.strings b/DateToolsSwift/DateTools/DateTools.bundle/ko.lproj/DateTools.strings deleted file mode 100755 index 542c1a30..00000000 --- a/DateToolsSwift/DateTools/DateTools.bundle/ko.lproj/DateTools.strings +++ /dev/null @@ -1,71 +0,0 @@ -/* No comment provided by engineer. */ -"%d days ago" = "%d일 전"; - -/* No comment provided by engineer. */ -"%d hours ago" = "%d시간 전"; - -/* No comment provided by engineer. */ -"%d minutes ago" = "%d분 전"; - -/* No comment provided by engineer. */ -"%d months ago" = "%d개월 전"; - -/* No comment provided by engineer. */ -"%d seconds ago" = "%d초 전"; - -/* No comment provided by engineer. */ -"%d weeks ago" = "%d주 전"; - -/* No comment provided by engineer. */ -"%d years ago" = "%d년 전"; - -/* No comment provided by engineer. */ -"A minute ago" = "1분 전"; - -/* No comment provided by engineer. */ -"An hour ago" = "1시간 전"; - -/* No comment provided by engineer. */ -"Just now" = "방금 전"; - -/* No comment provided by engineer. */ -"Last month" = "지난 달"; - -/* No comment provided by engineer. */ -"Last week" = "지난 주"; - -/* No comment provided by engineer. */ -"Last year" = "지난 해"; - -/* No comment provided by engineer. */ -"Yesterday" = "어제"; - -/* No comment provided by engineer. */ -"1 year ago" = "1년 전"; - -/* No comment provided by engineer. */ -"1 month ago" = "1개월 전"; - -/* No comment provided by engineer. */ -"1 week ago" = "1주 전"; - -/* No comment provided by engineer. */ -"1 day ago" = "1일 전"; - -/* No comment provided by engineer. */ -"This morning" = "오늘 아침"; - -/* No comment provided by engineer. */ -"This afternoon" = "오늘 오후"; - -/* No comment provided by engineer. */ -"Today" = "오늘"; - -/* No comment provided by engineer. */ -"This week" = "이번 주"; - -/* No comment provided by engineer. */ -"This month" = "이번 달"; - -/* No comment provided by engineer. */ -"This year" = "올해"; diff --git a/DateToolsSwift/DateTools/DateTools.bundle/lv.lproj/DateTools.strings b/DateToolsSwift/DateTools/DateTools.bundle/lv.lproj/DateTools.strings deleted file mode 100644 index 57c3eb60..00000000 --- a/DateToolsSwift/DateTools/DateTools.bundle/lv.lproj/DateTools.strings +++ /dev/null @@ -1,24 +0,0 @@ -"1 year ago" = "Pirms gada"; -"1 month ago" = "Pirms mēneša"; -"1 week ago" = "Pirms nedēļas"; -"1 day ago" = "Pirms dienas"; -"A minute ago" = "Pirms minūtes"; -"An hour ago" = "Pirms stundas"; -"Last month" = "Pagājušajā mēnesī"; -"Last week" = "Pagājušajā nedēļā"; -"Last year" = "Pagājušajā gadā"; -"Just now" = "Tikko"; -"Today" = "Šodien"; -"Yesterday" = "Vakar"; -"This morning" = "Šorīt"; -"This afternoon" = "Pēcpusdienā"; -"This week" = "Šonedēļ"; -"This month" = "Šomēnes"; -"This year" = "Šogad"; -"%d seconds ago" = "Pirms %d sekundēm"; -"%d minutes ago" = "Pirms %d minūtēm"; -"%d hours ago" = "Pirms %d stundām"; -"%d days ago" = "Pirms %d dienām"; -"%d weeks ago" = "Pirms %d nedēļām"; -"%d months ago" = "Pirms %d mēnešiem"; -"%d years ago" = "Pirms %d gadiem"; diff --git a/DateToolsSwift/DateTools/DateTools.bundle/ms.lproj/DateTools.strings b/DateToolsSwift/DateTools/DateTools.bundle/ms.lproj/DateTools.strings deleted file mode 100644 index 8e713426..00000000 --- a/DateToolsSwift/DateTools/DateTools.bundle/ms.lproj/DateTools.strings +++ /dev/null @@ -1,89 +0,0 @@ -/* No comment provided by engineer. */ -"%d days ago" = "%d hari yang lepas"; - -/* No comment provided by engineer. */ -"%d hours ago" = "%d jam yang lepas"; - -/* No comment provided by engineer. */ -"%d minutes ago" = "%d minit yang lepas"; - -/* No comment provided by engineer. */ -"%d months ago" = "%d bulan yang lepas"; - -/* No comment provided by engineer. */ -"%d seconds ago" = "%d saat yang lepas"; - -/* No comment provided by engineer. */ -"%d weeks ago" = "%d minggu yang lepas"; - -/* No comment provided by engineer. */ -"%d years ago" = "%d tahun yang lepas"; - -/* No comment provided by engineer. */ -"A minute ago" = "Seminit yang lepas"; - -/* No comment provided by engineer. */ -"An hour ago" = "Sejam yang lepas"; - -/* No comment provided by engineer. */ -"Just now" = "Sebentar tadi"; - -/* No comment provided by engineer. */ -"Last month" = "Bulan lepas"; - -/* No comment provided by engineer. */ -"Last week" = "Minggu lepas"; - -/* No comment provided by engineer. */ -"Last year" = "Tahun lepas"; - -/* No comment provided by engineer. */ -"Yesterday" = "Semalam"; - -/* No comment provided by engineer. */ -"1 year ago" = "1 tahun lepas"; - -/* No comment provided by engineer. */ -"1 month ago" = "1 bulan lepas"; - -/* No comment provided by engineer. */ -"1 week ago" = "1 minggu lepas"; - -/* No comment provided by engineer. */ -"1 day ago" = "1 hari lepas"; - -/* No comment provided by engineer. */ -"1 hour ago" = "1 jam lepas"; - -/* No comment provided by engineer. */ -"1 minute ago" = "1 minit lepas"; - -/* No comment provided by engineer. */ -"1 second ago" = "1 saat lepas"; - -/* No comment provided by engineer. */ -"This morning" = "Pagi ini"; - -/* No comment provided by engineer. */ -"This afternoon" = "Petang ini"; - -/* No comment provided by engineer. */ -"Today" = "Hari ini"; - -/* No comment provided by engineer. */ -"This week" = "Minggu ini"; - -/* No comment provided by engineer. */ -"This month" = "Bulan ini"; - -/* No comment provided by engineer. */ -"This year" = "Tahun ini"; - -/* Short format for */ -"%dy" = "%dy"; // year -"%dM" = "%dM"; // month -"%dw" = "%dw"; // week -"%dd" = "%dd"; // day -"%dh" = "%dh"; // hour -"%dm" = "%dm"; // minute -"%ds" = "%ds"; // second diff --git a/DateToolsSwift/DateTools/DateTools.bundle/nb.lproj/DateTools.strings b/DateToolsSwift/DateTools/DateTools.bundle/nb.lproj/DateTools.strings deleted file mode 100644 index 5975a49c..00000000 --- a/DateToolsSwift/DateTools/DateTools.bundle/nb.lproj/DateTools.strings +++ /dev/null @@ -1,125 +0,0 @@ -/* - RULES: - Assume value for (seconds, hours, minutes, days, weeks, months or years) is XXXY, Y is last digit, XY is last two digits; - */ - -/* Y ==0 OR Y > 4 OR XY == 11; */ -"%d days ago" = "%d dager siden"; - -/* If Y != 1 AND Y < 5; */ -"%d _days ago" = "%d dager siden"; - -/* If Y == 1; */ -"%d __days ago" = "%d dag siden"; - - -/* Y ==0 OR Y > 4 OR XY == 11; */ -"%d hours ago" = "%d timer siden"; - -/* If Y != 1 AND Y < 5; */ -"%d _hours ago" = "%d timer siden"; - -/* If Y == 1; */ -"%d __hours ago" = "%d time siden"; - - -/* Y ==0 OR Y > 4 OR XY == 11; */ -"%d minutes ago" = "%d minutter siden"; - -/* If Y != 1 AND Y < 5; */ -"%d _minutes ago" = "%d minutter siden"; - -/* If Y == 1; */ -"%d __minutes ago" = "%d minutt siden"; - - -/* Y ==0 OR Y > 4 OR XY == 11; */ -"%d months ago" = "%d måneder siden"; - -/* If Y != 1 AND Y < 5; */ -"%d _months ago" = "%d måneder siden"; - -/* If Y == 1; */ -"%d __months ago" = "%d måned siden"; - - -/* Y ==0 OR Y > 4 OR XY == 11; */ -"%d seconds ago" = "%d sekunder siden"; - -/* If Y != 1 AND Y < 5; */ -"%d _seconds ago" = "%d sekunder siden"; - -/* If Y == 1; */ -"%d __seconds ago" = "%d sekund siden"; - - -/* Y ==0 OR Y > 4 OR XY == 11; */ -"%d weeks ago" = "%d uker siden"; - -/* If Y != 1 AND Y < 5; */ -"%d _weeks ago" = "%d uker siden"; - -/* If Y == 1; */ -"%d __weeks ago" = "%d uke siden"; - - -/* Y ==0 OR Y > 4 OR XY == 11; */ -"%d years ago" = "%d år siden"; - -/* If Y != 1 AND Y < 5; */ -"%d _years ago" = "%d år siden"; - -/* If Y == 1; */ -"%d __years ago" = "%d år siden"; - - -/* No comment provided by engineer. */ -"A minute ago" = "Et minutt siden"; - -/* No comment provided by engineer. */ -"An hour ago" = "En time siden"; - -/* No comment provided by engineer. */ -"Just now" = "Nå"; - -/* No comment provided by engineer. */ -"Last month" = "For en måned siden"; - -/* No comment provided by engineer. */ -"Last week" = "For en uke siden"; - -/* No comment provided by engineer. */ -"Last year" = "For et år siden"; - -/* No comment provided by engineer. */ -"Yesterday" = "I går"; - -/* No comment provided by engineer. */ -"1 year ago" = "1 år siden"; - -/* No comment provided by engineer. */ -"1 month ago" = "1 måned siden"; - -/* No comment provided by engineer. */ -"1 week ago" = "1 uke siden"; - -/* No comment provided by engineer. */ -"1 day ago" = "1 dag siden"; - -/* No comment provided by engineer. */ -"This morning" = "Denne morgenen"; - -/* No comment provided by engineer. */ -"This afternoon" = "I ettermiddag"; - -/* No comment provided by engineer. */ -"Today" = "I dag"; - -/* No comment provided by engineer. */ -"This week" = "Denne uken"; - -/* No comment provided by engineer. */ -"This month" = "Denne måneden"; - -/* No comment provided by engineer. */ -"This year" = "Dette året"; diff --git a/DateToolsSwift/DateTools/DateTools.bundle/nl.lproj/DateTools.strings b/DateToolsSwift/DateTools/DateTools.bundle/nl.lproj/DateTools.strings deleted file mode 100644 index 7e03c6cd..00000000 --- a/DateToolsSwift/DateTools/DateTools.bundle/nl.lproj/DateTools.strings +++ /dev/null @@ -1,71 +0,0 @@ -/* No comment provided by engineer. */ -"%d days ago" = "%d dagen geleden"; - -/* No comment provided by engineer. */ -"%d hours ago" = "%d uur geleden"; - -/* No comment provided by engineer. */ -"%d minutes ago" = "%d minuten geleden"; - -/* No comment provided by engineer. */ -"%d months ago" = "%d maanden geleden"; - -/* No comment provided by engineer. */ -"%d seconds ago" = "%d seconden geleden"; - -/* No comment provided by engineer. */ -"%d weeks ago" = "%d weken geleden"; - -/* No comment provided by engineer. */ -"%d years ago" = "%d jaar geleden"; - -/* No comment provided by engineer. */ -"A minute ago" = "Een minuut geleden"; - -/* No comment provided by engineer. */ -"An hour ago" = "Een uur geleden"; - -/* No comment provided by engineer. */ -"Just now" = "Zojuist"; - -/* No comment provided by engineer. */ -"Last month" = "Vorige maand"; - -/* No comment provided by engineer. */ -"Last week" = "Vorige week"; - -/* No comment provided by engineer. */ -"Last year" = "Vorig jaar"; - -/* No comment provided by engineer. */ -"Yesterday" = "Gisteren"; - -/* No comment provided by engineer. */ -"1 year ago" = "1 jaar geleden"; - -/* No comment provided by engineer. */ -"1 month ago" = "1 maand geleden"; - -/* No comment provided by engineer. */ -"1 week ago" = "1 week geleden"; - -/* No comment provided by engineer. */ -"1 day ago" = "1 dag geleden"; - -/* No comment provided by engineer. */ -"This morning" = "Vanmorgen"; - -/* No comment provided by engineer. */ -"This afternoon" = "Vanmiddag"; - -/* No comment provided by engineer. */ -"Today" = "Vandaag"; - -/* No comment provided by engineer. */ -"This week" = "Deze week"; - -/* No comment provided by engineer. */ -"This month" = "Deze maand"; - -/* No comment provided by engineer. */ -"This year" = "Dit jaar"; diff --git a/DateToolsSwift/DateTools/DateTools.bundle/pl.lproj/DateTools.strings b/DateToolsSwift/DateTools/DateTools.bundle/pl.lproj/DateTools.strings deleted file mode 100644 index 98bafb8f..00000000 --- a/DateToolsSwift/DateTools/DateTools.bundle/pl.lproj/DateTools.strings +++ /dev/null @@ -1,71 +0,0 @@ -/* No comment provided by engineer. */ -"%d days ago" = "%d dni temu"; - -/* No comment provided by engineer. */ -"%d hours ago" = "%d godzin(y) temu"; - -/* No comment provided by engineer. */ -"%d minutes ago" = "%d minut(y) temu"; - -/* No comment provided by engineer. */ -"%d months ago" = "%d miesiące/-y temu"; - -/* No comment provided by engineer. */ -"%d seconds ago" = "%d sekund(y) temu"; - -/* No comment provided by engineer. */ -"%d weeks ago" = "%d tygodni(e) temu"; - -/* No comment provided by engineer. */ -"%d years ago" = "%d lat(a) temu"; - -/* No comment provided by engineer. */ -"A minute ago" = "Minutę temu"; - -/* No comment provided by engineer. */ -"An hour ago" = "Godzinę temu"; - -/* No comment provided by engineer. */ -"Just now" = "W tej chwili"; - -/* No comment provided by engineer. */ -"Last month" = "W zeszłym miesiącu"; - -/* No comment provided by engineer. */ -"Last week" = "W zeszłym tygodniu"; - -/* No comment provided by engineer. */ -"Last year" = "W zeszłym roku"; - -/* No comment provided by engineer. */ -"Yesterday" = "Wczoraj"; - -/* No comment provided by engineer. */ -"1 year ago" = "1 rok temu"; - -/* No comment provided by engineer. */ -"1 month ago" = "1 miesiąc temu"; - -/* No comment provided by engineer. */ -"1 week ago" = "1 tydzień temu"; - -/* No comment provided by engineer. */ -"1 day ago" = "1 dzień temu"; - -/* No comment provided by engineer. */ -"This morning" = "Dziś rano"; - -/* No comment provided by engineer. */ -"This afternoon" = "Dziś po południu"; - -/* No comment provided by engineer. */ -"Today" = "Dzisiaj"; - -/* No comment provided by engineer. */ -"This week" = "W tym tygodniu"; - -/* No comment provided by engineer. */ -"This month" = "W tym miesiącu"; - -/* No comment provided by engineer. */ -"This year" = "W tym roku"; diff --git a/DateToolsSwift/DateTools/DateTools.bundle/pt-PT.lproj/DateTools.strings b/DateToolsSwift/DateTools/DateTools.bundle/pt-PT.lproj/DateTools.strings deleted file mode 100644 index b675478d..00000000 --- a/DateToolsSwift/DateTools/DateTools.bundle/pt-PT.lproj/DateTools.strings +++ /dev/null @@ -1,71 +0,0 @@ -/* No comment provided by engineer. */ -"%d days ago" = "%d dias atrás"; - -/* No comment provided by engineer. */ -"%d hours ago" = "%d horas atrás"; - -/* No comment provided by engineer. */ -"%d minutes ago" = "%d minutos atrás"; - -/* No comment provided by engineer. */ -"%d months ago" = "%d meses atrás"; - -/* No comment provided by engineer. */ -"%d seconds ago" = "%d segundos atrás"; - -/* No comment provided by engineer. */ -"%d weeks ago" = "%d semanas atrás"; - -/* No comment provided by engineer. */ -"%d years ago" = "%d anos atrás"; - -/* No comment provided by engineer. */ -"A minute ago" = "Um minuto atrás"; - -/* No comment provided by engineer. */ -"An hour ago" = "Uma hora atrás"; - -/* No comment provided by engineer. */ -"Just now" = "Agora mesmo"; - -/* No comment provided by engineer. */ -"Last month" = "Mês passado"; - -/* No comment provided by engineer. */ -"Last week" = "Semana passada"; - -/* No comment provided by engineer. */ -"Last year" = "Ano passado"; - -/* No comment provided by engineer. */ -"Yesterday" = "Ontem"; - -/* No comment provided by engineer. */ -"1 year ago" = "1 ano passado"; - -/* No comment provided by engineer. */ -"1 month ago" = "1 mês atrás"; - -/* No comment provided by engineer. */ -"1 week ago" = "1 semana atrás"; - -/* No comment provided by engineer. */ -"1 day ago" = "1 dia atrás"; - -/* No comment provided by engineer. */ -"This morning" = "Esta manhã"; - -/* No comment provided by engineer. */ -"This afternoon" = "Esta tarde"; - -/* No comment provided by engineer. */ -"Today" = "Hoje"; - -/* No comment provided by engineer. */ -"This week" = "Esta semana"; - -/* No comment provided by engineer. */ -"This month" = "Este mês"; - -/* No comment provided by engineer. */ -"This year" = "Este ano"; diff --git a/DateToolsSwift/DateTools/DateTools.bundle/pt.lproj/DateTools.strings b/DateToolsSwift/DateTools/DateTools.bundle/pt.lproj/DateTools.strings deleted file mode 100644 index 6143dd89..00000000 --- a/DateToolsSwift/DateTools/DateTools.bundle/pt.lproj/DateTools.strings +++ /dev/null @@ -1,71 +0,0 @@ -/* No comment provided by engineer. */ -"%d days ago" = "%d dias atrás"; - -/* No comment provided by engineer. */ -"%d hours ago" = "%d horas atrás"; - -/* No comment provided by engineer. */ -"%d minutes ago" = "%d minutos atrás"; - -/* No comment provided by engineer. */ -"%d months ago" = "%d meses atrás"; - -/* No comment provided by engineer. */ -"%d seconds ago" = "%d segundos atrás"; - -/* No comment provided by engineer. */ -"%d weeks ago" = "%d semanas atrás"; - -/* No comment provided by engineer. */ -"%d years ago" = "%d anos atrás"; - -/* No comment provided by engineer. */ -"A minute ago" = "Há um minuto"; - -/* No comment provided by engineer. */ -"An hour ago" = "Há uma hora"; - -/* No comment provided by engineer. */ -"Just now" = "Agora"; - -/* No comment provided by engineer. */ -"Last month" = "Mês passado"; - -/* No comment provided by engineer. */ -"Last week" = "Semana passada"; - -/* No comment provided by engineer. */ -"Last year" = "Ano passado"; - -/* No comment provided by engineer. */ -"Yesterday" = "Ontem"; - -/* No comment provided by engineer. */ -"1 year ago" = "1 ano atrás"; - -/* No comment provided by engineer. */ -"1 month ago" = "1 mês atrás"; - -/* No comment provided by engineer. */ -"1 week ago" = "1 semana atrás"; - -/* No comment provided by engineer. */ -"1 day ago" = "1 dia atrás"; - -/* No comment provided by engineer. */ -"This morning" = "Esta manhã"; - -/* No comment provided by engineer. */ -"This afternoon" = "Esta tarde"; - -/* No comment provided by engineer. */ -"Today" = "Hoje"; - -/* No comment provided by engineer. */ -"This week" = "Esta semana"; - -/* No comment provided by engineer. */ -"This month" = "Este mês"; - -/* No comment provided by engineer. */ -"This year" = "Este ano"; diff --git a/DateToolsSwift/DateTools/DateTools.bundle/ro.lproj/DateTools.strings b/DateToolsSwift/DateTools/DateTools.bundle/ro.lproj/DateTools.strings deleted file mode 100755 index 07460adb..00000000 --- a/DateToolsSwift/DateTools/DateTools.bundle/ro.lproj/DateTools.strings +++ /dev/null @@ -1,80 +0,0 @@ -/* No comment provided by engineer. */ -"%d days ago" = "În urmă cu %d zile"; - -/* No comment provided by engineer. */ -"%d hours ago" = "În urmă cu %d ore"; - -/* No comment provided by engineer. */ -"%d minutes ago" = "În urmă cu %d minute"; - -/* No comment provided by engineer. */ -"%d months ago" = "În urmă cu %d luni"; - -/* No comment provided by engineer. */ -"%d seconds ago" = "În urmă cu %d secunde"; - -/* No comment provided by engineer. */ -"%d weeks ago" = "În urmă cu %d săptămâni"; - -/* No comment provided by engineer. */ -"%d years ago" = "În urmă cu %d ani"; - -/* No comment provided by engineer. */ -"A minute ago" = "În urmă cu 1 minut"; - -/* No comment provided by engineer. */ -"An hour ago" = "În urmă cu 1 oră"; - -/* No comment provided by engineer. */ -"Just now" = "Acum câteva momente"; - -/* No comment provided by engineer. */ -"Last month" = "Luna trecută"; - -/* No comment provided by engineer. */ -"Last week" = "Săptămâna trecută"; - -/* No comment provided by engineer. */ -"Last year" = "Anul trecut"; - -/* No comment provided by engineer. */ -"Yesterday" = "Ieri"; - -/* No comment provided by engineer. */ -"1 year ago" = "În urmă cu 1 an"; - -/* No comment provided by engineer. */ -"1 month ago" = "În urmă cu 1 lună"; - -/* No comment provided by engineer. */ -"1 week ago" = "În urmă cu 1 săptămână"; - -/* No comment provided by engineer. */ -"1 day ago" = "În urmă cu 1 zi"; - -/* No comment provided by engineer. */ -"This morning" = "Azi dimineață"; - -/* No comment provided by engineer. */ -"This afternoon" = "În această seară"; - -/* No comment provided by engineer. */ -"Today" = "Astăzi"; - -/* No comment provided by engineer. */ -"This week" = "Săptămâna aceasta"; - -/* No comment provided by engineer. */ -"This month" = "Luna aceasta"; - -/* No comment provided by engineer. */ -"This year" = "Anul acesta"; - -/* Short format for */ -"%dy" = "%da"; // year (an) -"%dM" = "%dl"; // month (luna) -"%dw" = "%dS"; // week (saptamana) -"%dd" = "%dz"; // day (ziua) -"%dh" = "%do"; // hour (ora) -"%dm" = "%dm"; // minute (minut) -"%ds" = "%ds"; // second (secunda) diff --git a/DateToolsSwift/DateTools/DateTools.bundle/ru.lproj/DateTools.strings b/DateToolsSwift/DateTools/DateTools.bundle/ru.lproj/DateTools.strings deleted file mode 100644 index dc279ec8..00000000 --- a/DateToolsSwift/DateTools/DateTools.bundle/ru.lproj/DateTools.strings +++ /dev/null @@ -1,125 +0,0 @@ -/* - RULES: - Assume value for (seconds, hours, minutes, days, weeks, months or years) is XXXY, Y is last digit, XY is last two digits; - */ - -/* Y == 0 OR Y > 4 OR (XY > 10 AND XY < 15); */ -"%d days ago" = "%d дней назад"; - -/* Y > 1 AND Y < 5 AND (XY < 10 OR XY > 20); */ -"%d _days ago" = "%d дня назад"; - -/* Y == 1 AND XY != 11; */ -"%d __days ago" = "%d день назад"; - - -/* Y == 0 OR Y > 4 OR (XY > 10 AND XY < 15); */ -"%d hours ago" = "%d часов назад"; - -/* Y > 1 AND Y < 5 AND (XY < 10 OR XY > 20); */ -"%d _hours ago" = "%d часа назад"; - -/* Y == 1 AND XY != 11; */ -"%d __hours ago" = "%d час назад"; - - -/* Y == 0 OR Y > 4 OR (XY > 10 AND XY < 15); */ -"%d minutes ago" = "%d минут назад"; - -/* Y > 1 AND Y < 5 AND (XY < 10 OR XY > 20); */ -"%d _minutes ago" = "%d минуты назад"; - -/* Y == 1 AND XY != 11; */ -"%d __minutes ago" = "%d минуту назад"; - - -/* Y == 0 OR Y > 4 OR (XY > 10 AND XY < 15); */ -"%d months ago" = "%d месяцев назад"; - -/* Y > 1 AND Y < 5 AND (XY < 10 OR XY > 20); */ -"%d _months ago" = "%d месяца назад"; - -/* Y == 1 AND XY != 11; */ -"%d __months ago" = "%d месяц назад"; - - -/* Y == 0 OR Y > 4 OR (XY > 10 AND XY < 15); */ -"%d seconds ago" = "%d секунд назад"; - -/* Y > 1 AND Y < 5 AND (XY < 10 OR XY > 20); */ -"%d _seconds ago" = "%d секунды назад"; - -/* Y == 1 AND XY != 11; */ -"%d __seconds ago" = "%d секунду назад"; - - -/* Y == 0 OR Y > 4 OR (XY > 10 AND XY < 15); */ -"%d weeks ago" = "%d недель назад"; - -/* Y > 1 AND Y < 5 AND (XY < 10 OR XY > 20); */ -"%d _weeks ago" = "%d недели назад"; - -/* Y == 1 AND XY != 11; */ -"%d __weeks ago" = "%d неделю назад"; - - -/* Y == 0 OR Y > 4 OR (XY > 10 AND XY < 15); */ -"%d years ago" = "%d лет назад"; - -/* Y > 1 AND Y < 5 AND (XY < 10 OR XY > 20); */ -"%d _years ago" = "%d года назад"; - -/* Y == 1 AND XY != 11; */ -"%d __years ago" = "%d год назад"; - - -/* No comment provided by engineer. */ -"A minute ago" = "Минуту назад"; - -/* No comment provided by engineer. */ -"An hour ago" = "Час назад"; - -/* No comment provided by engineer. */ -"Just now" = "Только что"; - -/* No comment provided by engineer. */ -"Last month" = "Месяц назад"; - -/* No comment provided by engineer. */ -"Last week" = "Неделю назад"; - -/* No comment provided by engineer. */ -"Last year" = "Год назад"; - -/* No comment provided by engineer. */ -"Yesterday" = "Вчера"; - -/* No comment provided by engineer. */ -"1 year ago" = "1 год назад"; - -/* No comment provided by engineer. */ -"1 month ago" = "1 месяц назад"; - -/* No comment provided by engineer. */ -"1 week ago" = "1 неделю назад"; - -/* No comment provided by engineer. */ -"1 day ago" = "1 день назад"; - -/* No comment provided by engineer. */ -"This morning" = "Этим утром"; - -/* No comment provided by engineer. */ -"This afternoon" = "Этим днём"; - -/* No comment provided by engineer. */ -"Today" = "Сегодня"; - -/* No comment provided by engineer. */ -"This week" = "На этой неделе"; - -/* No comment provided by engineer. */ -"This month" = "В этом месяце"; - -/* No comment provided by engineer. */ -"This year" = "В этом году"; diff --git a/DateToolsSwift/DateTools/DateTools.bundle/sk.lproj/NSDateTimeAgo.strings b/DateToolsSwift/DateTools/DateTools.bundle/sk.lproj/NSDateTimeAgo.strings deleted file mode 100644 index e098fc27..00000000 --- a/DateToolsSwift/DateTools/DateTools.bundle/sk.lproj/NSDateTimeAgo.strings +++ /dev/null @@ -1,71 +0,0 @@ -/* No comment provided by engineer. */ -"%d days ago" = "Pred %d dňami"; - -/* No comment provided by engineer. */ -"%d hours ago" = "Pred %d hodinami"; - -/* No comment provided by engineer. */ -"%d minutes ago" = "Pred %d minútami"; - -/* No comment provided by engineer. */ -"%d months ago" = "Pred %d mesiaci"; - -/* No comment provided by engineer. */ -"%d seconds ago" = "Pred %d sekundami"; - -/* No comment provided by engineer. */ -"%d weeks ago" = "Pred %d týždňami"; - -/* No comment provided by engineer. */ -"%d years ago" = "Pred %d rokmi"; - -/* No comment provided by engineer. */ -"A minute ago" = "Pred minútou"; - -/* No comment provided by engineer. */ -"An hour ago" = "Pred hodinou"; - -/* No comment provided by engineer. */ -"Just now" = "Práve teraz"; - -/* No comment provided by engineer. */ -"Last month" = "Minulý mesiac"; - -/* No comment provided by engineer. */ -"Last week" = "Minulý týždeň"; - -/* No comment provided by engineer. */ -"Last year" = "Minulý rok"; - -/* No comment provided by engineer. */ -"Yesterday" = "Včera"; - -/* No comment provided by engineer. */ -"1 year ago" = "Pred rokom"; - -/* No comment provided by engineer. */ -"1 month ago" = "Pred mesiacom"; - -/* No comment provided by engineer. */ -"1 week ago" = "Pred týždňom"; - -/* No comment provided by engineer. */ -"1 day ago" = "Predvčerom"; - -/* No comment provided by engineer. */ -"This morning" = "Dnes dopoludnia"; - -/* No comment provided by engineer. */ -"This afternoon" = "Dnes popoludní"; - -/* No comment provided by engineer. */ -"Today" = "Dnes"; - -/* No comment provided by engineer. */ -"This week" = "Tento týždeň"; - -/* No comment provided by engineer. */ -"This month" = "Tento mesiac"; - -/* No comment provided by engineer. */ -"This year" = "Tento rok"; diff --git a/DateToolsSwift/DateTools/DateTools.bundle/sl.lproj/DateTools.strings b/DateToolsSwift/DateTools/DateTools.bundle/sl.lproj/DateTools.strings deleted file mode 100644 index de71c678..00000000 --- a/DateToolsSwift/DateTools/DateTools.bundle/sl.lproj/DateTools.strings +++ /dev/null @@ -1,89 +0,0 @@ -/* No comment provided by engineer. */ -"%d days ago" = "pred %d dnevi"; - -/* No comment provided by engineer. */ -"%d hours ago" = "pred %d urami"; - -/* No comment provided by engineer. */ -"%d minutes ago" = "pred %d minutami"; - -/* No comment provided by engineer. */ -"%d months ago" = "pred %d meseci"; - -/* No comment provided by engineer. */ -"%d seconds ago" = "pred %d sekundami"; - -/* No comment provided by engineer. */ -"%d weeks ago" = "pred %d tedni"; - -/* No comment provided by engineer. */ -"%d years ago" = "pred %d leti"; - -/* No comment provided by engineer. */ -"A minute ago" = "pred eno minuto"; - -/* No comment provided by engineer. */ -"An hour ago" = "pred eno uro"; - -/* No comment provided by engineer. */ -"Just now" = "ravnokar"; - -/* No comment provided by engineer. */ -"Last month" = "prejšnji mesec"; - -/* No comment provided by engineer. */ -"Last week" = "prejšnji teden"; - -/* No comment provided by engineer. */ -"Last year" = "prejšnje leto"; - -/* No comment provided by engineer. */ -"Yesterday" = "včeraj"; - -/* No comment provided by engineer. */ -"1 year ago" = "pred 1 letom"; - -/* No comment provided by engineer. */ -"1 month ago" = "pred 1 mesecem"; - -/* No comment provided by engineer. */ -"1 week ago" = "pred 1 tednom"; - -/* No comment provided by engineer. */ -"1 day ago" = "pred 1 dnevom"; - -/* No comment provided by engineer. */ -"1 hour ago" = "pred 1 uro"; - -/* No comment provided by engineer. */ -"1 minute ago" = "pred 1 minuto"; - -/* No comment provided by engineer. */ -"1 second ago" = "pred 1 sekundo"; - -/* No comment provided by engineer. */ -"This morning" = "zjutraj"; - -/* No comment provided by engineer. */ -"This afternoon" = "zvečer"; - -/* No comment provided by engineer. */ -"Today" = "danes"; - -/* No comment provided by engineer. */ -"This week" = "ta teden"; - -/* No comment provided by engineer. */ -"This month" = "ta mesec"; - -/* No comment provided by engineer. */ -"This year" = "to leto"; - -/* Short format for */ -"%dy" = "%dl"; // year -"%dM" = "%dM"; // month -"%dw" = "%dt"; // week -"%dd" = "%dd"; // day -"%dh" = "%du"; // hour -"%dm" = "%dm"; // minute -"%ds" = "%ds"; // second diff --git a/DateToolsSwift/DateTools/DateTools.bundle/sv.lproj/DateTools.strings b/DateToolsSwift/DateTools/DateTools.bundle/sv.lproj/DateTools.strings deleted file mode 100644 index 873a79593968d807c7130acf94e8779e0f701438..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 3430 zcmcgvu};G<5WTry5mjR8K*fw0DgjavV(P*e8k1Bg2}+t){a^YEjKF&i=8T$jvsE=J zcPHPA-@9k?{WX`FB=RIRo@+cye2i4G#ozDJAhMH_m7LK zv^&{h$ITgRepSp}E3s=-Lva?{5jCk*Nla{14mDe$^Ej)ldIR&UqFUoAZjXNKJ&tXM z{2CQ?R9pvirN+l`9V6jcfDK>Sr+#q<-u#*v>@93h=NDs`oLiVEih6*8TkFad)Ux*+ z)z5UnJoFKY>HDiAsH@-0Clu45hFqx|g!6R8*9jwP7M!AujZ`xQF4_dlH(W@EVud#Or?v8YO8I0_LtoetwsoyNk`D`XfA zb2%`FzniUav)G_d&sYQJ<-IcZ{Ef;bn>?>fF!d^qR9=5)h)&Df#s4WXe|erR55A)jhZc3p|qx`2Z&g{y*sNFd-dQ+0nTkN2Ie&q~Z6-xt=1T IX4Pwd06EPdBme*a diff --git a/DateToolsSwift/DateTools/DateTools.bundle/th.lproj/DateTools.strings b/DateToolsSwift/DateTools/DateTools.bundle/th.lproj/DateTools.strings deleted file mode 100644 index 751129a74c10d896b74a31c35a189878967b6c54..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 3462 zcmc(h(M!T$6vgjDAnf5j1+jcFLk5P4Qb|OhJ!wc!z4W-!RKhJZ6aV?@+;5C)IQO4=YY;)Jk6?#6-;q$res4TlSN7qCP(;TiYA9IHr#`9dFSEAPldfPwK zfUm%1-?z1M#zziW9cnA1b8Wuhp{d$7U<-4dP=+sURMtZ#Y^#4aFD@{@8~CzhJjWiC zRe|o4)X3vHL~cAH%a$&qBM`2)^0kZf>Y!f@KH_t}#g&g~4hl=xA+(f`XjW+2TW5pP zqz+V;LpV-(Qr9Vuoy%U_z9PHJ0%<8bvr?#D0%Vb2m`+-7Q`&=FH_2VQe#qNYt=Tlz z$`z(mv)M$4(63M>ipgfO{EmA@8qeI0DzjT4pXCd5lBwk`d&oS|bCKDnL?OMquQ#EJ vaYUI^r%2;AR|}_#cU+##$*LQvjx}ZeYuAcHJ+36`Yb%O0^^`%9Zu{+j2 4 OR (XY > 10 AND XY < 15); */ -"%d days ago" = "%d днів тому"; - -/* Y > 1 AND Y < 5 AND (XY < 10 OR XY > 20); */ -"%d _days ago" = "%d дні тому"; - -/* Y == 1 AND XY != 11; */ -"%d __days ago" = "%d день тому"; - - -/* Y == 0 OR Y > 4 OR (XY > 10 AND XY < 15); */ -"%d hours ago" = "%d годин тому"; - -/* Y > 1 AND Y < 5 AND (XY < 10 OR XY > 20); */ -"%d _hours ago" = "%d години тому"; - -/* Y == 1 AND XY != 11; */ -"%d __hours ago" = "%d годину тому"; - - -/* Y == 0 OR Y > 4 OR (XY > 10 AND XY < 15); */ -"%d minutes ago" = "%d хвилин тому"; - -/* Y > 1 AND Y < 5 AND (XY < 10 OR XY > 20); */ -"%d _minutes ago" = "%d хвилини тому"; - -/* Y == 1 AND XY != 11; */ -"%d __minutes ago" = "%d хвилину тому"; - - -/* Y == 0 OR Y > 4 OR (XY > 10 AND XY < 15); */ -"%d months ago" = "%d місяців тому"; - -/* Y > 1 AND Y < 5 AND (XY < 10 OR XY > 20); */ -"%d _months ago" = "%d місяці тому"; - -/* Y == 1 AND XY != 11; */ -"%d __months ago" = "%d місяць тому"; - - -/* Y == 0 OR Y > 4 OR (XY > 10 AND XY < 15); */ -"%d seconds ago" = "%d секунд тому"; - -/* Y > 1 AND Y < 5 AND (XY < 10 OR XY > 20); */ -"%d _seconds ago" = "%d секунди тому"; - -/* Y == 1 AND XY != 11; */ -"%d __seconds ago" = "%d секунду тому"; - - -/* Y == 0 OR Y > 4 OR (XY > 10 AND XY < 15); */ -"%d weeks ago" = "%d тижнів тому"; - -/* Y > 1 AND Y < 5 AND (XY < 10 OR XY > 20); */ -"%d _weeks ago" = "%d тижні тому"; - -/* Y == 1 AND XY != 11; */ -"%d __weeks ago" = "%d тиждень тому"; - - -/* Y == 0 OR Y > 4 OR (XY > 10 AND XY < 15); */ -"%d years ago" = "%d років тому"; - -/* Y > 1 AND Y < 5 AND (XY < 10 OR XY > 20); */ -"%d _years ago" = "%d роки тому"; - -/* Y == 1 AND XY != 11; */ -"%d __years ago" = "%d рік тому"; - - -/* No comment provided by engineer. */ -"A minute ago" = "Хвилину тому"; - -/* No comment provided by engineer. */ -"An hour ago" = "Годину тому"; - -/* No comment provided by engineer. */ -"Just now" = "Щойно"; - -/* No comment provided by engineer. */ -"Last month" = "Місяць тому"; - -/* No comment provided by engineer. */ -"Last week" = "Тиждень тому"; - -/* No comment provided by engineer. */ -"Last year" = "Рік тому"; - -/* No comment provided by engineer. */ -"Yesterday" = "Вчора"; - -/* No comment provided by engineer. */ -"1 year ago" = "1 рік тому"; - -/* No comment provided by engineer. */ -"1 month ago" = "1 місяць тому"; - -/* No comment provided by engineer. */ -"1 week ago" = "1 тиждень тому"; - -/* No comment provided by engineer. */ -"1 day ago" = "1 день тому"; - -/* No comment provided by engineer. */ -"This morning" = "Цього ранку"; - -/* No comment provided by engineer. */ -"This afternoon" = "Сьогодні вдень"; - -/* No comment provided by engineer. */ -"Today" = "Сьогодні"; - -/* No comment provided by engineer. */ -"This week" = "Цього тижня"; - -/* No comment provided by engineer. */ -"This month" = "Цього місяця"; - -/* No comment provided by engineer. */ -"This year" = "Цього року"; diff --git a/DateToolsSwift/DateTools/DateTools.bundle/vi.lproj/DateTools.strings b/DateToolsSwift/DateTools/DateTools.bundle/vi.lproj/DateTools.strings deleted file mode 100644 index 9131cc9c..00000000 --- a/DateToolsSwift/DateTools/DateTools.bundle/vi.lproj/DateTools.strings +++ /dev/null @@ -1,71 +0,0 @@ -/* No comment provided by engineer. */ -"%d days ago" = "%d ngày trước"; - -/* No comment provided by engineer. */ -"%d hours ago" = "%d giờ trước"; - -/* No comment provided by engineer. */ -"%d minutes ago" = "%d phút trước"; - -/* No comment provided by engineer. */ -"%d months ago" = "%d tháng trước"; - -/* No comment provided by engineer. */ -"%d seconds ago" = "%d giây trước"; - -/* No comment provided by engineer. */ -"%d weeks ago" = "%d tuần trước"; - -/* No comment provided by engineer. */ -"%d years ago" = "%d năm trước"; - -/* No comment provided by engineer. */ -"A minute ago" = "Một phút trước"; - -/* No comment provided by engineer. */ -"An hour ago" = "Một giờ trước"; - -/* No comment provided by engineer. */ -"Just now" = "Vừa mới đây"; - -/* No comment provided by engineer. */ -"Last month" = "Tháng trước"; - -/* No comment provided by engineer. */ -"Last week" = "Tuần trước"; - -/* No comment provided by engineer. */ -"Last year" = "Năm vừa rồi"; - -/* No comment provided by engineer. */ -"Yesterday" = "Hôm qua"; - -/* No comment provided by engineer. */ -"1 year ago" = "1 năm trước"; - -/* No comment provided by engineer. */ -"1 month ago" = "1 tháng trước"; - -/* No comment provided by engineer. */ -"1 week ago" = "1 tuần trước"; - -/* No comment provided by engineer. */ -"1 day ago" = "1 ngày trước"; - -/* No comment provided by engineer. */ -"This morning" = "Sáng nay"; - -/* No comment provided by engineer. */ -"This afternoon" = "Trưa nay"; - -/* No comment provided by engineer. */ -"Today" = "Hôm nay"; - -/* No comment provided by engineer. */ -"This week" = "Tuần này"; - -/* No comment provided by engineer. */ -"This month" = "Tháng này"; - -/* No comment provided by engineer. */ -"This year" = "Năm nay"; diff --git a/DateToolsSwift/DateTools/DateTools.bundle/zh-Hans.lproj/DateTools.strings b/DateToolsSwift/DateTools/DateTools.bundle/zh-Hans.lproj/DateTools.strings deleted file mode 100644 index 8004dab6..00000000 --- a/DateToolsSwift/DateTools/DateTools.bundle/zh-Hans.lproj/DateTools.strings +++ /dev/null @@ -1,97 +0,0 @@ -/* No comment provided by engineer. */ -"%d days ago" = "%d天前"; - -/* No comment provided by engineer. */ -"%d hours ago" = "%d小时前"; - -/* No comment provided by engineer. */ -"%d minutes ago" = "%d分钟前"; - -/* No comment provided by engineer. */ -"%d months ago" = "%d个月前"; - -/* No comment provided by engineer. */ -"%d seconds ago" = "%d秒钟前"; - -/* No comment provided by engineer. */ -"%d weeks ago" = "%d星期前"; - -/* No comment provided by engineer. */ -"%d years ago" = "%d年前"; - -/* No comment provided by engineer. */ -"A minute ago" = "1分钟前"; - -/* No comment provided by engineer. */ -"An hour ago" = "1小时前"; - -/* No comment provided by engineer. */ -"Just now" = "刚刚"; - -/* No comment provided by engineer. */ -"Last month" = "上个月"; - -/* No comment provided by engineer. */ -"Last week" = "上星期"; - -/* No comment provided by engineer. */ -"Last year" = "去年"; - -/* No comment provided by engineer. */ -"Yesterday" = "昨天"; - -/* You can add a space between the number and the characters. */ -"1 year ago" = "1年前"; - -/* You can add a space between the number and the characters. */ -"1 month ago" = "1个月前"; - -/* You can add a space between the number and the characters. */ -"1 week ago" = "1星期前"; - -/* You can add a space between the number and the characters. */ -"1 day ago" = "1天前"; - -/* No comment provided by engineer. */ -"This morning" = "今天上午"; - -/* No comment provided by engineer. */ -"This afternoon" = "今天下午"; - -/* No comment provided by engineer. */ -"Today" = "今天"; - -/* No comment provided by engineer. */ -"This week" = "本周"; - -/* No comment provided by engineer. */ -"This month" = "本月"; - -/* No comment provided by engineer. */ -"This year" = "今年"; - -/* Short format for */ -"%dy" = "%d年"; // year -"%dM" = "%d月"; // month -"%dw" = "%d周"; // week -"%dd" = "%d天"; // day -"%dh" = "%d小时"; // hour -"%dm" = "%d分"; // minute -"%ds" = "%d秒"; // second - -/* Week format for */ -"Mon" = "星期一"; -"Tue" = "星期二"; -"Wed" = "星期三"; -"Thu" = "星期四"; -"Fri" = "星期五"; -"Sat" = "星期六"; -"Sun" = "星期日"; - -"周一" = "星期一"; -"周二" = "星期二"; -"周三" = "星期三"; -"周四" = "星期四"; -"周五" = "星期五"; -"周六" = "星期六"; -"周日" = "星期日"; \ No newline at end of file diff --git a/DateToolsSwift/DateTools/DateTools.bundle/zh-Hant.lproj/DateTools.strings b/DateToolsSwift/DateTools/DateTools.bundle/zh-Hant.lproj/DateTools.strings deleted file mode 100644 index 32902d93..00000000 --- a/DateToolsSwift/DateTools/DateTools.bundle/zh-Hant.lproj/DateTools.strings +++ /dev/null @@ -1,97 +0,0 @@ -/* No comment provided by engineer. */ -"%d days ago" = "%d天前"; - -/* No comment provided by engineer. */ -"%d hours ago" = "%d小時前"; - -/* No comment provided by engineer. */ -"%d minutes ago" = "%d分鐘前"; - -/* No comment provided by engineer. */ -"%d months ago" = "%d個月前"; - -/* No comment provided by engineer. */ -"%d seconds ago" = "%d秒鐘前"; - -/* No comment provided by engineer. */ -"%d weeks ago" = "%d星期前"; - -/* No comment provided by engineer. */ -"%d years ago" = "%d年前"; - -/* No comment provided by engineer. */ -"A minute ago" = "1分鐘前"; - -/* No comment provided by engineer. */ -"An hour ago" = "1小時前"; - -/* No comment provided by engineer. */ -"Just now" = "剛剛"; - -/* No comment provided by engineer. */ -"Last month" = "上個月"; - -/* No comment provided by engineer. */ -"Last week" = "上星期"; - -/* No comment provided by engineer. */ -"Last year" = "去年"; - -/* No comment provided by engineer. */ -"Yesterday" = "昨天"; - -/* No comment provided by engineer. */ -"1 year ago" = "1年前"; - -/* No comment provided by engineer. */ -"1 month ago" = "1個月前"; - -/* No comment provided by engineer. */ -"1 week ago" = "1星期前"; - -/* No comment provided by engineer. */ -"1 day ago" = "1天前"; - -/* No comment provided by engineer. */ -"This morning" = "今天上午"; - -/* No comment provided by engineer. */ -"This afternoon" = "今天下午"; - -/* No comment provided by engineer. */ -"Today" = "今天"; - -/* No comment provided by engineer. */ -"This week" = "本周"; - -/* No comment provided by engineer. */ -"This month" = "本月"; - -/* No comment provided by engineer. */ -"This year" = "今年"; - -/* Short format for */ -"%dy" = "%d年"; // year -"%dM" = "%d月"; // month -"%dw" = "%d週"; // week -"%dd" = "%d天"; // day -"%dh" = "%d小時"; // hour -"%dm" = "%d分"; // minute -"%ds" = "%d秒"; // second - -/* Week format for */ -"Mon" = "星期壹"; -"Tue" = "星期二"; -"Wed" = "星期三"; -"Thu" = "星期四"; -"Fri" = "星期五"; -"Sat" = "星期六"; -"Sun" = "星期日"; - -"周壹" = "星期壹"; -"周二" = "星期二"; -"周三" = "星期三"; -"周四" = "星期四"; -"周五" = "星期五"; -"周六" = "星期六"; -"周日" = "星期日"; \ No newline at end of file diff --git a/DateToolsSwift/Examples/DateToolsExample/DateToolsExample.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/DateToolsSwift/Examples/DateToolsExample/DateToolsExample.xcodeproj/project.xcworkspace/contents.xcworkspacedata deleted file mode 100644 index 2157f947..00000000 --- a/DateToolsSwift/Examples/DateToolsExample/DateToolsExample.xcodeproj/project.xcworkspace/contents.xcworkspacedata +++ /dev/null @@ -1,7 +0,0 @@ - - - - - diff --git a/Examples/DateToolsExample/DateTools macOS/DateTools macOS.h b/Examples/DateToolsExample/DateTools macOS/DateTools macOS.h deleted file mode 100644 index 5d913b53..00000000 --- a/Examples/DateToolsExample/DateTools macOS/DateTools macOS.h +++ /dev/null @@ -1,19 +0,0 @@ -// -// DateTools macOS.h -// DateTools macOS -// -// Created by Tom Baranes on 22/09/2016. -// -// - -#import - -//! Project version number for DateTools macOS. -FOUNDATION_EXPORT double DateTools_macOSVersionNumber; - -//! Project version string for DateTools macOS. -FOUNDATION_EXPORT const unsigned char DateTools_macOSVersionString[]; - -// In this header, you should import all the public headers of your framework using statements like #import - - diff --git a/Examples/DateToolsExample/DateTools macOS/Info.plist b/Examples/DateToolsExample/DateTools macOS/Info.plist deleted file mode 100644 index fbe1e6b3..00000000 --- a/Examples/DateToolsExample/DateTools macOS/Info.plist +++ /dev/null @@ -1,24 +0,0 @@ - - - - - CFBundleDevelopmentRegion - en - CFBundleExecutable - $(EXECUTABLE_NAME) - CFBundleIdentifier - $(PRODUCT_BUNDLE_IDENTIFIER) - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - $(PRODUCT_NAME) - CFBundlePackageType - FMWK - CFBundleShortVersionString - 1.0 - CFBundleVersion - $(CURRENT_PROJECT_VERSION) - NSPrincipalClass - - - diff --git a/Examples/DateToolsExample/DateToolsExample.xcodeproj/xcshareddata/xcschemes/DateTools macOS.xcscheme b/Examples/DateToolsExample/DateToolsExample.xcodeproj/xcshareddata/xcschemes/DateTools macOS.xcscheme deleted file mode 100644 index 1607381f..00000000 --- a/Examples/DateToolsExample/DateToolsExample.xcodeproj/xcshareddata/xcschemes/DateTools macOS.xcscheme +++ /dev/null @@ -1,80 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Package.swift b/Package.swift index 32485a35..fc96d877 100644 --- a/Package.swift +++ b/Package.swift @@ -1,9 +1,28 @@ +// swift-tools-version:5.1 +// The swift-tools-version declares the minimum version of Swift required to build this package. + import PackageDescription let package = Package( name: "DateToolsSwift", + platforms: [ + .macOS(.v10_13), .iOS(.v10), .watchOS(.v4) + ], + products: [ + // Products define the executables and libraries produced by a package, and make them visible to other packages. + .library( + name: "DateToolsSwift", + targets: ["DateToolsSwift"]), + ], + dependencies: [ + // Dependencies declare other packages that this package depends on. + // .package(url: /* package url */, from: "1.0.0"), + ], targets: [ - Target(name: "DateToolsSwift") + // Targets are the basic building blocks of a package. A target can define a module or a test suite. + // Targets can depend on other targets in this package, and on products in packages which this package depends on. + .target( + name: "DateToolsSwift", + dependencies: []) ] ) -package.exclude = ["DateTools", "Examples", "Tests", "DateToolsSwift/Examples"] diff --git a/README.md b/README.md index eb561e46..411b92e1 100644 --- a/README.md +++ b/README.md @@ -1,454 +1,3 @@ -![Banner](https://raw.githubusercontent.com/MatthewYork/Resources/master/DateTools/DateToolsHeader2.png) +## DateToolsSwift -## DateTools - -DateTools was written to streamline date and time handling in iOS. Classes and concepts from other languages served as an inspiration for DateTools, especially the [DateTime](http://msdn.microsoft.com/en-us/library/system.datetime(v=vs.110).aspx) structure and [Time Period Library](http://www.codeproject.com/Articles/168662/Time-Period-Library-for-NET) for .NET. Through these classes and others, DateTools removes the boilerplate required to access date components, handles more nuanced date comparisons, and serves as the foundation for entirely new concepts like Time Periods and their collections. - -[![Build Status](https://travis-ci.org/MatthewYork/DateTools.svg?branch=master)](https://travis-ci.org/MatthewYork/DateTools) -[![CocoaPods](https://cocoapod-badges.herokuapp.com/v/DateTools/badge.png)](http://cocoapods.org/?q=datetools) -[![CocoaPods](https://cocoapod-badges.herokuapp.com/v/DateToolsSwift/badge.png)](http://cocoapods.org/?q=datetoolsswift) - -#### Featured In - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - -
Yahoo! LivetextMy Disney ExperienceALDIGuidebookYoutube MusicKhan Academy
- -#### Donate - - -bitcoin: 17ZEBFw5peuoUwYaEJeGkpoJwP1htViLUY - -## Installation - -**CocoaPods** - -Swift - -pod 'DateToolsSwift' - -Objective-C (Legacy) - -pod 'DateTools' - -**Manual Installation** - -All the classes required for DateTools are located in the DateTools folder in the root of this repository. They are listed below: - -Swift (Found in DateToolsSwift/DateTools) -* Constants.swift -* Date+Bundle.swift -* Date+Comparators.swift -* Date+Components.swift -* Date+Format.swift -* Date+Inits.swift -* Date+Manipulations.swift -* Date+TimeAgo.swift -* DateTools.bundle -* Enums.swift -* Integer.DateTools.swift -* TimeChunk.swift -* TimePeriod.swift -* TimePeriodChain.swift -* TimePeriodCollection.swift -* TimePeriodGroup.swift - -Objective-C (Found in DateTools/DateTools) -* DateTools.h -* NSDate+DateTools.{h,m} -* DTConstants.h -* DTError.{h,m} -* DTTimePeriod.{h,m} -* DTTimePeriodGroup.{h,m} -* DTTimePeriodCollection.{h,m} -* DTTimePeriodChain.{h,m} - -The following bundle is necessary if you would like to support internationalization or would like to use the "Time Ago" functionality. You can add localizations at the `Localizations` subheading under `Info` in the `Project` menu. - -* DateTools.bundle - -DateTools.h contains the headers for all the other files. Import this if you want to link to the entire framework. - -## Table of Contents - -* [**DateTools**](#datetools) - * [Time Ago](#time-ago) - * [Date Components](#date-components) - * [Date Editing](#date-editing) - * [Date Comparison](#date-comparison) - * [Formatted Date Strings](#formatted-date-strings) -* [**Time Periods**](#time-periods) - * [Initialization](#initialization) - * [Time Period Info](#time-period-info) - * [Manipulation](#manipulation) - * [Relationships](#relationships) -* [**Time Period Groups**](#time-period-groups) - * [Time Period Collections](#time-period-collections) - * [Time Period Chains](#time-period-chains) -* [**Unit Tests**](#unit-tests) -* [**Credits**](#credits) -* [**License**](#license) - -## DateTools - -**Full code documentation can be found [here](http://cocoadocs.org/docsets/DateToolsSwift/2.0.0/)** - -One of the missions of DateTools was to make Date feel more complete. There are many other languages that allow direct access to information about dates from their date classes, but Date (sadly) does not. It safely works only in the Unix time offsets through the timeIntervalSince... methods for building dates and remains calendar agnostic. But that's not always what we want to do. Sometimes, we want to work with dates based on their date components (like year, month, day, etc) at a more abstract level. This is where DateTools comes in. - -#### Time Ago - -No date library would be complete without the ability to quickly make an NSString based on how much earlier a date is than now. DateTools has you covered. These "time ago" strings come in a long and short form, with the latter closely resembling Twitter. You can get these strings like so: - -```swift -let timeAgoDate = 2.days.earlier -print("Time Ago: ", timeAgoDate.timeAgoSinceNow) -print("Time Ago: ", timeAgoDate.shortTimeAgoSinceNow) - -//Output: -//Time Ago: 2 days ago -//Time Ago: 2d -``` - -Assuming you have added the localization to your project, `DateTools` currently supports the following languages: - -- ar (Arabic) -- bg (Bulgarian) -- ca (Catalan) -- zh_Hans (Chinese Simplified) -- zh_Hant (Chinese Traditional) -- cs (Czech) -- da (Danish) -- nl (Dutch) -- en (English) -- fi (Finnish) -- fr (French) -- de (German) -- gre (Greek) -- gu (Gujarati) -- he (Hebrew) -- hi (Hindi) -- hu (Hungarian) -- is (Icelandic) -- id (Indonesian) -- it (Italian) -- ja (Japanese) -- ko (Korean) -- lv (Latvian) -- ms (Malay) -- nb (Norwegian) -- pl (Polish) -- pt (Portuguese) -- ro (Romanian) -- ru (Russian) -- sl (Slovenian) -- es (Spanish) -- sv (Swedish) -- th (Thai) -- tr (Turkish) -- uk (Ukrainian) -- vi (Vietnamese) -- cy (Welsh) -- hr (Croatian) - -If you know a language not listed here, please consider submitting a translation. [Localization codes by language](http://stackoverflow.com/questions/3040677/locale-codes-for-iphone-lproj-folders). - -This project is user driven (by people like you). Pull requests close faster than issues (merged or rejected). - -Thanks to Kevin Lawler for his work on [NSDate+TimeAgo](https://github.com/kevinlawler/NSDate-TimeAgo), which has been officially merged into this library. - -#### Date Components - -There is a lot of boilerplate associated with getting date components from an Date. You have to set up a calendar, use the desired flags for the components you want, and finally extract them out of the calendar. - -With DateTools, this: - -```swift -//Create calendar -let calendar = Calendar(identifier: .gregorian) -let dateComponents = calendar.dateComponents(Set([.month,.year]), from: Date()) - -//Get components -let year = dateComponents.year! -let month = dateComponents.month! -``` - -...becomes this: -```swift -let year = Date().year -let month = Date().month -``` - -#### Date Editing - -The date editing methods in DateTools makes it easy to shift a date earlier or later by adding and subtracting date components. For instance, if you would like a date that is 1 year later from a given date, simply call the method dateByAddingYears. - -With DateTools, this: -```objc -//Create calendar -NSCalendar *calendar = [[NSCalendar alloc] initWithCalendarIdentifier:[NSDate defaultCalendar]]; -NSDateComponents *components = [[NSDateComponents alloc] init]; - -//Make changes -[components setYear:1]; - -//Get new date with updated year -NSDate *newDate = [calendar dateByAddingComponents:components toDate:date options:0]; -``` - -...becomes this: -```objc -NSDate *newDate = [date dateByAddingYears:1]; -``` - -Subtraction of date components is also fully supported through the dateBySubtractingYears - -#### Date Comparison - -Another mission of the DateTools category is to greatly increase the flexibility of date comparisons. Date gives you four basic methods: -* isEqualToDate: -* earlierDate: -* laterDate: -* compare: - -earlierDate: and laterDate: are great, but it would be nice to have a boolean response to help when building logic in code; to easily ask "is this date earlier than that one?". DateTools has a set of proxy methods that do just that as well as a few other methods for extended flexibility. The new methods are: -* isEarlierThan -* isEarlierThanOrEqualTo -* isLaterThan -* isLaterThanOrEqualTo - -These methods are great for comparing dates in a boolean fashion, but what if we want to compare the dates and return some meaningful information about how far they are apart? Date comes with two methods timeIntervalSinceDate: and timeIntervalSinceNow which gives you a double offset representing the number of seconds between the two dates. This is great and all, but there are times when one wants to know how many years or days are between two dates. For this, DateTools goes back to the ever-trusty NSCalendar and abstracts out all the necessary code for you. - -With Date Tools, this: -```objc -NSCalendar *calendar = [[NSCalendar alloc] initWithCalendarIdentifier:[NSDate defaultCalendar]]; -NSDate *earliest = [firstDate earlierDate:secondDate]; -NSDate *latest = (secondDate == firstDate) ? secondDate : firstDate; -NSInteger multiplier = (secondDate == firstDate) ? -1 : 1; -NSDateComponents *components = [calendar components:allCalendarUnitFlags fromDate:earliest toDate:latest options:0]; -NSInteger yearsApart = multiplier*(components.month + 12*components.year); -``` -..becomes this: -```objc -NSInteger yearsApart = [firstDate yearsFrom:secondDate]; -``` -Methods for comparison in this category include: -* yearsFrom:, yearsUntil, yearsAgo, yearsEarlierThan:, yearsLaterThan: -* monthsFrom:, monthsUntil, monthsAgo, monthsEarlierThan:, monthsLaterThan: -* weeksFrom:, weeksUntil, weeksAgo, weeksEarlierThan:, weeksLaterThan: -* daysFrom:, daysUntil, daysAgo, daysEarlierThan:, daysLaterThan: -* hoursFrom:, hoursUntil, hoursAgo, hoursEarlierThan:, hoursLaterThan: -* minutesFrom:, minutesUntil, minutesAgo, minutesEarlierThan:, minutesLaterThan: -* secondsFrom:, secondsUntil, secondsAgo, secondsEarlierThan:, secondsLaterThan: - -#### Formatted Date Strings - -Just for kicks, DateTools has a few convenience methods for quickly creating strings from dates. Those two methods are formattedDateWithStyle: and formattedDateWithFormat:. The current locale is used unless otherwise specified by additional method parameters. Again, just for kicks, really. - -## Time Periods - -Dates 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. - -#### Initialization - -Time peroids consist of an Date start date and end date. To initialize a time period, call the init function. - -```objc -DTTimePeriod *timePeriod = [[DTTimePeriod alloc] initWithStartDate:startDate endDate:endDate]; -``` -or, 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. The method below, for example, creates a time period starting at the current time that is exactly 5 hours long. -```objc -DTTimePeriod *timePeriod = [DTTimePeriod timePeriodWithSize:DTTimePeriodSizeHour amount:5 startingAt:[NSDate date]]; -``` - -#### Time Period Info - -A host of methods have been extended to give information about an instance of TimePeriod. A few are listed below -* hasStartDate - Returns true if the period has a start date -* hasEndDate - Returns true if the period has an end date -* isMoment - Returns true if the period has the same start and end date -* durationIn.... - Returns the length of the time period in the requested units - -#### Manipulation - -Time periods may also be manipulated. They may be shifted earlier or later as well as expanded and contracted. - -**Shifting** - -When 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 shiftEarlierWithSize:amount: and to shift it later, call shiftLaterWithSize:amount:. The amount field serves as a multipler, just like in the above initializaion method. - -**Lengthening/Shortening** - -When 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. - -An example of lengthening a time period is shown below: -```objc -DTTimePeriod *timePeriod = [DTTimePeriod timePeriodWithSize:DTTimePeriodSizeMinute endingAt:[NSDate date]]; -[timePeriod lengthenWithAnchorDate:DTTimePeriodAnchorEnd size:DTTimePeriodSizeMinute amount:1]; -``` -This 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. - -#### Relationships - -There 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. - -Below is a chart of all the possible relationships between two time periods: -![TimePeriods](https://raw.githubusercontent.com/MatthewYork/Resources/master/DateTools/PeriodRelations.png) - -A suite of methods have been extended to check for the basic relationships. They are listed below: -* isEqualToPeriod: -* isInside: -* contains: -* overlapsWith: -* intersects: - -You can also check for the official relationship (like those shown in the chart) with the following method: -```objc --(DTTimePeriodRelation)relationToPeriod:(DTTimePeriod *)period; -``` -All of the possible relationships have been enumerated in the TimePeriodRelation enum. - -**For a better grasp on how time periods relate to one another, check out the "Time Periods" tab in the example application. Here you can slide a few time periods around and watch their relationships change.** - -![TimePeriods](https://raw.githubusercontent.com/MatthewYork/Resources/master/DateTools/TimePeriodsDemo.gif) - -## Time Period Groups - -Time period groups are the final abstraction of date and time in DateTools. Here, time periods are gathered and organized into something useful. There 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. - -Both collections and chains operate like an NSArray. You may add,insert and remove TimePeriod objects from them just as you would objects in an array. The difference is how these periods are handled under the hood. - -### Time Period Collections -Time 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. - -![TimePeriodCollections](https://raw.githubusercontent.com/MatthewYork/Resources/master/DateTools/TimePeriodCollection.png) - -To make a new collection, call the class method like so: - -```objc -//Create collection -DTTimePeriodCollection *collection = [DTTimePeriodCollection collection]; - -//Create a few time periods - DTTimePeriod *firstPeriod = [DTTimePeriod timePeriodWithStartDate:[dateFormatter dateFromString:@"2014 11 05 18:15:12.000"] endDate:[dateFormatter dateFromString:@"2015 11 05 18:15:12.000"]]; - DTTimePeriod *secondPeriod = [DTTimePeriod timePeriodWithStartDate:[dateFormatter dateFromString:@"2015 11 05 18:15:12.000"] endDate:[dateFormatter dateFromString:@"2016 11 05 18:15:12.000"]]; - -//Add time periods to the colleciton -[collection addTimePeriod:firstPeriod]; -[collection addTimePeriod:secondPeriod]; - -//Retreive collection items -DTTimePeriod *firstPeriod = collection[0]; -``` -**Sorting** -Sorting time periods in a collection is easy, just call one of the sort methods. There are a total of three sort options, listed below: -* **Start Date** - sortByStartAscending, sortByStartDescending -* **End Date** - sortByEndAscending, sortByEndDescending -* **Time Period Duration** - sortByDurationAscending, sortByDurationDescending - -**Operations** -It is also possible to check an Date's or TimePeriod's relationship to the collection. For 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. - -![TimePeriodCollectionOperations](https://raw.githubusercontent.com/MatthewYork/Resources/master/DateTools/TimePeriodCollectionOperations.png) - -### Time Period Chains -Time period chains serve as a tightly coupled set of time periods. They are always organized by start and end date, and have their own characteristics like a StartDate and EndDate that are extrapolated from the time periods within. Time period chains do not allow overlaps within their set of time periods. This type of group is ideal for modeling schedules like sequential meetings or appointments. - -![TimePeriodChains](https://raw.githubusercontent.com/MatthewYork/Resources/master/DateTools/TimePeriodChain.png) - -To make a new chain, call the class method like so: -```objc -//Create chain -DTTimePeriodChain *chain = [DTTimePeriodChain chain]; - -//Create a few time periods - DTTimePeriod *firstPeriod = [DTTimePeriod timePeriodWithStartDate:[dateFormatter dateFromString:@"2014 11 05 18:15:12.000"] endDate:[dateFormatter dateFromString:@"2015 11 05 18:15:12.000"]]; -DTTimePeriod *secondPeriod = [DTTimePeriod timePeriodWithStartDate:[dateFormatter dateFromString:@"2015 11 05 18:15:12.000"] endDate:[dateFormatter dateFromString:@"2016 11 05 18:15:12.000"]]; - -//Add test periods -[chain addTimePeriod:firstPeriod]; -[chain addTimePeriod:secondPeriod]; - -//Retreive chain items -DTTimePeriod *firstPeriod = chain[0]; -``` - -Any 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. - -**Operations** -Like collections, chains have an equality check and the ability to be shifted earlier and later. Here is a short list of other operations. - -![TimePeriodChainOperations](https://raw.githubusercontent.com/MatthewYork/Resources/master/DateTools/TimePeriodChainOperations.png) - -## Documentation -All 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! - -## Unit Tests - -Unit tests were performed on all the major classes in the library for quality assurance. You can find theses under the "Tests" folder at the top of the library. There are over 300 test cases in all! - -If you ever find a test case that is incomplete, please open an issue so we can get it fixed. - -Continuous integration testing is performed by Travis CI: [![Build Status](https://travis-ci.org/MatthewYork/DateTools.svg?branch=master)](https://travis-ci.org/MatthewYork/DateTools) - -## Credits - -Many thanks to [Grayson Webster](https://github.com/GraysonWebster) for helping rethink DateTools for Swift and crank out the necessary code! - -Thanks to [Kevin Lawler](https://github.com/kevinlawler) for his initial work on NSDate+TimeAgo. It laid the foundation for DateTools' timeAgo methods. You can find this great project [here](https://github.com/kevinlawler/NSDate-TimeAgo). - -Many thanks to the .NET team for their DateTime class and a major thank you to [Jani Giannoudis](http://www.codeproject.com/Members/Jani-Giannoudis) for his work on ITimePeriod. - -Images were first published through itenso.com through [Code Project](http://www.codeproject.com/Articles/168662/Time-Period-Library-for-NET) - -I would also like to thank **God** through whom all things live and move and have their being. [Acts 17:28](http://www.biblegateway.com/passage/?search=Acts+17%3A16-34&version=NIV) - -## License - -The MIT License (MIT) - -Copyright (c) 2014 Matthew York - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. +This is a fork of [MatthewYork's DateTools](https://github.com/MatthewYork/DateTools) library. It wasn't being maintained to the level I needed, which is absolutely fine, but I have a dependency on it in a couple of my older projects. So I simply forked it to adapt it to my needs. \ No newline at end of file diff --git a/DateToolsSwift/DateTools/Constants.swift b/Sources/DateToolsSwift/Constants.swift similarity index 100% rename from DateToolsSwift/DateTools/Constants.swift rename to Sources/DateToolsSwift/Constants.swift diff --git a/DateToolsSwift/DateTools/Date+Bundle.swift b/Sources/DateToolsSwift/Date+Bundle.swift similarity index 100% rename from DateToolsSwift/DateTools/Date+Bundle.swift rename to Sources/DateToolsSwift/Date+Bundle.swift diff --git a/DateToolsSwift/DateTools/Date+Comparators.swift b/Sources/DateToolsSwift/Date+Comparators.swift similarity index 100% rename from DateToolsSwift/DateTools/Date+Comparators.swift rename to Sources/DateToolsSwift/Date+Comparators.swift diff --git a/DateToolsSwift/DateTools/Date+Components.swift b/Sources/DateToolsSwift/Date+Components.swift similarity index 100% rename from DateToolsSwift/DateTools/Date+Components.swift rename to Sources/DateToolsSwift/Date+Components.swift diff --git a/DateToolsSwift/DateTools/Date+Format.swift b/Sources/DateToolsSwift/Date+Format.swift similarity index 100% rename from DateToolsSwift/DateTools/Date+Format.swift rename to Sources/DateToolsSwift/Date+Format.swift diff --git a/DateToolsSwift/DateTools/Date+Inits.swift b/Sources/DateToolsSwift/Date+Inits.swift similarity index 100% rename from DateToolsSwift/DateTools/Date+Inits.swift rename to Sources/DateToolsSwift/Date+Inits.swift diff --git a/DateToolsSwift/DateTools/Date+Manipulations.swift b/Sources/DateToolsSwift/Date+Manipulations.swift similarity index 100% rename from DateToolsSwift/DateTools/Date+Manipulations.swift rename to Sources/DateToolsSwift/Date+Manipulations.swift diff --git a/DateToolsSwift/DateTools/Date+TimeAgo.swift b/Sources/DateToolsSwift/Date+TimeAgo.swift similarity index 100% rename from DateToolsSwift/DateTools/Date+TimeAgo.swift rename to Sources/DateToolsSwift/Date+TimeAgo.swift diff --git a/DateTools/DateTools/DateTools.bundle/am.lproj/DateTools.strings b/Sources/DateToolsSwift/DateTools.bundle/am.lproj/DateTools.strings similarity index 100% rename from DateTools/DateTools/DateTools.bundle/am.lproj/DateTools.strings rename to Sources/DateToolsSwift/DateTools.bundle/am.lproj/DateTools.strings diff --git a/DateTools/DateTools/DateTools.bundle/ar.lproj/DateTools.strings b/Sources/DateToolsSwift/DateTools.bundle/ar.lproj/DateTools.strings similarity index 100% rename from DateTools/DateTools/DateTools.bundle/ar.lproj/DateTools.strings rename to Sources/DateToolsSwift/DateTools.bundle/ar.lproj/DateTools.strings diff --git a/DateTools/DateTools/DateTools.bundle/bg.lproj/DateTools.strings b/Sources/DateToolsSwift/DateTools.bundle/bg.lproj/DateTools.strings similarity index 100% rename from DateTools/DateTools/DateTools.bundle/bg.lproj/DateTools.strings rename to Sources/DateToolsSwift/DateTools.bundle/bg.lproj/DateTools.strings diff --git a/DateTools/DateTools/DateTools.bundle/ca.lproj/DateTools.strings b/Sources/DateToolsSwift/DateTools.bundle/ca.lproj/DateTools.strings similarity index 100% rename from DateTools/DateTools/DateTools.bundle/ca.lproj/DateTools.strings rename to Sources/DateToolsSwift/DateTools.bundle/ca.lproj/DateTools.strings diff --git a/DateTools/DateTools/DateTools.bundle/cs.lproj/DateTools.strings b/Sources/DateToolsSwift/DateTools.bundle/cs.lproj/DateTools.strings similarity index 100% rename from DateTools/DateTools/DateTools.bundle/cs.lproj/DateTools.strings rename to Sources/DateToolsSwift/DateTools.bundle/cs.lproj/DateTools.strings diff --git a/DateTools/DateTools/DateTools.bundle/cy.lproj/DateTools.strings b/Sources/DateToolsSwift/DateTools.bundle/cy.lproj/DateTools.strings similarity index 100% rename from DateTools/DateTools/DateTools.bundle/cy.lproj/DateTools.strings rename to Sources/DateToolsSwift/DateTools.bundle/cy.lproj/DateTools.strings diff --git a/DateTools/DateTools/DateTools.bundle/da.lproj/DateTools.strings b/Sources/DateToolsSwift/DateTools.bundle/da.lproj/DateTools.strings similarity index 100% rename from DateTools/DateTools/DateTools.bundle/da.lproj/DateTools.strings rename to Sources/DateToolsSwift/DateTools.bundle/da.lproj/DateTools.strings diff --git a/DateTools/DateTools/DateTools.bundle/de.lproj/DateTools.strings b/Sources/DateToolsSwift/DateTools.bundle/de.lproj/DateTools.strings similarity index 100% rename from DateTools/DateTools/DateTools.bundle/de.lproj/DateTools.strings rename to Sources/DateToolsSwift/DateTools.bundle/de.lproj/DateTools.strings diff --git a/DateTools/DateTools/DateTools.bundle/en.lproj/DateTools.strings b/Sources/DateToolsSwift/DateTools.bundle/en.lproj/DateTools.strings similarity index 100% rename from DateTools/DateTools/DateTools.bundle/en.lproj/DateTools.strings rename to Sources/DateToolsSwift/DateTools.bundle/en.lproj/DateTools.strings diff --git a/DateTools/DateTools/DateTools.bundle/es.lproj/DateTools.strings b/Sources/DateToolsSwift/DateTools.bundle/es.lproj/DateTools.strings similarity index 100% rename from DateTools/DateTools/DateTools.bundle/es.lproj/DateTools.strings rename to Sources/DateToolsSwift/DateTools.bundle/es.lproj/DateTools.strings diff --git a/DateTools/DateTools/DateTools.bundle/eu.lproj/DateTools.strings b/Sources/DateToolsSwift/DateTools.bundle/eu.lproj/DateTools.strings similarity index 100% rename from DateTools/DateTools/DateTools.bundle/eu.lproj/DateTools.strings rename to Sources/DateToolsSwift/DateTools.bundle/eu.lproj/DateTools.strings diff --git a/DateTools/DateTools/DateTools.bundle/fi.lproj/DateTools.strings b/Sources/DateToolsSwift/DateTools.bundle/fi.lproj/DateTools.strings similarity index 100% rename from DateTools/DateTools/DateTools.bundle/fi.lproj/DateTools.strings rename to Sources/DateToolsSwift/DateTools.bundle/fi.lproj/DateTools.strings diff --git a/DateTools/DateTools/DateTools.bundle/fr.lproj/DateTools.strings b/Sources/DateToolsSwift/DateTools.bundle/fr.lproj/DateTools.strings similarity index 100% rename from DateTools/DateTools/DateTools.bundle/fr.lproj/DateTools.strings rename to Sources/DateToolsSwift/DateTools.bundle/fr.lproj/DateTools.strings diff --git a/DateTools/DateTools/DateTools.bundle/gre.lproj/DateTools.strings b/Sources/DateToolsSwift/DateTools.bundle/gre.lproj/DateTools.strings similarity index 100% rename from DateTools/DateTools/DateTools.bundle/gre.lproj/DateTools.strings rename to Sources/DateToolsSwift/DateTools.bundle/gre.lproj/DateTools.strings diff --git a/DateTools/DateTools/DateTools.bundle/gu.lproj/DateTools.strings b/Sources/DateToolsSwift/DateTools.bundle/gu.lproj/DateTools.strings similarity index 100% rename from DateTools/DateTools/DateTools.bundle/gu.lproj/DateTools.strings rename to Sources/DateToolsSwift/DateTools.bundle/gu.lproj/DateTools.strings diff --git a/DateTools/DateTools/DateTools.bundle/he.lproj/DateTools.strings b/Sources/DateToolsSwift/DateTools.bundle/he.lproj/DateTools.strings similarity index 100% rename from DateTools/DateTools/DateTools.bundle/he.lproj/DateTools.strings rename to Sources/DateToolsSwift/DateTools.bundle/he.lproj/DateTools.strings diff --git a/DateTools/DateTools/DateTools.bundle/hi.lproj/DateTools.strings b/Sources/DateToolsSwift/DateTools.bundle/hi.lproj/DateTools.strings similarity index 100% rename from DateTools/DateTools/DateTools.bundle/hi.lproj/DateTools.strings rename to Sources/DateToolsSwift/DateTools.bundle/hi.lproj/DateTools.strings diff --git a/DateTools/DateTools/DateTools.bundle/hr.lproj/DateTools.strings b/Sources/DateToolsSwift/DateTools.bundle/hr.lproj/DateTools.strings similarity index 100% rename from DateTools/DateTools/DateTools.bundle/hr.lproj/DateTools.strings rename to Sources/DateToolsSwift/DateTools.bundle/hr.lproj/DateTools.strings diff --git a/DateTools/DateTools/DateTools.bundle/hu.lproj/DateTools.strings b/Sources/DateToolsSwift/DateTools.bundle/hu.lproj/DateTools.strings similarity index 100% rename from DateTools/DateTools/DateTools.bundle/hu.lproj/DateTools.strings rename to Sources/DateToolsSwift/DateTools.bundle/hu.lproj/DateTools.strings diff --git a/DateTools/DateTools/DateTools.bundle/id.lproj/DateTools.strings b/Sources/DateToolsSwift/DateTools.bundle/id.lproj/DateTools.strings similarity index 100% rename from DateTools/DateTools/DateTools.bundle/id.lproj/DateTools.strings rename to Sources/DateToolsSwift/DateTools.bundle/id.lproj/DateTools.strings diff --git a/DateTools/DateTools/DateTools.bundle/is.lproj/DateTools.strings b/Sources/DateToolsSwift/DateTools.bundle/is.lproj/DateTools.strings similarity index 100% rename from DateTools/DateTools/DateTools.bundle/is.lproj/DateTools.strings rename to Sources/DateToolsSwift/DateTools.bundle/is.lproj/DateTools.strings diff --git a/DateTools/DateTools/DateTools.bundle/it.lproj/DateTools.strings b/Sources/DateToolsSwift/DateTools.bundle/it.lproj/DateTools.strings similarity index 100% rename from DateTools/DateTools/DateTools.bundle/it.lproj/DateTools.strings rename to Sources/DateToolsSwift/DateTools.bundle/it.lproj/DateTools.strings diff --git a/DateTools/DateTools/DateTools.bundle/ja.lproj/DateTools.strings b/Sources/DateToolsSwift/DateTools.bundle/ja.lproj/DateTools.strings similarity index 100% rename from DateTools/DateTools/DateTools.bundle/ja.lproj/DateTools.strings rename to Sources/DateToolsSwift/DateTools.bundle/ja.lproj/DateTools.strings diff --git a/DateTools/DateTools/DateTools.bundle/ko.lproj/DateTools.strings b/Sources/DateToolsSwift/DateTools.bundle/ko.lproj/DateTools.strings similarity index 100% rename from DateTools/DateTools/DateTools.bundle/ko.lproj/DateTools.strings rename to Sources/DateToolsSwift/DateTools.bundle/ko.lproj/DateTools.strings diff --git a/DateTools/DateTools/DateTools.bundle/lv.lproj/DateTools.strings b/Sources/DateToolsSwift/DateTools.bundle/lv.lproj/DateTools.strings similarity index 100% rename from DateTools/DateTools/DateTools.bundle/lv.lproj/DateTools.strings rename to Sources/DateToolsSwift/DateTools.bundle/lv.lproj/DateTools.strings diff --git a/DateTools/DateTools/DateTools.bundle/ms.lproj/DateTools.strings b/Sources/DateToolsSwift/DateTools.bundle/ms.lproj/DateTools.strings similarity index 100% rename from DateTools/DateTools/DateTools.bundle/ms.lproj/DateTools.strings rename to Sources/DateToolsSwift/DateTools.bundle/ms.lproj/DateTools.strings diff --git a/DateTools/DateTools/DateTools.bundle/nb.lproj/DateTools.strings b/Sources/DateToolsSwift/DateTools.bundle/nb.lproj/DateTools.strings similarity index 100% rename from DateTools/DateTools/DateTools.bundle/nb.lproj/DateTools.strings rename to Sources/DateToolsSwift/DateTools.bundle/nb.lproj/DateTools.strings diff --git a/DateTools/DateTools/DateTools.bundle/nl.lproj/DateTools.strings b/Sources/DateToolsSwift/DateTools.bundle/nl.lproj/DateTools.strings similarity index 100% rename from DateTools/DateTools/DateTools.bundle/nl.lproj/DateTools.strings rename to Sources/DateToolsSwift/DateTools.bundle/nl.lproj/DateTools.strings diff --git a/DateTools/DateTools/DateTools.bundle/pl.lproj/DateTools.strings b/Sources/DateToolsSwift/DateTools.bundle/pl.lproj/DateTools.strings similarity index 100% rename from DateTools/DateTools/DateTools.bundle/pl.lproj/DateTools.strings rename to Sources/DateToolsSwift/DateTools.bundle/pl.lproj/DateTools.strings diff --git a/DateTools/DateTools/DateTools.bundle/pt-PT.lproj/DateTools.strings b/Sources/DateToolsSwift/DateTools.bundle/pt-PT.lproj/DateTools.strings similarity index 100% rename from DateTools/DateTools/DateTools.bundle/pt-PT.lproj/DateTools.strings rename to Sources/DateToolsSwift/DateTools.bundle/pt-PT.lproj/DateTools.strings diff --git a/DateTools/DateTools/DateTools.bundle/pt.lproj/DateTools.strings b/Sources/DateToolsSwift/DateTools.bundle/pt.lproj/DateTools.strings similarity index 100% rename from DateTools/DateTools/DateTools.bundle/pt.lproj/DateTools.strings rename to Sources/DateToolsSwift/DateTools.bundle/pt.lproj/DateTools.strings diff --git a/DateTools/DateTools/DateTools.bundle/ro.lproj/DateTools.strings b/Sources/DateToolsSwift/DateTools.bundle/ro.lproj/DateTools.strings similarity index 100% rename from DateTools/DateTools/DateTools.bundle/ro.lproj/DateTools.strings rename to Sources/DateToolsSwift/DateTools.bundle/ro.lproj/DateTools.strings diff --git a/DateTools/DateTools/DateTools.bundle/ru.lproj/DateTools.strings b/Sources/DateToolsSwift/DateTools.bundle/ru.lproj/DateTools.strings similarity index 100% rename from DateTools/DateTools/DateTools.bundle/ru.lproj/DateTools.strings rename to Sources/DateToolsSwift/DateTools.bundle/ru.lproj/DateTools.strings diff --git a/DateTools/DateTools/DateTools.bundle/sk.lproj/NSDateTimeAgo.strings b/Sources/DateToolsSwift/DateTools.bundle/sk.lproj/NSDateTimeAgo.strings similarity index 100% rename from DateTools/DateTools/DateTools.bundle/sk.lproj/NSDateTimeAgo.strings rename to Sources/DateToolsSwift/DateTools.bundle/sk.lproj/NSDateTimeAgo.strings diff --git a/DateTools/DateTools/DateTools.bundle/sl.lproj/DateTools.strings b/Sources/DateToolsSwift/DateTools.bundle/sl.lproj/DateTools.strings similarity index 100% rename from DateTools/DateTools/DateTools.bundle/sl.lproj/DateTools.strings rename to Sources/DateToolsSwift/DateTools.bundle/sl.lproj/DateTools.strings diff --git a/DateTools/DateTools/DateTools.bundle/sv.lproj/DateTools.strings b/Sources/DateToolsSwift/DateTools.bundle/sv.lproj/DateTools.strings similarity index 100% rename from DateTools/DateTools/DateTools.bundle/sv.lproj/DateTools.strings rename to Sources/DateToolsSwift/DateTools.bundle/sv.lproj/DateTools.strings diff --git a/DateTools/DateTools/DateTools.bundle/th.lproj/DateTools.strings b/Sources/DateToolsSwift/DateTools.bundle/th.lproj/DateTools.strings similarity index 100% rename from DateTools/DateTools/DateTools.bundle/th.lproj/DateTools.strings rename to Sources/DateToolsSwift/DateTools.bundle/th.lproj/DateTools.strings diff --git a/DateTools/DateTools/DateTools.bundle/tr.lproj/DateTools.strings b/Sources/DateToolsSwift/DateTools.bundle/tr.lproj/DateTools.strings similarity index 100% rename from DateTools/DateTools/DateTools.bundle/tr.lproj/DateTools.strings rename to Sources/DateToolsSwift/DateTools.bundle/tr.lproj/DateTools.strings diff --git a/DateTools/DateTools/DateTools.bundle/uk.lproj/DateTools.strings b/Sources/DateToolsSwift/DateTools.bundle/uk.lproj/DateTools.strings similarity index 100% rename from DateTools/DateTools/DateTools.bundle/uk.lproj/DateTools.strings rename to Sources/DateToolsSwift/DateTools.bundle/uk.lproj/DateTools.strings diff --git a/DateTools/DateTools/DateTools.bundle/vi.lproj/DateTools.strings b/Sources/DateToolsSwift/DateTools.bundle/vi.lproj/DateTools.strings similarity index 100% rename from DateTools/DateTools/DateTools.bundle/vi.lproj/DateTools.strings rename to Sources/DateToolsSwift/DateTools.bundle/vi.lproj/DateTools.strings diff --git a/DateTools/DateTools/DateTools.bundle/zh-Hans.lproj/DateTools.strings b/Sources/DateToolsSwift/DateTools.bundle/zh-Hans.lproj/DateTools.strings similarity index 100% rename from DateTools/DateTools/DateTools.bundle/zh-Hans.lproj/DateTools.strings rename to Sources/DateToolsSwift/DateTools.bundle/zh-Hans.lproj/DateTools.strings diff --git a/DateTools/DateTools/DateTools.bundle/zh-Hant.lproj/DateTools.strings b/Sources/DateToolsSwift/DateTools.bundle/zh-Hant.lproj/DateTools.strings similarity index 100% rename from DateTools/DateTools/DateTools.bundle/zh-Hant.lproj/DateTools.strings rename to Sources/DateToolsSwift/DateTools.bundle/zh-Hant.lproj/DateTools.strings diff --git a/DateToolsSwift/DateTools/Enums.swift b/Sources/DateToolsSwift/Enums.swift similarity index 100% rename from DateToolsSwift/DateTools/Enums.swift rename to Sources/DateToolsSwift/Enums.swift diff --git a/DateToolsSwift/DateTools/Integer+DateTools.swift b/Sources/DateToolsSwift/Integer+DateTools.swift similarity index 100% rename from DateToolsSwift/DateTools/Integer+DateTools.swift rename to Sources/DateToolsSwift/Integer+DateTools.swift diff --git a/DateToolsSwift/DateTools/TimeChunk.swift b/Sources/DateToolsSwift/TimeChunk.swift similarity index 100% rename from DateToolsSwift/DateTools/TimeChunk.swift rename to Sources/DateToolsSwift/TimeChunk.swift diff --git a/DateToolsSwift/DateTools/TimePeriod.swift b/Sources/DateToolsSwift/TimePeriod.swift similarity index 100% rename from DateToolsSwift/DateTools/TimePeriod.swift rename to Sources/DateToolsSwift/TimePeriod.swift diff --git a/DateToolsSwift/DateTools/TimePeriodChain.swift b/Sources/DateToolsSwift/TimePeriodChain.swift similarity index 100% rename from DateToolsSwift/DateTools/TimePeriodChain.swift rename to Sources/DateToolsSwift/TimePeriodChain.swift diff --git a/DateToolsSwift/DateTools/TimePeriodCollection.swift b/Sources/DateToolsSwift/TimePeriodCollection.swift similarity index 100% rename from DateToolsSwift/DateTools/TimePeriodCollection.swift rename to Sources/DateToolsSwift/TimePeriodCollection.swift diff --git a/DateToolsSwift/DateTools/TimePeriodGroup.swift b/Sources/DateToolsSwift/TimePeriodGroup.swift similarity index 100% rename from DateToolsSwift/DateTools/TimePeriodGroup.swift rename to Sources/DateToolsSwift/TimePeriodGroup.swift diff --git a/DateToolsSwift/Examples/DateToolsExample/DateToolsExample.xcodeproj/project.pbxproj b/Sources/Examples/DateToolsExample/DateToolsExample.xcodeproj/project.pbxproj similarity index 100% rename from DateToolsSwift/Examples/DateToolsExample/DateToolsExample.xcodeproj/project.pbxproj rename to Sources/Examples/DateToolsExample/DateToolsExample.xcodeproj/project.pbxproj diff --git a/DateTools/Examples/DateToolsExample/DateToolsExample.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/Sources/Examples/DateToolsExample/DateToolsExample.xcodeproj/project.xcworkspace/contents.xcworkspacedata similarity index 100% rename from DateTools/Examples/DateToolsExample/DateToolsExample.xcodeproj/project.xcworkspace/contents.xcworkspacedata rename to Sources/Examples/DateToolsExample/DateToolsExample.xcodeproj/project.xcworkspace/contents.xcworkspacedata diff --git a/DateToolsSwift/Examples/DateToolsExample/DateToolsExample.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/Sources/Examples/DateToolsExample/DateToolsExample.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist similarity index 100% rename from DateToolsSwift/Examples/DateToolsExample/DateToolsExample.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist rename to Sources/Examples/DateToolsExample/DateToolsExample.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist diff --git a/DateToolsSwift/Examples/DateToolsExample/DateToolsExample/AppDelegate.swift b/Sources/Examples/DateToolsExample/DateToolsExample/AppDelegate.swift similarity index 100% rename from DateToolsSwift/Examples/DateToolsExample/DateToolsExample/AppDelegate.swift rename to Sources/Examples/DateToolsExample/DateToolsExample/AppDelegate.swift diff --git a/DateToolsSwift/Examples/DateToolsExample/DateToolsExample/Assets.xcassets/AppIcon.appiconset/Contents.json b/Sources/Examples/DateToolsExample/DateToolsExample/Assets.xcassets/AppIcon.appiconset/Contents.json similarity index 100% rename from DateToolsSwift/Examples/DateToolsExample/DateToolsExample/Assets.xcassets/AppIcon.appiconset/Contents.json rename to Sources/Examples/DateToolsExample/DateToolsExample/Assets.xcassets/AppIcon.appiconset/Contents.json diff --git a/DateToolsSwift/Examples/DateToolsExample/DateToolsExample/Assets.xcassets/first.imageset/Contents.json b/Sources/Examples/DateToolsExample/DateToolsExample/Assets.xcassets/first.imageset/Contents.json similarity index 100% rename from DateToolsSwift/Examples/DateToolsExample/DateToolsExample/Assets.xcassets/first.imageset/Contents.json rename to Sources/Examples/DateToolsExample/DateToolsExample/Assets.xcassets/first.imageset/Contents.json diff --git a/DateToolsSwift/Examples/DateToolsExample/DateToolsExample/Assets.xcassets/first.imageset/first.pdf b/Sources/Examples/DateToolsExample/DateToolsExample/Assets.xcassets/first.imageset/first.pdf similarity index 100% rename from DateToolsSwift/Examples/DateToolsExample/DateToolsExample/Assets.xcassets/first.imageset/first.pdf rename to Sources/Examples/DateToolsExample/DateToolsExample/Assets.xcassets/first.imageset/first.pdf diff --git a/DateToolsSwift/Examples/DateToolsExample/DateToolsExample/Assets.xcassets/second.imageset/Contents.json b/Sources/Examples/DateToolsExample/DateToolsExample/Assets.xcassets/second.imageset/Contents.json similarity index 100% rename from DateToolsSwift/Examples/DateToolsExample/DateToolsExample/Assets.xcassets/second.imageset/Contents.json rename to Sources/Examples/DateToolsExample/DateToolsExample/Assets.xcassets/second.imageset/Contents.json diff --git a/DateToolsSwift/Examples/DateToolsExample/DateToolsExample/Assets.xcassets/second.imageset/second.pdf b/Sources/Examples/DateToolsExample/DateToolsExample/Assets.xcassets/second.imageset/second.pdf similarity index 100% rename from DateToolsSwift/Examples/DateToolsExample/DateToolsExample/Assets.xcassets/second.imageset/second.pdf rename to Sources/Examples/DateToolsExample/DateToolsExample/Assets.xcassets/second.imageset/second.pdf diff --git a/DateToolsSwift/Examples/DateToolsExample/DateToolsExample/Base.lproj/LaunchScreen.storyboard b/Sources/Examples/DateToolsExample/DateToolsExample/Base.lproj/LaunchScreen.storyboard similarity index 100% rename from DateToolsSwift/Examples/DateToolsExample/DateToolsExample/Base.lproj/LaunchScreen.storyboard rename to Sources/Examples/DateToolsExample/DateToolsExample/Base.lproj/LaunchScreen.storyboard diff --git a/DateToolsSwift/Examples/DateToolsExample/DateToolsExample/Base.lproj/Main.storyboard b/Sources/Examples/DateToolsExample/DateToolsExample/Base.lproj/Main.storyboard similarity index 100% rename from DateToolsSwift/Examples/DateToolsExample/DateToolsExample/Base.lproj/Main.storyboard rename to Sources/Examples/DateToolsExample/DateToolsExample/Base.lproj/Main.storyboard diff --git a/DateToolsSwift/Examples/DateToolsExample/DateToolsExample/ExtensionsViewController.swift b/Sources/Examples/DateToolsExample/DateToolsExample/ExtensionsViewController.swift similarity index 100% rename from DateToolsSwift/Examples/DateToolsExample/DateToolsExample/ExtensionsViewController.swift rename to Sources/Examples/DateToolsExample/DateToolsExample/ExtensionsViewController.swift diff --git a/DateToolsSwift/Examples/DateToolsExample/DateToolsExample/Info.plist b/Sources/Examples/DateToolsExample/DateToolsExample/Info.plist similarity index 100% rename from DateToolsSwift/Examples/DateToolsExample/DateToolsExample/Info.plist rename to Sources/Examples/DateToolsExample/DateToolsExample/Info.plist diff --git a/DateToolsSwift/Examples/DateToolsExample/DateToolsExample/TimePeriodsViewController.swift b/Sources/Examples/DateToolsExample/DateToolsExample/TimePeriodsViewController.swift similarity index 100% rename from DateToolsSwift/Examples/DateToolsExample/DateToolsExample/TimePeriodsViewController.swift rename to Sources/Examples/DateToolsExample/DateToolsExample/TimePeriodsViewController.swift diff --git a/DateToolsSwift/Examples/DateToolsExample/DateToolsExampleTests/DateToolsExampleTests.swift b/Sources/Examples/DateToolsExample/DateToolsExampleTests/DateToolsExampleTests.swift similarity index 100% rename from DateToolsSwift/Examples/DateToolsExample/DateToolsExampleTests/DateToolsExampleTests.swift rename to Sources/Examples/DateToolsExample/DateToolsExampleTests/DateToolsExampleTests.swift diff --git a/DateToolsSwift/Examples/DateToolsExample/DateToolsExampleTests/Info.plist b/Sources/Examples/DateToolsExample/DateToolsExampleTests/Info.plist similarity index 100% rename from DateToolsSwift/Examples/DateToolsExample/DateToolsExampleTests/Info.plist rename to Sources/Examples/DateToolsExample/DateToolsExampleTests/Info.plist diff --git a/DateToolsSwift/Examples/DateToolsExample/DateToolsExampleUITests/DateToolsExampleUITests.swift b/Sources/Examples/DateToolsExample/DateToolsExampleUITests/DateToolsExampleUITests.swift similarity index 100% rename from DateToolsSwift/Examples/DateToolsExample/DateToolsExampleUITests/DateToolsExampleUITests.swift rename to Sources/Examples/DateToolsExample/DateToolsExampleUITests/DateToolsExampleUITests.swift diff --git a/DateToolsSwift/Examples/DateToolsExample/DateToolsExampleUITests/Info.plist b/Sources/Examples/DateToolsExample/DateToolsExampleUITests/Info.plist similarity index 100% rename from DateToolsSwift/Examples/DateToolsExample/DateToolsExampleUITests/Info.plist rename to Sources/Examples/DateToolsExample/DateToolsExampleUITests/Info.plist diff --git a/DateToolsSwift/Tests/DateToolsTests/DateToolsTests.xcodeproj/project.pbxproj b/Sources/Tests/DateToolsTests/DateToolsTests.xcodeproj/project.pbxproj similarity index 100% rename from DateToolsSwift/Tests/DateToolsTests/DateToolsTests.xcodeproj/project.pbxproj rename to Sources/Tests/DateToolsTests/DateToolsTests.xcodeproj/project.pbxproj diff --git a/DateTools/Tests/DateToolsTests/DateToolsTests.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/Sources/Tests/DateToolsTests/DateToolsTests.xcodeproj/project.xcworkspace/contents.xcworkspacedata similarity index 100% rename from DateTools/Tests/DateToolsTests/DateToolsTests.xcodeproj/project.xcworkspace/contents.xcworkspacedata rename to Sources/Tests/DateToolsTests/DateToolsTests.xcodeproj/project.xcworkspace/contents.xcworkspacedata diff --git a/DateToolsSwift/Tests/DateToolsTests/DateToolsTests/AppDelegate.swift b/Sources/Tests/DateToolsTests/DateToolsTests/AppDelegate.swift similarity index 100% rename from DateToolsSwift/Tests/DateToolsTests/DateToolsTests/AppDelegate.swift rename to Sources/Tests/DateToolsTests/DateToolsTests/AppDelegate.swift diff --git a/DateToolsSwift/Tests/DateToolsTests/DateToolsTests/Assets.xcassets/AppIcon.appiconset/Contents.json b/Sources/Tests/DateToolsTests/DateToolsTests/Assets.xcassets/AppIcon.appiconset/Contents.json similarity index 100% rename from DateToolsSwift/Tests/DateToolsTests/DateToolsTests/Assets.xcassets/AppIcon.appiconset/Contents.json rename to Sources/Tests/DateToolsTests/DateToolsTests/Assets.xcassets/AppIcon.appiconset/Contents.json diff --git a/DateToolsSwift/Tests/DateToolsTests/DateToolsTests/Base.lproj/LaunchScreen.storyboard b/Sources/Tests/DateToolsTests/DateToolsTests/Base.lproj/LaunchScreen.storyboard similarity index 100% rename from DateToolsSwift/Tests/DateToolsTests/DateToolsTests/Base.lproj/LaunchScreen.storyboard rename to Sources/Tests/DateToolsTests/DateToolsTests/Base.lproj/LaunchScreen.storyboard diff --git a/DateToolsSwift/Tests/DateToolsTests/DateToolsTests/Base.lproj/Main.storyboard b/Sources/Tests/DateToolsTests/DateToolsTests/Base.lproj/Main.storyboard similarity index 100% rename from DateToolsSwift/Tests/DateToolsTests/DateToolsTests/Base.lproj/Main.storyboard rename to Sources/Tests/DateToolsTests/DateToolsTests/Base.lproj/Main.storyboard diff --git a/DateToolsSwift/Tests/DateToolsTests/DateToolsTests/Info.plist b/Sources/Tests/DateToolsTests/DateToolsTests/Info.plist similarity index 100% rename from DateToolsSwift/Tests/DateToolsTests/DateToolsTests/Info.plist rename to Sources/Tests/DateToolsTests/DateToolsTests/Info.plist diff --git a/DateToolsSwift/Tests/DateToolsTests/DateToolsTests/ViewController.swift b/Sources/Tests/DateToolsTests/DateToolsTests/ViewController.swift similarity index 100% rename from DateToolsSwift/Tests/DateToolsTests/DateToolsTests/ViewController.swift rename to Sources/Tests/DateToolsTests/DateToolsTests/ViewController.swift diff --git a/DateToolsSwift/Tests/DateToolsTests/DateToolsTestsTests/DateComparatorsExtensionTests.swift b/Sources/Tests/DateToolsTests/DateToolsTestsTests/DateComparatorsExtensionTests.swift similarity index 100% rename from DateToolsSwift/Tests/DateToolsTests/DateToolsTestsTests/DateComparatorsExtensionTests.swift rename to Sources/Tests/DateToolsTests/DateToolsTestsTests/DateComparatorsExtensionTests.swift diff --git a/DateToolsSwift/Tests/DateToolsTests/DateToolsTestsTests/DateComponentsExtensionTests.swift b/Sources/Tests/DateToolsTests/DateToolsTestsTests/DateComponentsExtensionTests.swift similarity index 100% rename from DateToolsSwift/Tests/DateToolsTests/DateToolsTestsTests/DateComponentsExtensionTests.swift rename to Sources/Tests/DateToolsTests/DateToolsTestsTests/DateComponentsExtensionTests.swift diff --git a/DateToolsSwift/Tests/DateToolsTests/DateToolsTestsTests/DateFormatExtensionTests.swift b/Sources/Tests/DateToolsTests/DateToolsTestsTests/DateFormatExtensionTests.swift similarity index 100% rename from DateToolsSwift/Tests/DateToolsTests/DateToolsTestsTests/DateFormatExtensionTests.swift rename to Sources/Tests/DateToolsTests/DateToolsTestsTests/DateFormatExtensionTests.swift diff --git a/DateToolsSwift/Tests/DateToolsTests/DateToolsTestsTests/DateInitsExtensionTests.swift b/Sources/Tests/DateToolsTests/DateToolsTestsTests/DateInitsExtensionTests.swift similarity index 100% rename from DateToolsSwift/Tests/DateToolsTests/DateToolsTestsTests/DateInitsExtensionTests.swift rename to Sources/Tests/DateToolsTests/DateToolsTestsTests/DateInitsExtensionTests.swift diff --git a/DateToolsSwift/Tests/DateToolsTests/DateToolsTestsTests/DateManipulationsExtensionTests.swift b/Sources/Tests/DateToolsTests/DateToolsTestsTests/DateManipulationsExtensionTests.swift similarity index 100% rename from DateToolsSwift/Tests/DateToolsTests/DateToolsTestsTests/DateManipulationsExtensionTests.swift rename to Sources/Tests/DateToolsTests/DateToolsTestsTests/DateManipulationsExtensionTests.swift diff --git a/DateToolsSwift/Tests/DateToolsTests/DateToolsTestsTests/DateTimeAgoExtensionTests.swift b/Sources/Tests/DateToolsTests/DateToolsTestsTests/DateTimeAgoExtensionTests.swift similarity index 100% rename from DateToolsSwift/Tests/DateToolsTests/DateToolsTestsTests/DateTimeAgoExtensionTests.swift rename to Sources/Tests/DateToolsTests/DateToolsTestsTests/DateTimeAgoExtensionTests.swift diff --git a/DateToolsSwift/Tests/DateToolsTests/DateToolsTestsTests/Info.plist b/Sources/Tests/DateToolsTests/DateToolsTestsTests/Info.plist similarity index 100% rename from DateToolsSwift/Tests/DateToolsTests/DateToolsTestsTests/Info.plist rename to Sources/Tests/DateToolsTests/DateToolsTestsTests/Info.plist diff --git a/DateToolsSwift/Tests/DateToolsTests/DateToolsTestsTests/IntegerExtensionTests.swift b/Sources/Tests/DateToolsTests/DateToolsTestsTests/IntegerExtensionTests.swift similarity index 100% rename from DateToolsSwift/Tests/DateToolsTests/DateToolsTestsTests/IntegerExtensionTests.swift rename to Sources/Tests/DateToolsTests/DateToolsTestsTests/IntegerExtensionTests.swift diff --git a/DateToolsSwift/Tests/DateToolsTests/DateToolsTestsTests/TimeAgoTests.swift b/Sources/Tests/DateToolsTests/DateToolsTestsTests/TimeAgoTests.swift similarity index 100% rename from DateToolsSwift/Tests/DateToolsTests/DateToolsTestsTests/TimeAgoTests.swift rename to Sources/Tests/DateToolsTests/DateToolsTestsTests/TimeAgoTests.swift diff --git a/DateToolsSwift/Tests/DateToolsTests/DateToolsTestsTests/TimeChunkTests.swift b/Sources/Tests/DateToolsTests/DateToolsTestsTests/TimeChunkTests.swift similarity index 100% rename from DateToolsSwift/Tests/DateToolsTests/DateToolsTestsTests/TimeChunkTests.swift rename to Sources/Tests/DateToolsTests/DateToolsTestsTests/TimeChunkTests.swift diff --git a/DateToolsSwift/Tests/DateToolsTests/DateToolsTestsTests/TimePeriodChainTests.swift b/Sources/Tests/DateToolsTests/DateToolsTestsTests/TimePeriodChainTests.swift similarity index 100% rename from DateToolsSwift/Tests/DateToolsTests/DateToolsTestsTests/TimePeriodChainTests.swift rename to Sources/Tests/DateToolsTests/DateToolsTestsTests/TimePeriodChainTests.swift diff --git a/DateToolsSwift/Tests/DateToolsTests/DateToolsTestsTests/TimePeriodCollection.swift b/Sources/Tests/DateToolsTests/DateToolsTestsTests/TimePeriodCollection.swift similarity index 100% rename from DateToolsSwift/Tests/DateToolsTests/DateToolsTestsTests/TimePeriodCollection.swift rename to Sources/Tests/DateToolsTests/DateToolsTestsTests/TimePeriodCollection.swift diff --git a/DateToolsSwift/Tests/DateToolsTests/DateToolsTestsTests/TimePeriodCollectionTests.swift b/Sources/Tests/DateToolsTests/DateToolsTestsTests/TimePeriodCollectionTests.swift similarity index 100% rename from DateToolsSwift/Tests/DateToolsTests/DateToolsTestsTests/TimePeriodCollectionTests.swift rename to Sources/Tests/DateToolsTests/DateToolsTestsTests/TimePeriodCollectionTests.swift diff --git a/DateToolsSwift/Tests/DateToolsTests/DateToolsTestsTests/TimePeriodGroupTests.swift b/Sources/Tests/DateToolsTests/DateToolsTestsTests/TimePeriodGroupTests.swift similarity index 100% rename from DateToolsSwift/Tests/DateToolsTests/DateToolsTestsTests/TimePeriodGroupTests.swift rename to Sources/Tests/DateToolsTests/DateToolsTestsTests/TimePeriodGroupTests.swift diff --git a/DateToolsSwift/Tests/DateToolsTests/DateToolsTestsTests/TimePeriodTests.swift b/Sources/Tests/DateToolsTests/DateToolsTestsTests/TimePeriodTests.swift similarity index 100% rename from DateToolsSwift/Tests/DateToolsTests/DateToolsTestsTests/TimePeriodTests.swift rename to Sources/Tests/DateToolsTests/DateToolsTestsTests/TimePeriodTests.swift diff --git a/DateToolsSwift/doc_gen.sh b/Sources/doc_gen.sh similarity index 100% rename from DateToolsSwift/doc_gen.sh rename to Sources/doc_gen.sh