source: releases/Pester/1.1b7/Source/NSCalendarDate-NJRExtensions.m

Last change on this file was 53, checked in by Nicholas Riley, 22 years ago

Updated for Pester 1.1a5 (very limited release).

Pester 1.1a4 was never released.

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 *)date atTime:(NSDate *)time;
34{
35 NSCalendarDate *calTime, *calDate;
36 if (time == nil || date == nil) return nil;
37 calTime = [NSCalendarDate dateWithDate: time];
38 calDate = [NSCalendarDate dateWithDate: date];
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.