Skip to content

Commit

Permalink
conditional for rangeAt or range(at
Browse files Browse the repository at this point in the history
  • Loading branch information
evermeer committed Jan 4, 2018
1 parent cf41b84 commit 32c31f7
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion EVReflection.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = "EVReflection"
s.version = "5.4.1"
s.version = "5.4.2"
s.summary = "Reflection based object mapping. (Dictionary, CKRecord, NSManagedObject, Realm, JSON, XML, Alamofire, Moya, RxSwift, ReactiveSwift)"

s.description = <<-EOS
Expand Down
Binary file not shown.
7 changes: 6 additions & 1 deletion Source/EVReflection.swift
Original file line number Diff line number Diff line change
Expand Up @@ -1582,7 +1582,12 @@ extension Date {
return nil
}

let dateString = (fromDateTimeString as NSString).substring(with: match.range(at: 1)) // Extract milliseconds
#if swift(>=4.0)
let dateString = (fromDateTimeString as NSString).substring(with: match.range(at: 1)) // Extract milliseconds
#else
let dateString = (fromDateTimeString as NSString).substring(with: match.rangeAt(1)) // Extract milliseconds
#endif

let timeStamp = Double(dateString)! / 1000.0 // Convert to UNIX timestamp in seconds

self.init(timeIntervalSince1970: timeStamp) // Create Date from timestamp
Expand Down

0 comments on commit 32c31f7

Please sign in to comment.