Skip to content

Commit 36ee1de

Browse files
author
Matthew York
committed
Merge branch 'pr/162' into swift
# Conflicts: # DateTools/Date+TimeAgo.swift
2 parents 3baa87c + d2b072e commit 36ee1de

15 files changed

Lines changed: 35 additions & 41 deletions

DateTools.podspec

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Pod::Spec.new do |s|
22
s.name = 'DateTools'
3-
s.version = '1.7.0'
3+
s.version = '2.0.0-beta.1'
44
s.summary = 'Dates and time made easy in Objective-C'
55
s.homepage = 'https://github.com/MatthewYork/DateTools'
66

@@ -12,8 +12,8 @@ Pod::Spec.new do |s|
1212
s.source = { :git => "https://github.com/MatthewYork/DateTools.git",
1313
:tag => "v#{s.version.to_s}" }
1414

15-
s.ios.platform = :ios, '7.0'
16-
s.osx.platform = :iox, '10.7'
15+
s.ios.deployment_target = '7.0'
16+
s.osx.deployment_target = '10.7'
1717
s.requires_arc = true
1818

1919
s.source_files = 'DateTools'

DateTools/Date+Comparators.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
import Foundation
1010

11-
extension Date {
11+
public extension Date {
1212

1313
// MARK: - Addition / Subtractions
1414

DateTools/Date+Components.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
import Foundation
1010

11-
extension Date {
11+
public extension Date {
1212
func component(_ component: Calendar.Component, from date: Date) -> Int {
1313
let calendar = Calendar.autoupdatingCurrent
1414
return calendar.component(component, from: date)

DateTools/Date+DateTools.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import Foundation
1212

1313
*/
1414

15-
extension Date {
15+
public extension Date {
1616

1717
// MARK: - Initializers
1818

DateTools/Date+Format.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
import Foundation
1010

11-
extension Date {
11+
public extension Date {
1212

1313
// MARK: - Formatted Date - Style
1414

DateTools/Date+TimeAgo.swift

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
import Foundation
1010

11-
extension Date {
11+
public extension Date {
1212

1313

1414
//MARK: - Time Ago
@@ -56,16 +56,8 @@ extension Date {
5656
var shortTimeAgoSinceNow: String {
5757
return self.shortTimeAgo(since:Date())
5858
}
59-
60-
func timeAgo(since date: Date) -> String {
61-
return self.timeAgo(since: date, numericDates:false)
62-
}
63-
64-
func timeAgo(since date: Date, numericDates: Bool) -> String {
65-
return self.timeAgo(since: date, numericDates: numericDates, numericTimes:false)
66-
}
6759

68-
func timeAgo(since date: Date, numericDates: Bool, numericTimes: Bool) -> String {
60+
func timeAgo(since date:Date, numericDates: Bool = false, numericTimes: Bool = false) -> String {
6961
let calendar = NSCalendar.current
7062
let unitFlags = Set<Calendar.Component>([.second,.minute,.hour,.day,.weekOfYear,.month,.year])
7163
let earliest = self.earlierDate(date)
@@ -202,12 +194,14 @@ extension Date {
202194
}
203195
}
204196

205-
internal func logicalLocalizedStringFromFormat(format: String, value: Int) -> String{
197+
198+
private func logicalLocalizedStringFromFormat(format: String, value: Int) -> String{
206199
let localeFormat = String.init(format: format, getLocaleFormatUnderscoresWithValue(Double(value)))
207200
return String.init(format: DateToolsLocalizedStrings(localeFormat), value)
208201
}
209202

210-
internal func getLocaleFormatUnderscoresWithValue(_ value: Double) -> String{
203+
204+
private func getLocaleFormatUnderscoresWithValue(_ value: Double) -> String{
211205
let localCode = Bundle.main.preferredLocalizations[0]
212206
if (localCode == "ru" || localCode == "uk") {
213207
let XY = Int(floor(value).truncatingRemainder(dividingBy: 100))

DateTools/Enums.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
Further reading: [GitHub](https://github.com/MatthewYork/DateTools#relationships), [CodeProject](http://www.codeproject.com/Articles/168662/Time-Period-Library-for-NET)
1515
*/
16-
enum Relation {
16+
public enum Relation {
1717
case after
1818
case startTouching
1919
case startInside
@@ -38,15 +38,15 @@ enum Relation {
3838

3939
Open: The boundary moment of time represents a boundary value which is excluded in regard to calculations.
4040
*/
41-
enum Interval {
41+
public enum Interval {
4242
case open
4343
case closed
4444
}
4545

4646
/**
4747
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.
4848
*/
49-
enum Anchor {
49+
public enum Anchor {
5050
case beginning
5151
case center
5252
case end

DateTools/Integer+DateTools.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
import Foundation
1010

11-
extension Int {
11+
public extension Int {
1212

1313
//MARK: TimePeriod
1414
var seconds: TimeChunk {

DateTools/String+DateTools.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
import UIKit
1010

11-
extension String {
11+
public extension String {
1212
init(_ date: Date) {
1313
self = "\(date)"
1414
}

DateTools/TimeChunk.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
import Foundation
1010

11-
struct TimeChunk {
11+
public struct TimeChunk {
1212

1313
// MARK: - Variables
1414

0 commit comments

Comments
 (0)