source: trunk/Cocoa/Pester/Source/NSCalendarDate-NJRExtensions.m@ 636

Last change on this file since 636 was 602, checked in by Nicholas Riley, 15 years ago

Rename variables which shadow stdlib functions (and maxSize).

File size: 1.6 KB
Line 
1//
2// NSCalendarDate-NJRExtensions.m
3// Pester
4//
5// Created by Nicholas Riley on Sun Dec 22 2002.
6// Copyright (c) 2002 Nicholas Riley. All rights reserved.
7//
8
9#import "NSCalendarDate-NJRExtensions.h"
10
11
12@interface NSCalendarDate (Private)
13
14// implemented in Foundation, but not declared in NSDate.h
15+ (NSCalendarDate *)dateWithDate:(NSDate *)date;
16
17@end
18
19@implementation NSCalendarDate (NJRExtensions)
20
21+ (NSCalendarDate *)dateForDay:(NSDate *)date;
22{
23 NSCalendarDate *calDate = [NSCalendarDate dateWithDate: date];
24 return [NSCalendarDate dateWithYear: [calDate yearOfCommonEra]
25 month: [calDate monthOfYear]
26 day: [calDate dayOfMonth]
27 hour: 0
28 minute: 0
29 second: 0
30 timeZone: nil];
31}
32
33+ (NSCalendarDate *)dateWithDate:(NSDate *)aDate atTime:(NSDate *)aTime;
34{
35 NSCalendarDate *calTime, *calDate;
36 if (aTime == nil || aDate == nil) return nil;
37 calTime = [NSCalendarDate dateWithDate: aTime];
38 calDate = [NSCalendarDate dateWithDate: aDate];
39 if (calTime == nil || calDate == nil) return nil;
40 return [NSCalendarDate dateWithYear: [calDate yearOfCommonEra]
41 month: [calDate monthOfYear]
42 day: [calDate dayOfMonth]
43 hour: [calTime hourOfDay]
44 minute: [calTime minuteOfHour]
45 second: [calTime secondOfMinute]
46 timeZone: nil];
47}
48
49@end
Note: See TracBrowser for help on using the repository browser.