This looks good. I just have a couple of thoughts that might make this more consistent and generic:
1. instead of "adjust-date-time" maybe "set-calendar" would be more useful, and make it as much as possible a variation on the current set operation, or alternatively call it "calculate-calendar" and make it as much as possible a variation on the calculate operation
2. I really like the format-date idea, so much that I think we should make it even more generic and call it "format" or something, and allow a format string (might need another attribute name... maybe "pattern"?) and use that based on the type of the "field" object to convert it to a string;
Ooops, never mind on number 2. I thought it sounded familiar... the current "to-string" operation should take care of it, and can be extended if needed for this particular use.
-David On Dec 10, 2007, at 10:18 AM, Jacopo Cappellato wrote:
It would be nice to have: <adjust-date-time field="tomorrowDate" from-field="nowTimestamp" days="+1"/><format-date field="tomorrowName" from-field="tomorrowDate" format="EEEE"/><log level="always" message="Tomorrow is ${tomorrowName}"/> Output: "Tomorrow is Wednesday" Jacopo Chris Howe wrote:Keep in mind there are additional outputs that one might want from date/time math. Weekday of first of month, week of year, etc. I'm lacking moments of inspiration on the subject at the moment, so I'll just put that out there for now instead of offering a solution :P----- Original Message ---- From: Jacopo Cappellato <[EMAIL PROTECTED]> To: [email protected] Sent: Monday, December 10, 2007 10:24:27 AM Subject: Re: Calculate on a DATE object in minilang Adrian, looks pretty good.One small suggestion: use "field" instead of "to-field" to use the sameconvention of the set operator: <adjust-date-time field="toDate" from-field="fromDate" years="+1" months="+1" ... millis="+1" locale="parameters.locale" time-zone="parameters.timeZone"/> Jacopo Adrian Crum wrote:Thanks Jacques. I've been thinking about this a little, and here is my suggestion: <adjust-date-time from-field="fromDate" to-field="toDate" years="+1" months="+1" ... millis="+1" locale="parameters.locale" time-zone="parameters.timeZone"/>The to-field attribute would be optional, as well as any of the adjusters. An <adjust-date-time> element that has no adjustersproducesan error. Adjustments would be performed using the minilang context's localeandtime zone, unless the locale and time-zone attributes are used. Any thoughts? -Adrian Jacques Le Roux wrote:Thanks Adrian,I put your comment and Chris's in the issue. Hopefully Fabien will take care of it (propose somehting), else we will see later...Jacques De : "Adrian Crum" <[EMAIL PROTECTED]>I agree with Chris. I haven't looked at the issue lately, but whenIfirst looked at it, it simply performed millisecondarithmetic. That might not be the expected behavior.Date calculation would be a great addition to mini language. Maybeweshould discuss how it would look in mini lang code, then animplementation could be submitted.-AdrianJacques Le Roux <[EMAIL PROTECTED]> wrote: Thanks Chris,Interesting remark, seems that the disussion begins to roll... Jacques De : "Chris Howe"This really needs to go through a Calendar object instead of beingelement structure is best suited for the operations that would be most beneficial for date/time calculationscast to a long. Also, I don't think the current----- Original Message ---- From: Jacques Le Roux To: [email protected] Sent: Saturday, December 8, 2007 5:37:08 PM Subject: Calculate on a DATE object in minilang Hi All, 3 months ago Fabien Carrion has contribued some interestingpatches.One of them is https://issues.apache.org/jira/browse/OFBIZ-1249 David asked < do a design and requirements brainstorming discussion on the devlistbefore putting this in. The main thing I'm wondering is if there are other similarrequirementsthat could be satisfied by small changes in the design of this.>> I would like to commit this patch now except if we begin toexchangeabout new requirements per David suggestion Thanks Jacques---------------------------------Looking for last minute shopping deals? Find them fast with Yahoo!Search.
smime.p7s
Description: S/MIME cryptographic signature
