From af9fa53d4a983869258beb0991355d86e218b811 Mon Sep 17 00:00:00 2001 From: CameronD73 <56762299+CameronD73@users.noreply.github.com> Date: Tue, 10 Sep 2024 18:18:49 +1000 Subject: [PATCH] Fixes Bug #0013428: corrects the documentation. 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. --- gramps/gen/lib/date.py | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/gramps/gen/lib/date.py b/gramps/gen/lib/date.py index 8820dbb9d0f..95b71514b2d 100644 --- a/gramps/gen/lib/date.py +++ b/gramps/gen/lib/date.py @@ -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 @@ -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 ( @@ -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 @@ -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: