Skip to content

Commit

Permalink
Fixes Bug #0013428: corrects the documentation.
Browse files Browse the repository at this point in the history
Corrects the documentation for the match() method of the Date class so that it agrees with the operation of the code.
Also added more detail to documentation  in 3 other cases.
  • Loading branch information
CameronD73 committed Sep 11, 2024
1 parent 6442fa3 commit af9fa53
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions gramps/gen/lib/date.py
Original file line number Diff line number Diff line change
Expand Up @@ -569,6 +569,12 @@ class Date:
The core date handling class for Gramps.
Supports partial dates, compound dates and alternate calendars.
Create a new Date instance using one of the following:
Date() - an empty (invalid) date
Date( other_date ) - duplicate another Date
Date( year ) - create an exact date - 1st Jan of the specified year
Date( year, month ) - create an exact date - 1st of the given month, year
Date( year, month, day ) - create an exact date
"""

MOD_NONE = 0 # CODE
Expand Down Expand Up @@ -1035,12 +1041,12 @@ def match(self, other_date, comparison="="):
Comparison Returns
========== =======================================================
=,== True if any part of other_date matches any part of self
< True if any part of other_date < any part of self
<= True if any part of other_date <= any part of self
<< True if all parts of other_date < all parts of self
> True if any part of other_date > any part of self
>= True if any part of other_date >= any part of self
>> True if all parts of other_date > all parts of self
< True if any part of self < any part of other_date
<= True if any part of self <= any part of other_date
<< True if all parts of self < all parts of other_date
> True if any part of self > any part of other_date
>= True if any part of self >= any part of other_date
>> True if all parts of self > all parts of other_date
========== =======================================================
"""
if (
Expand Down Expand Up @@ -1475,6 +1481,7 @@ def __set_yr_mon_day_offset(self, year, month, day, pos_yr, pos_mon, pos_day):
def set_yr_mon_day_offset(self, year=0, month=0, day=0):
"""
Offset the date by the given year, month, and day values.
If the source is a compound date then both are offset.
"""
if self.__set_yr_mon_day_offset(
year, month, day, Date._POS_YR, Date._POS_MON, Date._POS_DAY
Expand All @@ -1498,6 +1505,7 @@ def set2_yr_mon_day_offset(self, year=0, month=0, day=0):
def copy_offset_ymd(self, year=0, month=0, day=0):
"""
Return a Date copy based on year, month, and day offset.
If the source is a compound date then both are offset.
"""
orig_cal = self.calendar
if self.calendar != 0:
Expand Down

0 comments on commit af9fa53

Please sign in to comment.