From: Douglas S. B. <db...@cs...> - 2008-03-25 13:28:11
|
It looks like the French date parser is taking the second year of the slashdate as the main year of the date. I think this is somewhat correct, but because the base date parser took the first year, I changed the set date code to set it to the second year (year + 1). Slashdates are now Julian dates, and sort in the proper order (at least as far as years are concerned. There is still an issue of first-day-of-year, but that is coming after a database change.) So, I think the solution is to make all of the parsers use the first year of the slashdate as main year, and let set date do the rest. (I hope I am reading this issue correctly... not everything made through the translation.) -Doug On Tue, March 25, 2008 8:00 am, Jérôme wrote: > Hi, > > > > on _DateParser.py: 186 > > def __init__(self): > self.init_strings() > self.parser = { > Date.CAL_GREGORIAN : self._parse_greg_julian, > Date.CAL_JULIAN : self._parse_greg_julian, > Date.CAL_FRENCH : self._parse_french, > Date.CAL_PERSIAN : self._parse_persian, > Date.CAL_HEBREW : self._parse_hebrew, > Date.CAL_ISLAMIC : self._parse_islamic, > } > > on _DateParser.py: 361 > > def _parse_subdate(self, text, subparser=None): > """ > Convert only the date portion of a date. > """ > if subparser == None: > subparser = self._parse_greg_julian > > if subparser == self._parse_greg_julian: > check = gregorian_valid > else: > check = None > > def set_date on _DateParser.py: 596 > > if date.get_slash(): > date.set_calendar(Date.CAL_JULIAN) > date.set_year(date.get_year() + 1) # year++ and forces recalc > > > There is a mistake by parsing slash date and julian calendar on french > date calendar. > But I do not know how to set this kind/type of date: Date editor will > return "invalid date"... > > Using Tools->Debug->Check Localized Date Displayer and Parser... > I get : > > Date Test 1000 (source) estimée 5. août 1789/90 > Date Test 1000 (result) estimée 5. août 1790/1 (Julien) > > Current Date_fr.py need : > > # This self._text are different from the base > # by adding ".?" after the first date and removing "\s*$" at > the end > #gregorian and julian > self._text2 = re.compile('(\d+)?.?\s+?%s\s*((\d+)(/\d+)?)?' % > self._mon_str, > re.IGNORECASE) > > because fr_CH locale needs "german date model" (dot after the day !!!) > http://en.wikipedia.org/wiki/Date_and_time_notation_by_country#Austria.2C_Germany.2C_Switzerland > > and _DateParser.py: 312 > > def _parse_greg_julian(self, text): > return self._parse_calendar(text, self._text, self._text2, > self.month_to_int, gregorian_valid) > > > I kept this dot, but if this introduces mistakes now, I should try to > remove it. > Maybe to remove fr_CH support too ... (need to look if swiss still need > this model) > > Also, someone with german locale might try : > > Tools->Debug->Check Localized Date Displayer and Parser ... > and to look at results on event view > maybe we have the same problem :( > > > > regards, > > Jérôme > > > Douglas S. Blank a écrit : >> Grampsters, >> >> I've been working on some date math for this bug/feature: >> >> http://bugs.gramps-project.org/view.php?id=1649 >> >> This is useful for a few functions. One is for a date calculator inside >> the Python interpreter in the gramplets: >> >> http://www.gramps-project.org/wiki/index.php?title=GEPS_004:_My_GRAMPS_and_Gadgets#Python_Gramplet >> >> so, for example, you can see how long someone lived: >> >>> Date(1955, 9, 3) - Date(1922, 5, 7) >> (33, 3, 27) # (33 years, 3 months, and 27 days) >> >> Peter asks the question: >> >> """Did you take into account the changeover from the Julian calender to >> the Gregorian? This took place for most of the world by a decision by >> the >> Pope 1583. However, Sweden waited until 1753 for this, so February, 18 >> 1753 was followed by March, 1 1753.""" >> >> I know the relevant code is in src/gen/lib/calendar.py but I don't see >> anything there that seems to deal with this specifically. Is there code >> in >> GRAMPS that handles this gap? If not, do we want to? As Peter notes, it >> would have to be handled by location and time. >> >> Any pointers appreciated, >> >> -Doug >> >> >> ------------------------------------------------------------------------- >> This SF.net email is sponsored by: Microsoft >> Defy all challenges. Microsoft(R) Visual Studio 2008. >> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ >> _______________________________________________ >> Gramps-devel mailing list >> Gra...@li... >> https://lists.sourceforge.net/lists/listinfo/gramps-devel >> > -- Douglas S. Blank Associate Professor, Bryn Mawr College http://cs.brynmawr.edu/~dblank/ Office: 610 526 6501 |