date stuff in gnucash

James LewisMoss
27 Nov 2000 22:59:15 -0500

>>>>> On Tue, 28 Nov 2000 14:39:52 +1100, Robert Graham Merkel <> said:

 Robert> James LewisMoss writes:
 >> src/scm/date-utilities.scm
 Robert> OK, I added some stuff to support "relative dates" (which
 Robert> really covered both "relative" and "abstract dates" to this
 Robert> file a while ago.  It hasn't been used much (until I/we
 Robert> update reports to use it).

I saw.  It doesn't do all I wanted it to do.

 >> src/scm/srfi/srfi-19.scm
 >> srfi-19.scm doesn't contain all of the srfi #19 example
 >> implementation and I was wondering why.
 Robert> Unsure, I haven't really touched this stuff.

 >> Anyway.  Here's the notes I have so far on what I need:
 >> Types of dates:
 >> Abstract: Not a real date or relative date.  This is for things
 >> like "The last monday in a month".  It's a date, but it's not a
 >> real
 Robert> date.
 >> Relative: A date diff.  "Two weeks later".  "Two weeks earlier"
 Robert> etc.  The difference between "abstract" and "relative" isn't
 Robert> quite clear to me.

An abstract date points to a real date, but not a particular one.
"Last monday in a month" has a real occurrence (12 a year in fact).  A
relative date isn't a real date.  It's a difference.  You can't say
"give me an absolute date that conforms to this relative date".  You
can with an abstract date.

 Robert> Both of them remain abstract until you give them an absolute
 Robert> date (or at least part of an absolute date).

True.  I'm not entirely happy about the naming, but it's the best I've
come up with.

 Robert> Additionally, what kind of arithmetic operations do you
 Robert> expect to be able to do on "abstract" and "relative" dates?
 Robert> It gets real complex, real fast.

You add a relative date to an abstract or absolute.  You can determine
whether an absolute date is between two abstract dates (eg: "Is today
between three before the end of the month and three after the begining of
the month") You can determine whether an absolute date is between a
real and it's relative.  You can add a relative date to an abstract or
an absolute.  You can subtract two absolute or two abstract or a mix
to get a relative date.

Obviously all this isn't necessary to do what I want, but the three
different concepts I find useful.


@James LewisMoss <>      |  Blessed Be!
@ |  Linux is kewl!
@"Argue for your limitations and sure enough, they're yours." Bach