Skip to content

Commit 62403ba

Browse files
wanghenghengEase
authored and
Ease
committed
客户端时间不准确 - Bug
1 parent 735bf06 commit 62403ba

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

Coding_iOS/Util/OC_Category/NSDate+Common.m

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,12 @@ - (NSInteger)yearsAgo{
6060

6161
- (NSInteger)leftDayCount{
6262
NSDate *today = [NSDate dateFromString:[[NSDate date] stringWithFormat:@"yyyy-MM-dd"] withFormat:@"yyyy-MM-dd"];//时分清零
63+
NSDate *selfCopy = [NSDate dateFromString:[self stringWithFormat:@"yyyy-MM-dd"] withFormat:@"yyyy-MM-dd"];//时分清零
64+
6365
NSCalendar *calendar = [[self class] sharedCalendar];
6466
NSDateComponents *components = [calendar components:(NSDayCalendarUnit)
6567
fromDate:today
66-
toDate:self
68+
toDate:selfCopy
6769
options:0];
6870
return [components day];
6971
}

0 commit comments

Comments
 (0)