Forum OpenACS Development: Re: please test dhms-interval package/widget/datatype

Collapse
Posted by Malte Sussdorff on
Hmm.. what exactly is the purpose of your package. I'm not sure I understand 😊.
Collapse
Posted by Jim Lynch on
Hi Malte,

The purpose of the package is to provide a new form widget called "dhms_interval" and a new form data type also called "dhms_interval".

dhms_interval widget is to allow a form widget for inputting an amount of time; the overall value is a days-hours-minutes-seconds interval (a specific kind I need for an app) which is convertable to and from a postgres interval datum.

dhms_interval form datatype is for representing such a datum while it is going back and forth around a web form input process the user is going through in order to easily communicate an amount of time to the .tcl file and from there to the database and back again.

Some things you can do with intervals... you can add an interval to a timestamp to get a time which is a specific amount (spec'd by the interval) in the future, or subtract if you want to back up into the past. You can also add intervals and subtract one interval from another.

To get intervals, you can subtract two dates or two timestamps, or add two intervals or subtract one from another.

Reason why you might be interested in elapsed time... is you might want to scale time by money/time to produce an amount of money owed, or you might be interested in how long someone spent on a particular job.

As stated... I'm interested in expanding this in at least three ways...

  • one, it should work in oracle;
  • two, it should capture more of what an interval can be, which in postgres can be coarser than weeks and finer than seconds -- this would be a more generic data type, maybe called "interval"; and
  • three, there should be a corresponding widget type, also called "interval", under which a programmer can specify exactly what parts of an interval s/he wants, like the "date" widget does now.