//
//  NSDate+Helper.h
//  BeepBeep
//
//  Created by Michael Nguyen on 4/6/16.
//  Copyright © 2016 lenpham. All rights reserved.
//

#import <Foundation/Foundation.h>

@interface NSDate (Helper)
- (NSUInteger)daysAgo;
- (NSUInteger)daysAgoAgainstMidnight;
- (NSString *)stringDaysAgo;
- (NSString *)stringDaysAgoAgainstMidnight:(BOOL)flag;
- (NSUInteger)weekday;

+ (NSDate *)fromString:(NSString *)string;
+ (NSDate *)dateFromString:(NSString *)string;
+ (NSDate *)dateFromString:(NSString *)string withFormat:(NSString *)format;
+ (NSDate *)dateFromString:(NSString *)string withStyle:(NSDateFormatterStyle)style;
+ (NSString *)stringFromDate:(NSDate *)date withStyle:(NSDateFormatterStyle)style;
+ (NSString *)stringFromDateTime:(NSDate *)date withStyle:(NSDateFormatterStyle)style;
+ (NSString *)stringFromDate:(NSDate *)date withFormat:(NSString *)string;
+ (NSString *)stringFromDate:(NSDate *)date;
+ (NSString *)stringForDisplayFromDate:(NSDate *)date;
+ (NSString *)stringForDisplayFromDate:(NSDate *)date prefixed:(BOOL)prefixed;
+ (NSString *)stringForDisplayFromDate:(NSDate *)date prefixed:(BOOL)prefixed alwaysDisplayTime:(BOOL)displayTime;

- (NSString *)toString;
- (NSString *)toTimeString;
- (NSString *)toTimeOnlyString;
- (NSString *)string;
- (NSString *)stringWithFormat:(NSString *)format;
- (NSString *)stringWithFormat:(NSString *)format timeZone:(NSTimeZone *)timeZone;
- (NSString *)stringWithStyle:(NSDateFormatterStyle)style;
- (NSString *)stringWithDateStyle:(NSDateFormatterStyle)dateStyle timeStyle:(NSDateFormatterStyle)timeStyle;

- (NSDate *)toLocalTime;
- (NSDate *)toGlobalTime;

- (NSInteger)numberOfDayUntilDate:(NSDate *)date;

- (NSDate *)beginningOfWeek;
- (NSDate *)beginningOfDay;
- (NSDate *)beginningAtMidnightOfDay;
- (NSDate *)endOfWeek;

- (NSDate *)dateByAddSecond:(NSInteger)seconds;
- (NSDate *)dateByAddMinute:(NSInteger)minutes;
- (NSDate *)dateByAddDays:(NSInteger)days;
- (NSDate *)dateByAddMonth:(NSInteger)months;
- (NSDate *)dateByAddingYears:(NSUInteger)years;
+ (NSDate *)lastDateOfMonth:(NSDate *)month;
+ (NSDate *)lastDateOfWeek:(NSDate *)week;
+ (NSDate *)firstDateOfMonth:(NSDate *)month;
+ (NSString *)dateFormatString;
+ (NSString *)timeFormatString;
+ (NSString *)timestampFormatString;
+ (NSString *)dbFormatString;
+ (NSDate *)parseDate:(NSString *)inStrDate format:(NSString *)inFormat;
- (NSDate *)dateOnly;

+ (NSDateComponents *)hourComponentsBetweenDate:(NSDate *)firstDate andDate:(NSDate *)endDate;
+ (NSInteger)dayBetweenDay:(NSDate *)firstDay andDay:(NSDate *)lastDay;
- (NSInteger)getMonth;
- (NSInteger)getDay;
- (NSInteger)getYear;
+ (NSInteger)dayUntilBirthDate:(NSDate *)birthDate;

- (NSDate *)OneAmOfDay;

/**
 *  Compare date time
 *
 *  @param date <#date description#>
 *
 *  @return <#return value description#>
 */
- (BOOL)isAfterDate:(NSDate *)date;
- (BOOL)isBetweenDate:(NSDate *)start end:(NSDate *)end;
+ (NSString *)toStringWithOutSimiColon:(NSDate *)date;
+ (NSString *)toStringWithOutSimiColonWithOutTime:(NSDate *)date;
+ (BOOL)isAllDayEvent:(NSDate *)startDate withEndDate:(NSDate *)endDate;
- (BOOL)isSameDay:(NSDate *)anotherDate;
- (NSInteger)daysBetweenDate:(NSDate *)d;

- (BOOL)isLaterThanOrEqualTo:(NSDate *)date;
- (BOOL)isEarlierThanOrEqualTo:(NSDate *)date;
- (BOOL)isLaterThan:(NSDate *)date;
- (BOOL)isEarlierThan:(NSDate *)date;

//Convert date to day ago
- (NSString *)convertDateToDurationString;
- (NSString *)getTimeStr;
- (NSString *)getDateStr;
- (NSDate *)setTimeWithTimeStr:(NSString *)timeStr;
- (NSDateFormatter *)dateFormatter;
+ (NSTimeZone *)defaultTimeZone;
@end
