commit | author | age
|
655e66
|
1 |
/* |
H |
2 |
* Copyright (C) 2017 Twitter, Inc. |
|
3 |
* |
|
4 |
* Licensed under the Apache License, Version 2.0 (the "License"); |
|
5 |
* you may not use this file except in compliance with the License. |
|
6 |
* You may obtain a copy of the License at |
|
7 |
* |
|
8 |
* http://www.apache.org/licenses/LICENSE-2.0 |
|
9 |
* |
|
10 |
* Unless required by applicable law or agreed to in writing, software |
|
11 |
* distributed under the License is distributed on an "AS IS" BASIS, |
|
12 |
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
13 |
* See the License for the specific language governing permissions and |
|
14 |
* limitations under the License. |
|
15 |
* |
|
16 |
*/ |
|
17 |
|
|
18 |
/** |
|
19 |
This header is private to the Twitter Core SDK and not exposed for public SDK consumption |
|
20 |
*/ |
a0a843
|
21 |
|
H |
22 |
#import <Foundation/Foundation.h> |
|
23 |
|
|
24 |
@interface TWTRDateUtil : NSObject |
|
25 |
|
|
26 |
/** |
|
27 |
* Determines whether the given date is in the current year. |
|
28 |
* |
|
29 |
* @param date the date to determine whether this is in the current year |
|
30 |
* |
|
31 |
* @return whether the date is in the current year |
|
32 |
*/ |
|
33 |
+ (BOOL)isDateInCurrentYear:(NSDate *)date; |
|
34 |
|
|
35 |
/** |
|
36 |
* String suitable for reading out in accessibility label of timestamp. |
|
37 |
* |
|
38 |
* @param date The date to be read out |
|
39 |
* |
|
40 |
* @return The string suitable for reading by VoiceOver |
|
41 |
*/ |
|
42 |
+ (NSString *)accessibilityTextForDate:(NSDate *)date; |
|
43 |
|
|
44 |
/** |
|
45 |
* Checks if two dates are within a certain interval of each other. |
|
46 |
* |
|
47 |
* @param date the future date |
|
48 |
* @param interval time interval to check for |
|
49 |
* @param fromDate the older date to check against |
|
50 |
* |
|
51 |
* @return true if date - fromDate is <= interval |
|
52 |
*/ |
|
53 |
+ (BOOL)isDate:(NSDate *)date withinInterval:(NSTimeInterval)interval fromDate:(NSDate *)fromDate; |
|
54 |
|
|
55 |
/** |
|
56 |
* Checks if two dates are within the same calendar day in UTC. |
|
57 |
* |
|
58 |
* @param date a date |
|
59 |
* @param date2 another date |
|
60 |
* |
|
61 |
* @return true if two dates are within the same calendar day |
|
62 |
*/ |
|
63 |
+ (BOOL)date:(NSDate *)date isWithinSameUTCDayAsDate:(NSDate *)date2; |
|
64 |
|
|
65 |
/** |
|
66 |
* Returns a new date of the specified time in UTC. |
|
67 |
* |
|
68 |
* @param year the 4-digit year e.g. YYYY |
|
69 |
* @param month the month within the year e.g. 1 for Jan, 11 for Nov |
|
70 |
* @param day the day within the month |
|
71 |
* @param hour the hour in 24-hour format e.g. 23 for 11PM |
|
72 |
* @param minute the minute |
|
73 |
* @param second the second |
|
74 |
* |
|
75 |
* @return a new date in the specified UTC time. |
|
76 |
*/ |
|
77 |
+ (NSDate *)UTCDateWithYear:(NSUInteger)year month:(NSUInteger)month day:(NSUInteger)day hour:(NSUInteger)hour minute:(NSUInteger)minute second:(NSUInteger)second; |
|
78 |
@end |