Package for Objective-C DateTools library. Parse, validate, manipulate, and display dates, time and timezones
Thank you, Matthew York and community for awesome library. You can find original repo/docs here. This package was created because I need Carthage support and distinguish between Swift and Objective-C implementation. Swift ABI not stable (yet) and I do not want to spend time to recompile binaries every time new Swift version come. Objective-C API works perfectly fine.
This is hard fork of original repo. This means there is no guarantee that codebase will fully reflect original repo.
// Just example.
DTTimePeriod *periodA = [[DTTimePeriod alloc] initWithStartDate:request.startDate endDate:request.endDate];
DTTimePeriod *periodB = [[DTTimePeriod alloc] initWithStartDate:requestB.startDate endDate:requestB.endDate];
//Magic here
if ([periodA overlapsWith:periodB]) {
NSLog(@"Is it cool?");
}
.package(url: "https://github.com/3a4oT/DateToolsObjC", .upToNextMajor(from: "1.0.5"))
github "3a4oT/DateToolsObjC"
carthage build 3a4oT/DateToolsObjC
DateToolsObjC.framework
to your target*.h/*.m
just @import DateToolsObjC;
Well, technically yes. But…=) it will work for NSDate and not for Date out the box. You will ask why? Shorty - NSDate and Date are two different types (some more food). Don’t be confused about other thing you may hear that’s different. So far you have 3 option to go with
Cast Date to NSDate and back:
import DateToolsObjC
let today: NSDate = Date() as NSDate
//usage in DateToolsAPI return NSDate cast back if you need.
let result: Date = today.timeAgo() as Date
DateToolsObjC API
which will cast NSDate to Date for you.Copyright (c) 2017 Petro Rovenskyi
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.