Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mattt/CupertinoYankee
An NSDate Category With Locale-Aware Calculations for Beginning & End of Day, Week, Month, and Year
https://github.com/mattt/CupertinoYankee
Last synced: 3 months ago
JSON representation
An NSDate Category With Locale-Aware Calculations for Beginning & End of Day, Week, Month, and Year
- Host: GitHub
- URL: https://github.com/mattt/CupertinoYankee
- Owner: mattt
- License: mit
- Archived: true
- Created: 2012-04-17T06:15:42.000Z (over 12 years ago)
- Default Branch: master
- Last Pushed: 2019-06-13T16:45:13.000Z (over 5 years ago)
- Last Synced: 2024-07-14T03:01:37.153Z (4 months ago)
- Language: Objective-C
- Homepage:
- Size: 37.1 KB
- Stars: 304
- Watchers: 10
- Forks: 24
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
- awesome - CupertinoYankee - An NSDate Category With Locale-Aware Calculations for Beginning & End of Day, Week, Month, and Year (etc)
- awesome - CupertinoYankee - An NSDate Category With Locale-Aware Calculations for Beginning & End of Day, Week, Month, and Year (etc)
README
# A Cupertino Yankee in Scott Forstall's Court
**An NSDate Category With Locale-Aware Calculations for Beginning & End of Day, Week, Month, and Year**
> This library is no longer maintained.
> In iOS 7.0+ and macOS 10.9+,
> use [`Calendar.range(of:in:for:)`](https://developer.apple.com/documentation/foundation/calendar/2293059-range) instead.## Usage
```objective-c
NSLog(@"Current Time: %@", date);
NSLog(@"Beginning of Day:%@", [date beginningOfDay]);
NSLog(@"End of Day:%@", [date endOfDay]);
NSLog(@"Beginning of Week:%@", [date beginningOfWeek]);
NSLog(@"End of Week:%@", [date endOfWeek]);
NSLog(@"Beginning of Month:%@", [date beginningOfMonth]);
NSLog(@"End of Month:%@", [date endOfMonth]);
NSLog(@"Beginning of Year:%@", [date beginningOfYear]);
NSLog(@"End of Year:%@", [date endOfYear]);
```Result (Note the Time Zone and Daylight Savings Offsets)
```
Current Time: 2013-10-19 13:29:26 +0000
Beginning of Day: 2013-10-18 22:00:00 +0000
End of Day: 2013-10-19 21:59:59 +0000
Beginning of Week: 2013-10-12 22:00:00 +0000
End of Week: 2013-10-19 21:59:59 +0000
Beginning of Month: 2013-09-30 22:00:00 +0000
End of Month: 2013-10-31 22:59:59 +0000
Beginning of Year: 2012-12-31 23:00:00 +0000
End of Year: 2013-12-31 22:59:59 +0000
```## License
MIT
## Contact
Mattt ([@mattt](https://twitter.com/mattt))