//
//  ASDate_extensions.h
//  iOrdning
//
//  Created by Erik Aderstedt on 2009-01-08.
//  Copyright 2009 Aderstedt Software AB. All rights reserved.
//

#if defined(IFAKTURA)
#import <Foundation/Foundation.h>
#import <CoreData/CoreData.h>
#else
#import <Cocoa/Cocoa.h>
#endif

@interface NSDate(ASDate_extensions)

+ (NSDateFormatter *)dateIndexFormatter;
+ (NSDate *)dateFromDateIndex:(NSNumber *)i;
- (NSNumber *)dateIndex;
+ (NSDateComponents *)dateComponentsForDateIndex:(NSNumber *)dateIndex;
+ (NSNumber *)dateIndexByAdding:(NSInteger)days toDateIndex:(NSNumber *)dateIndex;
+ (NSString *)stringFromDateIndex:(NSNumber *)dateIndex;
+ (NSDate *)dateWithTimeIntervalSince2001:(NSTimeInterval)interval;

@end

@interface DateToDateIndexTransformer : NSValueTransformer

@end

@interface ASDateIndexFormatter : NSNumberFormatter

@end

@interface NSPredicate (ASDateIndexAdditions)

- (NSPredicate *)convertDatesToDateIndexes;

@end