2 Copyright (C) 2000-2005 SKYRIX Software AG
4 This file is part of SOPE.
6 SOPE is free software; you can redistribute it and/or modify it under
7 the terms of the GNU Lesser General Public License as published by the
8 Free Software Foundation; either version 2, or (at your option) any
11 SOPE is distributed in the hope that it will be useful, but WITHOUT ANY
12 WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
14 License for more details.
16 You should have received a copy of the GNU Lesser General Public
17 License along with SOPE; see the file COPYING. If not, write to the
18 Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
22 #ifndef __NGExtensions_NSCalendarDate_misc_H__
23 #define __NGExtensions_NSCalendarDate_misc_H__
25 #import <Foundation/NSDate.h>
26 #import <Foundation/NSString.h>
28 #if NeXT_Foundation_LIBRARY || GNUSTEP_BASE_LIBRARY
29 # import <Foundation/NSCalendarDate.h>
32 @class NSArray, NSTimeZone;
34 @interface NSCalendarDate(misc)
38 - (short)numberOfWeeksInYear;
39 + (NSArray *)mondaysOfYear:(int)_year timeZone:(NSTimeZone *)_tz;
40 - (NSArray *)mondaysOfYear;
41 - (NSCalendarDate *)firstMondayAndLastWeekInYear:(short *)_lastWeek;
42 + (NSCalendarDate *)mondayOfWeek:(int)_weekNumber inYear:(int)_year
43 timeZone:(NSTimeZone *)_tz;
44 - (NSCalendarDate *)mondayOfWeek:(int)_weekNumber;
46 + (NSCalendarDate *)dateForJulianNumber:(long)_jn;
49 - (NSCalendarDate *)firstDayOfMonth;
50 - (NSCalendarDate *)lastDayOfMonth;
51 - (NSCalendarDate *)mondayOfWeek;
52 - (NSCalendarDate *)beginOfDay;
53 - (NSCalendarDate *)endOfDay;
54 - (int)numberOfDaysInMonth;
56 - (BOOL)isDateOnSameDay:(NSCalendarDate *)_date;
57 - (BOOL)isDateInSameWeek:(NSCalendarDate *)_date;
61 - (NSCalendarDate *)yesterday;
62 - (NSCalendarDate *)tomorrow;
66 - (NSCalendarDate *)nextYear;
67 - (NSCalendarDate *)lastYear;
69 /* returns a date on the same day with the specified time */
70 - (NSCalendarDate *)hour:(int)_hour minute:(int)_minute second:(int)_second;
71 - (NSCalendarDate *)hour:(int)_hour minute:(int)_minute;
74 applies the following modifications:
75 if year >= 70 && year < 135
77 elif year >= 0 && year < 70
81 - (NSCalendarDate *)y2kDate;
84 adding years, months and days while *keeping* the clock time, eg:
86 d1 = [NSCalendarDate dateWithYear:2000 month:2 day:15
87 hour:12 minute:0 second:0
89 d2 = [d1 dateByAddingYear:0 month:3 day:0];
91 [d2 hourOfDay] will be '15' though the timezone changed from
94 -dateByAddingYears:months:days:hours:minutes:seconds: which can
95 be found in NSCalendarDate will not keep the clock time (the time
96 will be adjusted in the new DST timezone
99 - (NSCalendarDate *)dateByAddingYears:(int)_years
103 /* calculate easter ... */
105 - (NSCalendarDate *)easterOfYear;
110 @interface NSCalendarDate(CalMatrix)
112 - (NSArray *)calendarMatrixWithStartDayOfWeek:(short)_caldow
113 onlyCurrentMonth:(BOOL)_onlyThisMonth;
118 @interface NSString(FuzzyDayOfWeek)
120 - (int)dayOfWeekInEnglishOrGerman;
125 #endif /* __NGExtensions_NSCalendarDate_misc_H__ */