]> err.no Git - sope/blob - sope-core/NGExtensions/NGExtensions/NSCalendarDate+misc.h
fixed -isAfternoon method
[sope] / sope-core / NGExtensions / NGExtensions / NSCalendarDate+misc.h
1 /*
2   Copyright (C) 2000-2004 SKYRIX Software AG
3
4   This file is part of OpenGroupware.org.
5
6   OGo 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
9   later version.
10
11   OGo 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.
15
16   You should have received a copy of the GNU Lesser General Public
17   License along with OGo; see the file COPYING.  If not, write to the
18   Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
19   02111-1307, USA.
20 */
21 // $Id$
22
23 #ifndef __NGExtensions_NSCalendarDate_misc_H__
24 #define __NGExtensions_NSCalendarDate_misc_H__
25
26 #import <Foundation/NSDate.h>
27
28 #if NeXT_Foundation_LIBRARY || GNUSTEP_BASE_LIBRARY
29 #  import <Foundation/NSCalendarDate.h>
30 #endif
31
32 @interface NSCalendarDate(misc)
33
34 - (int)weekOfMonth;
35 - (int)weekOfYear;
36 - (short)numberOfWeeksInYear;
37 + (NSArray *)mondaysOfYear:(int)_year timeZone:(NSTimeZone *)_tz;
38 - (NSArray *)mondaysOfYear;
39 - (NSCalendarDate *)firstMondayAndLastWeekInYear:(short *)_lastWeek;
40 + (NSCalendarDate *)mondayOfWeek:(int)_weekNumber inYear:(int)_year
41   timeZone:(NSTimeZone *)_tz;
42 - (NSCalendarDate *)mondayOfWeek:(int)_weekNumber;
43
44 - (NSCalendarDate *)firstDayOfMonth;
45 - (NSCalendarDate *)lastDayOfMonth;
46 - (NSCalendarDate *)mondayOfWeek;
47 - (NSCalendarDate *)beginOfDay;
48 - (NSCalendarDate *)endOfDay;
49 - (int)numberOfDaysInMonth;
50
51 - (BOOL)isDateOnSameDay:(NSCalendarDate *)_date;
52 - (BOOL)isDateInSameWeek:(NSCalendarDate *)_date;
53 - (BOOL)isInLeapYear;
54
55 - (BOOL)isToday;
56 - (NSCalendarDate *)yesterday;
57 - (NSCalendarDate *)tomorrow;
58 - (BOOL)isForenoon;
59 - (BOOL)isAfternoon;
60
61 - (NSCalendarDate *)nextYear;
62 - (NSCalendarDate *)lastYear;
63
64 /* returns a date on the same day with the specified time */
65 - (NSCalendarDate *)hour:(int)_hour minute:(int)_minute second:(int)_second;
66 - (NSCalendarDate *)hour:(int)_hour minute:(int)_minute;
67
68 /*
69   applies the following modifications:
70     if year >= 70 && year < 135
71       year = 1900 + year
72     elif year >= 0 && year < 70
73       year = 2000 + year
74 */
75       
76 - (NSCalendarDate *)y2kDate;
77
78 /*
79   adding years, months and days while *keeping* the clock time, eg:
80
81     d1 = [NSCalendarDate dateWithYear:2000 month:2 day:15
82                          hour:12 minute:0 second:0
83                          timeZone:@"MET"];
84     d2 = [d1 dateByAddingYear:0 month:3 day:0];
85
86     [d2 hourOfDay] will be '15' though the timezone changed from
87     MET to MET-DST.
88
89     -dateByAddingYears:months:days:hours:minutes:seconds: which can
90     be found in NSCalendarDate will not keep the clock time (the time
91     will be adjusted in the new DST timezone
92 */
93
94 - (NSCalendarDate *)dateByAddingYears:(int)_years
95   months:(int)_months
96   days:(int)_days;
97
98 /* calculate easter ... */
99
100 - (NSCalendarDate *)easterOfYear;
101
102 @end
103
104 #endif /* __NGExtensions_NSCalendarDate_misc_H__ */