Calculate on a DATE object in minilang

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
22 messages Options
12
Reply | Threaded
Open this post in threaded view
|

Calculate on a DATE object in minilang

Jacques Le Roux
Administrator
Hi All,

3 months ago Fabien Carrion has contribued some interesting patches. One of them is https://issues.apache.org/jira/browse/OFBIZ-1249 
David asked <<Jacques: don't be too quick on this one please; we should do a design and requirements brainstorming discussion on the dev list before putting this in.
The main thing I'm wondering is if there are other similar requirements that could be satisfied by small changes in the design of this.>>

I would like to commit this patch now except if we begin to exchange about new requirements per David suggestion

Thanks

Jacques
Reply | Threaded
Open this post in threaded view
|

Re: Calculate on a DATE object in minilang

cjhowe
This really needs to go through a Calendar object instead of being cast to a long.  Also, I don't think the current <calculate> element structure is best suited for the operations that would be most beneficial for date/time calculations

----- Original Message ----
From: Jacques Le Roux <[hidden email]>
To: [hidden email]
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 interesting patches.
 One of them is https://issues.apache.org/jira/browse/OFBIZ-1249 
David asked <<Jacques: don't be too quick on this one please; we should
 do a design and requirements brainstorming discussion on the dev list
 before putting this in.
The main thing I'm wondering is if there are other similar requirements
 that could be satisfied by small changes in the design of this.>>

I would like to commit this patch now except if we begin to exchange
 about new requirements per David suggestion

Thanks

Jacques


Reply | Threaded
Open this post in threaded view
|

Re: Calculate on a DATE object in minilang

Jacques Le Roux
Administrator
Thanks Chris,

Interesting remark, seems that the disussion begins to roll...

Jacques

De : "Chris Howe" <[hidden email]>
> This really needs to go through a Calendar object instead of being cast to a long.  Also, I don't think the current <calculate>
element structure is best suited for the operations that would be most beneficial for date/time calculations

>
> ----- Original Message ----
> From: Jacques Le Roux <[hidden email]>
> To: [hidden email]
> 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 interesting patches.
>  One of them is https://issues.apache.org/jira/browse/OFBIZ-1249
> David asked <<Jacques: don't be too quick on this one please; we should
>  do a design and requirements brainstorming discussion on the dev list
>  before putting this in.
> The main thing I'm wondering is if there are other similar requirements
>  that could be satisfied by small changes in the design of this.>>
>
> I would like to commit this patch now except if we begin to exchange
>  about new requirements per David suggestion
>
> Thanks
>
> Jacques
>
>

Reply | Threaded
Open this post in threaded view
|

Re: Calculate on a DATE object in minilang

Adrian Crum-2
I agree with Chris. I haven't looked at the issue lately, but when I first looked at it, it simply performed millisecond arithmetic. That might not be the expected behavior.

Date calculation would be a great addition to mini language. Maybe we should discuss how it would look in mini lang code, then an implementation could be submitted.

-Adrian

Jacques Le Roux <[hidden email]> 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 being cast to a long.  Also, I don't think the current
element structure is best suited for the operations that would be most beneficial for date/time calculations

>
> ----- Original Message ----
> From: Jacques Le Roux
> To: [hidden email]
> 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 interesting patches.
>  One of them is https://issues.apache.org/jira/browse/OFBIZ-1249
> David asked <
>  do a design and requirements brainstorming discussion on the dev list
>  before putting this in.
> The main thing I'm wondering is if there are other similar requirements
>  that could be satisfied by small changes in the design of this.>>
>
> I would like to commit this patch now except if we begin to exchange
>  about new requirements per David suggestion
>
> Thanks
>
> Jacques
>
>



       
---------------------------------
Looking for last minute shopping deals?  Find them fast with Yahoo! Search.
Reply | Threaded
Open this post in threaded view
|

Re: Calculate on a DATE object in minilang

Jacques Le Roux
Administrator
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" <[hidden email]>
> I agree with Chris. I haven't looked at the issue lately, but when I first looked at it, it simply performed millisecond
arithmetic. That might not be the expected behavior.
>
> Date calculation would be a great addition to mini language. Maybe we should discuss how it would look in mini lang code, then an
implementation could be submitted.

>
> -Adrian
>
> Jacques Le Roux <[hidden email]> 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 being cast to a long.  Also, I don't think the current
> element structure is best suited for the operations that would be most beneficial for date/time calculations
> >
> > ----- Original Message ----
> > From: Jacques Le Roux
> > To: [hidden email]
> > 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 interesting patches.
> >  One of them is https://issues.apache.org/jira/browse/OFBIZ-1249
> > David asked <
> >  do a design and requirements brainstorming discussion on the dev list
> >  before putting this in.
> > The main thing I'm wondering is if there are other similar requirements
> >  that could be satisfied by small changes in the design of this.>>
> >
> > I would like to commit this patch now except if we begin to exchange
> >  about new requirements per David suggestion
> >
> > Thanks
> >
> > Jacques
> >
> >
>
>
>
>
> ---------------------------------
> Looking for last minute shopping deals?  Find them fast with Yahoo! Search.

Reply | Threaded
Open this post in threaded view
|

Re: Calculate on a DATE object in minilang

Adrian Crum
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 adjusters produces an error.

Adjustments would be performed using the minilang context's locale and time 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" <[hidden email]>
>
>>I agree with Chris. I haven't looked at the issue lately, but when I first looked at it, it simply performed millisecond
>
> arithmetic. That might not be the expected behavior.
>
>>Date calculation would be a great addition to mini language. Maybe we should discuss how it would look in mini lang code, then an
>
> implementation could be submitted.
>
>>-Adrian
>>
>>Jacques Le Roux <[hidden email]> 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 being cast to a long.  Also, I don't think the current
>>
>>element structure is best suited for the operations that would be most beneficial for date/time calculations
>>
>>>----- Original Message ----
>>>From: Jacques Le Roux
>>>To: [hidden email]
>>>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 interesting patches.
>>> One of them is https://issues.apache.org/jira/browse/OFBIZ-1249
>>>David asked <
>>> do a design and requirements brainstorming discussion on the dev list
>>> before putting this in.
>>>The main thing I'm wondering is if there are other similar requirements
>>> that could be satisfied by small changes in the design of this.>>
>>>
>>>I would like to commit this patch now except if we begin to exchange
>>> about new requirements per David suggestion
>>>
>>>Thanks
>>>
>>>Jacques
>>>
>>>
>>
>>
>>
>>
>>---------------------------------
>>Looking for last minute shopping deals?  Find them fast with Yahoo! Search.
>
>
>

Reply | Threaded
Open this post in threaded view
|

Re: Calculate on a DATE object in minilang

Jacopo Cappellato
Adrian,

looks pretty good.
One small suggestion: use "field" instead of "to-field" to use the same
convention 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 adjusters produces
> an error.
>
> Adjustments would be performed using the minilang context's locale and
> time 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" <[hidden email]>
>>
>>> I agree with Chris. I haven't looked at the issue lately, but when I
>>> first looked at it, it simply performed millisecond
>>
>> arithmetic. That might not be the expected behavior.
>>
>>> Date calculation would be a great addition to mini language. Maybe we
>>> should discuss how it would look in mini lang code, then an
>>
>> implementation could be submitted.
>>
>>> -Adrian
>>>
>>> Jacques Le Roux <[hidden email]> 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 being
>>>> cast to a long.  Also, I don't think the current
>>>
>>> element structure is best suited for the operations that would be
>>> most beneficial for date/time calculations
>>>
>>>> ----- Original Message ----
>>>> From: Jacques Le Roux
>>>> To: [hidden email]
>>>> 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 interesting patches.
>>>> One of them is https://issues.apache.org/jira/browse/OFBIZ-1249
>>>> David asked <
>>>> do a design and requirements brainstorming discussion on the dev list
>>>> before putting this in.
>>>> The main thing I'm wondering is if there are other similar requirements
>>>> that could be satisfied by small changes in the design of this.>>
>>>>
>>>> I would like to commit this patch now except if we begin to exchange
>>>> about new requirements per David suggestion
>>>>
>>>> Thanks
>>>>
>>>> Jacques
>>>>
>>>>
>>>
>>>
>>>
>>>
>>> ---------------------------------
>>> Looking for last minute shopping deals?  Find them fast with Yahoo!
>>> Search.
>>
>>
>>

Reply | Threaded
Open this post in threaded view
|

Re: Calculate on a DATE object in minilang

cjhowe
In reply to this post by Jacques Le Roux
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 <[hidden email]>
To: [hidden email]
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 same
 
convention 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 adjusters
 produces
> an error.
>
> Adjustments would be performed using the minilang context's locale
 and

> time 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" <[hidden email]>
>>
>>> I agree with Chris. I haven't looked at the issue lately, but when
 I
>>> first looked at it, it simply performed millisecond
>>
>> arithmetic. That might not be the expected behavior.
>>
>>> Date calculation would be a great addition to mini language. Maybe
 we

>>> should discuss how it would look in mini lang code, then an
>>
>> implementation could be submitted.
>>
>>> -Adrian
>>>
>>> Jacques Le Roux <[hidden email]> 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 being
 

>>>> cast to a long.  Also, I don't think the current
>>>
>>> element structure is best suited for the operations that would be
>>> most beneficial for date/time calculations
>>>
>>>> ----- Original Message ----
>>>> From: Jacques Le Roux
>>>> To: [hidden email]
>>>> 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 interesting
 patches.
>>>> One of them is https://issues.apache.org/jira/browse/OFBIZ-1249
>>>> David asked <
>>>> do a design and requirements brainstorming discussion on the dev
 list
>>>> before putting this in.
>>>> The main thing I'm wondering is if there are other similar
 requirements
>>>> that could be satisfied by small changes in the design of this.>>
>>>>
>>>> I would like to commit this patch now except if we begin to
 exchange

>>>> about new requirements per David suggestion
>>>>
>>>> Thanks
>>>>
>>>> Jacques
>>>>
>>>>
>>>
>>>
>>>
>>>
>>> ---------------------------------
>>> Looking for last minute shopping deals?  Find them fast with Yahoo!
 
>>> Search.
>>
>>
>>




Reply | Threaded
Open this post in threaded view
|

Re: Calculate on a DATE object in minilang

Adrian Crum
Chris,

I agree! I'd like to see minilang develop to the point where we don't need the day.bsh, week.bsh,
and month.bsh files in Workeffort.

-Adrian

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 <[hidden email]>
> To: [hidden email]
> 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 same
>  
> convention 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 adjusters
>
>  produces
>
>>an error.
>>
>>Adjustments would be performed using the minilang context's locale
>
>  and
>
>>time 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" <[hidden email]>
>>>
>>>>I agree with Chris. I haven't looked at the issue lately, but when
>
>  I
>
>>>>first looked at it, it simply performed millisecond
>>>
>>>arithmetic. That might not be the expected behavior.
>>>
>>>
>>>>Date calculation would be a great addition to mini language. Maybe
>
>  we
>
>>>>should discuss how it would look in mini lang code, then an
>>>
>>>implementation could be submitted.
>>>
>>>
>>>>-Adrian
>>>>
>>>>Jacques Le Roux <[hidden email]> 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 being
>
>  
>
>>>>>cast to a long.  Also, I don't think the current
>>>>
>>>>element structure is best suited for the operations that would be
>>>>most beneficial for date/time calculations
>>>>
>>>>
>>>>>----- Original Message ----
>>>>>From: Jacques Le Roux
>>>>>To: [hidden email]
>>>>>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 interesting
>
>  patches.
>
>>>>>One of them is https://issues.apache.org/jira/browse/OFBIZ-1249
>>>>>David asked <
>>>>>do a design and requirements brainstorming discussion on the dev
>
>  list
>
>>>>>before putting this in.
>>>>>The main thing I'm wondering is if there are other similar
>
>  requirements
>
>>>>>that could be satisfied by small changes in the design of this.>>
>>>>>
>>>>>I would like to commit this patch now except if we begin to
>
>  exchange
>
>>>>>about new requirements per David suggestion
>>>>>
>>>>>Thanks
>>>>>
>>>>>Jacques
>>>>>
>>>>>
>>>>
>>>>
>>>>
>>>>
>>>>---------------------------------
>>>>Looking for last minute shopping deals?  Find them fast with Yahoo!
>
>  
>
>>>>Search.
>>>
>>>
>>>
>
>
>
>
>

Reply | Threaded
Open this post in threaded view
|

Re: Calculate on a DATE object in minilang

Jim Barrows
In reply to this post by cjhowe
What about wrapping joda time (joda-time.sourceforge.net) up in mini-lang?

On Dec 10, 2007 10:04 AM, Chris Howe <[hidden email]> 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 <[hidden email]>
> To: [hidden email]
> 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 same
>
> convention 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 adjusters
>  produces
> > an error.
> >
> > Adjustments would be performed using the minilang context's locale
>  and
> > time 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" <[hidden email]>
> >>
> >>> I agree with Chris. I haven't looked at the issue lately, but when
>  I
> >>> first looked at it, it simply performed millisecond
> >>
> >> arithmetic. That might not be the expected behavior.
> >>
> >>> Date calculation would be a great addition to mini language. Maybe
>  we
> >>> should discuss how it would look in mini lang code, then an
> >>
> >> implementation could be submitted.
> >>
> >>> -Adrian
> >>>
> >>> Jacques Le Roux <[hidden email]> 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 being
>
> >>>> cast to a long.  Also, I don't think the current
> >>>
> >>> element structure is best suited for the operations that would be
> >>> most beneficial for date/time calculations
> >>>
> >>>> ----- Original Message ----
> >>>> From: Jacques Le Roux
> >>>> To: [hidden email]
> >>>> 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 interesting
>  patches.
> >>>> One of them is https://issues.apache.org/jira/browse/OFBIZ-1249
> >>>> David asked <
> >>>> do a design and requirements brainstorming discussion on the dev
>  list
> >>>> before putting this in.
> >>>> The main thing I'm wondering is if there are other similar
>  requirements
> >>>> that could be satisfied by small changes in the design of this.>>
> >>>>
> >>>> I would like to commit this patch now except if we begin to
>  exchange
> >>>> about new requirements per David suggestion
> >>>>
> >>>> Thanks
> >>>>
> >>>> Jacques
> >>>>
> >>>>
> >>>
> >>>
> >>>
> >>>
> >>> ---------------------------------
> >>> Looking for last minute shopping deals?  Find them fast with Yahoo!
>
> >>> Search.
> >>
> >>
> >>
>
>
>
>
>



--
James A Barrows
Reply | Threaded
Open this post in threaded view
|

Re: Calculate on a DATE object in minilang

Jacopo Cappellato
In reply to this post by cjhowe
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 <[hidden email]>
> To: [hidden email]
> 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 same
>  
> convention 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 adjusters
>  produces
>> an error.
>>
>> Adjustments would be performed using the minilang context's locale
>  and
>> time 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" <[hidden email]>
>>>
>>>> I agree with Chris. I haven't looked at the issue lately, but when
>  I
>>>> first looked at it, it simply performed millisecond
>>> arithmetic. That might not be the expected behavior.
>>>
>>>> Date calculation would be a great addition to mini language. Maybe
>  we
>>>> should discuss how it would look in mini lang code, then an
>>> implementation could be submitted.
>>>
>>>> -Adrian
>>>>
>>>> Jacques Le Roux <[hidden email]> 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 being
>  
>>>>> cast to a long.  Also, I don't think the current
>>>> element structure is best suited for the operations that would be
>>>> most beneficial for date/time calculations
>>>>
>>>>> ----- Original Message ----
>>>>> From: Jacques Le Roux
>>>>> To: [hidden email]
>>>>> 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 interesting
>  patches.
>>>>> One of them is https://issues.apache.org/jira/browse/OFBIZ-1249
>>>>> David asked <
>>>>> do a design and requirements brainstorming discussion on the dev
>  list
>>>>> before putting this in.
>>>>> The main thing I'm wondering is if there are other similar
>  requirements
>>>>> that could be satisfied by small changes in the design of this.>>
>>>>>
>>>>> I would like to commit this patch now except if we begin to
>  exchange
>>>>> about new requirements per David suggestion
>>>>>
>>>>> Thanks
>>>>>
>>>>> Jacques
>>>>>
>>>>>
>>>>
>>>>
>>>>
>>>> ---------------------------------
>>>> Looking for last minute shopping deals?  Find them fast with Yahoo!
>  
>>>> Search.
>>>
>>>
>
>
>

Reply | Threaded
Open this post in threaded view
|

Re: Calculate on a DATE object in minilang

Adrian Crum
In reply to this post by Jim Barrows
Jim,

That looks very interesting! We already have the UtilDateTime class that does pretty much the same
thing. I'll take a look at it - there's a chance we can eliminate a lot of OFBiz code by going with
the joda-time code.

-Adrian

Jim Barrows wrote:

> What about wrapping joda time (joda-time.sourceforge.net) up in mini-lang?
>
> On Dec 10, 2007 10:04 AM, Chris Howe <[hidden email]> 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 <[hidden email]>
>>To: [hidden email]
>>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 same
>>
>>convention 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 adjusters
>>
>> produces
>>
>>>an error.
>>>
>>>Adjustments would be performed using the minilang context's locale
>>
>> and
>>
>>>time 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" <[hidden email]>
>>>>
>>>>>I agree with Chris. I haven't looked at the issue lately, but when
>>
>> I
>>
>>>>>first looked at it, it simply performed millisecond
>>>>
>>>>arithmetic. That might not be the expected behavior.
>>>>
>>>>
>>>>>Date calculation would be a great addition to mini language. Maybe
>>
>> we
>>
>>>>>should discuss how it would look in mini lang code, then an
>>>>
>>>>implementation could be submitted.
>>>>
>>>>
>>>>>-Adrian
>>>>>
>>>>>Jacques Le Roux <[hidden email]> 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 being
>>
>>>>>>cast to a long.  Also, I don't think the current
>>>>>
>>>>>element structure is best suited for the operations that would be
>>>>>most beneficial for date/time calculations
>>>>>
>>>>>
>>>>>>----- Original Message ----
>>>>>>From: Jacques Le Roux
>>>>>>To: [hidden email]
>>>>>>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 interesting
>>
>> patches.
>>
>>>>>>One of them is https://issues.apache.org/jira/browse/OFBIZ-1249
>>>>>>David asked <
>>>>>>do a design and requirements brainstorming discussion on the dev
>>
>> list
>>
>>>>>>before putting this in.
>>>>>>The main thing I'm wondering is if there are other similar
>>
>> requirements
>>
>>>>>>that could be satisfied by small changes in the design of this.>>
>>>>>>
>>>>>>I would like to commit this patch now except if we begin to
>>
>> exchange
>>
>>>>>>about new requirements per David suggestion
>>>>>>
>>>>>>Thanks
>>>>>>
>>>>>>Jacques
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>---------------------------------
>>>>>Looking for last minute shopping deals?  Find them fast with Yahoo!
>>
>>>>>Search.
>>>>
>>>>
>>>>
>>
>>
>>
>>
>
>
>

Reply | Threaded
Open this post in threaded view
|

Re: Calculate on a DATE object in minilang

Jim Barrows
Or, at least provide a better starting point then the java date stuff :)

On Dec 10, 2007 10:22 AM, Adrian Crum <[hidden email]> wrote:

> Jim,
>
> That looks very interesting! We already have the UtilDateTime class that does pretty much the same
> thing. I'll take a look at it - there's a chance we can eliminate a lot of OFBiz code by going with
> the joda-time code.
>
> -Adrian
>
>
> Jim Barrows wrote:
>
> > What about wrapping joda time (joda-time.sourceforge.net) up in mini-lang?
> >
> > On Dec 10, 2007 10:04 AM, Chris Howe <[hidden email]> 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 <[hidden email]>
> >>To: [hidden email]
> >>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 same
> >>
> >>convention 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 adjusters
> >>
> >> produces
> >>
> >>>an error.
> >>>
> >>>Adjustments would be performed using the minilang context's locale
> >>
> >> and
> >>
> >>>time 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" <[hidden email]>
> >>>>
> >>>>>I agree with Chris. I haven't looked at the issue lately, but when
> >>
> >> I
> >>
> >>>>>first looked at it, it simply performed millisecond
> >>>>
> >>>>arithmetic. That might not be the expected behavior.
> >>>>
> >>>>
> >>>>>Date calculation would be a great addition to mini language. Maybe
> >>
> >> we
> >>
> >>>>>should discuss how it would look in mini lang code, then an
> >>>>
> >>>>implementation could be submitted.
> >>>>
> >>>>
> >>>>>-Adrian
> >>>>>
> >>>>>Jacques Le Roux <[hidden email]> 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 being
> >>
> >>>>>>cast to a long.  Also, I don't think the current
> >>>>>
> >>>>>element structure is best suited for the operations that would be
> >>>>>most beneficial for date/time calculations
> >>>>>
> >>>>>
> >>>>>>----- Original Message ----
> >>>>>>From: Jacques Le Roux
> >>>>>>To: [hidden email]
> >>>>>>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 interesting
> >>
> >> patches.
> >>
> >>>>>>One of them is https://issues.apache.org/jira/browse/OFBIZ-1249
> >>>>>>David asked <
> >>>>>>do a design and requirements brainstorming discussion on the dev
> >>
> >> list
> >>
> >>>>>>before putting this in.
> >>>>>>The main thing I'm wondering is if there are other similar
> >>
> >> requirements
> >>
> >>>>>>that could be satisfied by small changes in the design of this.>>
> >>>>>>
> >>>>>>I would like to commit this patch now except if we begin to
> >>
> >> exchange
> >>
> >>>>>>about new requirements per David suggestion
> >>>>>>
> >>>>>>Thanks
> >>>>>>
> >>>>>>Jacques
> >>>>>>
> >>>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>>---------------------------------
> >>>>>Looking for last minute shopping deals?  Find them fast with Yahoo!
> >>
> >>>>>Search.
> >>>>
> >>>>
> >>>>
> >>
> >>
> >>
> >>
> >
> >
> >
>
>



--
James A Barrows
Reply | Threaded
Open this post in threaded view
|

Re: Calculate on a DATE object in minilang

Fabien Carrion
What if somebody want to do this:

<adjust-date-time field="xDate" from-field="nowTimestamp" days="x"/>
<format-date field="xName" from-field="xDate" format="EEEE"/>
<log level="always" message="X days is ${xName}"/>

Output:

"X days is Wednesday"

We may want to add a field to the current date. Would it be possible?

On Dec 10, 2007 11:40 AM, Jim Barrows <[hidden email]> wrote:

> Or, at least provide a better starting point then the java date stuff :)
>
>
> On Dec 10, 2007 10:22 AM, Adrian Crum <[hidden email]> wrote:
> > Jim,
> >
> > That looks very interesting! We already have the UtilDateTime class that does pretty much the same
> > thing. I'll take a look at it - there's a chance we can eliminate a lot of OFBiz code by going with
> > the joda-time code.
> >
> > -Adrian
> >
> >
> > Jim Barrows wrote:
> >
> > > What about wrapping joda time (joda-time.sourceforge.net) up in mini-lang?
> > >
> > > On Dec 10, 2007 10:04 AM, Chris Howe <[hidden email]> 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 <[hidden email]>
> > >>To: [hidden email]
> > >>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 same
> > >>
> > >>convention 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 adjusters
> > >>
> > >> produces
> > >>
> > >>>an error.
> > >>>
> > >>>Adjustments would be performed using the minilang context's locale
> > >>
> > >> and
> > >>
> > >>>time 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" <[hidden email]>
> > >>>>
> > >>>>>I agree with Chris. I haven't looked at the issue lately, but when
> > >>
> > >> I
> > >>
> > >>>>>first looked at it, it simply performed millisecond
> > >>>>
> > >>>>arithmetic. That might not be the expected behavior.
> > >>>>
> > >>>>
> > >>>>>Date calculation would be a great addition to mini language. Maybe
> > >>
> > >> we
> > >>
> > >>>>>should discuss how it would look in mini lang code, then an
> > >>>>
> > >>>>implementation could be submitted.
> > >>>>
> > >>>>
> > >>>>>-Adrian
> > >>>>>
> > >>>>>Jacques Le Roux <[hidden email]> 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 being
> > >>
> > >>>>>>cast to a long.  Also, I don't think the current
> > >>>>>
> > >>>>>element structure is best suited for the operations that would be
> > >>>>>most beneficial for date/time calculations
> > >>>>>
> > >>>>>
> > >>>>>>----- Original Message ----
> > >>>>>>From: Jacques Le Roux
> > >>>>>>To: [hidden email]
> > >>>>>>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 interesting
> > >>
> > >> patches.
> > >>
> > >>>>>>One of them is https://issues.apache.org/jira/browse/OFBIZ-1249
> > >>>>>>David asked <
> > >>>>>>do a design and requirements brainstorming discussion on the dev
> > >>
> > >> list
> > >>
> > >>>>>>before putting this in.
> > >>>>>>The main thing I'm wondering is if there are other similar
> > >>
> > >> requirements
> > >>
> > >>>>>>that could be satisfied by small changes in the design of this.>>
> > >>>>>>
> > >>>>>>I would like to commit this patch now except if we begin to
> > >>
> > >> exchange
> > >>
> > >>>>>>about new requirements per David suggestion
> > >>>>>>
> > >>>>>>Thanks
> > >>>>>>
> > >>>>>>Jacques
> > >>>>>>
> > >>>>>>
> > >>>>>
> > >>>>>
> > >>>>>
> > >>>>>
> > >>>>>---------------------------------
> > >>>>>Looking for last minute shopping deals?  Find them fast with Yahoo!
> > >>
> > >>>>>Search.
> > >>>>
> > >>>>
> > >>>>
> > >>
> > >>
> > >>
> > >>
> > >
> > >
> > >
> >
> >
>
>
>
> --
> James A Barrows
>



--
Fabien Carrion

()  Campagne du ruban ASCII -- Contre les mails en html
/\  contre les pieces-jointes Microsoft
Web: http://fabien.carrion.free.fr/
Reply | Threaded
Open this post in threaded view
|

Re: Calculate on a DATE object in minilang

David E Jones
In reply to this post by Jacopo Cappellato

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 <[hidden email]>
>> To: [hidden email]
>> 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  
>> same
>> convention 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 adjusters
>> produces
>>> an error.
>>>
>>> Adjustments would be performed using the minilang context's locale
>> and
>>> time 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" <[hidden email]>
>>>>
>>>>> I agree with Chris. I haven't looked at the issue lately, but when
>> I
>>>>> first looked at it, it simply performed millisecond
>>>> arithmetic. That might not be the expected behavior.
>>>>
>>>>> Date calculation would be a great addition to mini language. Maybe
>> we
>>>>> should discuss how it would look in mini lang code, then an
>>>> implementation could be submitted.
>>>>
>>>>> -Adrian
>>>>>
>>>>> Jacques Le Roux <[hidden email]> 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  
>>>>>> being
>>
>>>>>> cast to a long.  Also, I don't think the current
>>>>> element structure is best suited for the operations that would  
>>>>> be most beneficial for date/time calculations
>>>>>
>>>>>> ----- Original Message ----
>>>>>> From: Jacques Le Roux
>>>>>> To: [hidden email]
>>>>>> 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 interesting
>> patches.
>>>>>> One of them is https://issues.apache.org/jira/browse/OFBIZ-1249
>>>>>> David asked <
>>>>>> do a design and requirements brainstorming discussion on the dev
>> list
>>>>>> before putting this in.
>>>>>> The main thing I'm wondering is if there are other similar
>> requirements
>>>>>> that could be satisfied by small changes in the design of this.>>
>>>>>>
>>>>>> I would like to commit this patch now except if we begin to
>> exchange
>>>>>> about new requirements per David suggestion
>>>>>>
>>>>>> Thanks
>>>>>>
>>>>>> Jacques
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>>
>>>>> ---------------------------------
>>>>> Looking for last minute shopping deals?  Find them fast with  
>>>>> Yahoo!
>>
>>>>> Search.
>>>>
>>>>
>


smime.p7s (3K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Calculate on a DATE object in minilang

Jacques Le Roux
Administrator
In reply to this post by Jim Barrows
I just had a cursory review, yes seems like a good idea. I agree with Adrian view : rely on joda team as possible. And maybe help
them also, though joda looks like being already very well advanced.

+1 for me

Jacques

De : "Jim Barrows" <[hidden email]>

> Or, at least provide a better starting point then the java date stuff :)
>
> On Dec 10, 2007 10:22 AM, Adrian Crum <[hidden email]> wrote:
> > Jim,
> >
> > That looks very interesting! We already have the UtilDateTime class that does pretty much the same
> > thing. I'll take a look at it - there's a chance we can eliminate a lot of OFBiz code by going with
> > the joda-time code.
> >
> > -Adrian
> >
> >
> > Jim Barrows wrote:
> >
> > > What about wrapping joda time (joda-time.sourceforge.net) up in mini-lang?
> > >
> > > On Dec 10, 2007 10:04 AM, Chris Howe <[hidden email]> 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 <[hidden email]>
> > >>To: [hidden email]
> > >>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 same
> > >>
> > >>convention 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 adjusters
> > >>
> > >> produces
> > >>
> > >>>an error.
> > >>>
> > >>>Adjustments would be performed using the minilang context's locale
> > >>
> > >> and
> > >>
> > >>>time 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" <[hidden email]>
> > >>>>
> > >>>>>I agree with Chris. I haven't looked at the issue lately, but when
> > >>
> > >> I
> > >>
> > >>>>>first looked at it, it simply performed millisecond
> > >>>>
> > >>>>arithmetic. That might not be the expected behavior.
> > >>>>
> > >>>>
> > >>>>>Date calculation would be a great addition to mini language. Maybe
> > >>
> > >> we
> > >>
> > >>>>>should discuss how it would look in mini lang code, then an
> > >>>>
> > >>>>implementation could be submitted.
> > >>>>
> > >>>>
> > >>>>>-Adrian
> > >>>>>
> > >>>>>Jacques Le Roux <[hidden email]> 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 being
> > >>
> > >>>>>>cast to a long.  Also, I don't think the current
> > >>>>>
> > >>>>>element structure is best suited for the operations that would be
> > >>>>>most beneficial for date/time calculations
> > >>>>>
> > >>>>>
> > >>>>>>----- Original Message ----
> > >>>>>>From: Jacques Le Roux
> > >>>>>>To: [hidden email]
> > >>>>>>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 interesting
> > >>
> > >> patches.
> > >>
> > >>>>>>One of them is https://issues.apache.org/jira/browse/OFBIZ-1249
> > >>>>>>David asked <
> > >>>>>>do a design and requirements brainstorming discussion on the dev
> > >>
> > >> list
> > >>
> > >>>>>>before putting this in.
> > >>>>>>The main thing I'm wondering is if there are other similar
> > >>
> > >> requirements
> > >>
> > >>>>>>that could be satisfied by small changes in the design of this.>>
> > >>>>>>
> > >>>>>>I would like to commit this patch now except if we begin to
> > >>
> > >> exchange
> > >>
> > >>>>>>about new requirements per David suggestion
> > >>>>>>
> > >>>>>>Thanks
> > >>>>>>
> > >>>>>>Jacques
> > >>>>>>
> > >>>>>>
> > >>>>>
> > >>>>>
> > >>>>>
> > >>>>>
> > >>>>>---------------------------------
> > >>>>>Looking for last minute shopping deals?  Find them fast with Yahoo!
> > >>
> > >>>>>Search.
> > >>>>
> > >>>>
> > >>>>
> > >>
> > >>
> > >>
> > >>
> > >
> > >
> > >
> >
> >
>
>
>
> --
> James A Barrows
>

Reply | Threaded
Open this post in threaded view
|

Re: Calculate on a DATE object in minilang

Jacopo Cappellato
I'm keeping this thread alive because I have a wish to see the
<set-calendar> (or <adjust-date-time>) operation implemented: in fact in
the Minilang service I've committed yesterday to close a financial time
period we have the requirement to get a Timestamp (older than an
existing one of a few seconds).
I'm wondering if someone here could help with this task... maybe Adrian
"The Lord Of Time" Crum? ;-)

Jacopo


Jacques Le Roux wrote:

> I just had a cursory review, yes seems like a good idea. I agree with Adrian view : rely on joda team as possible. And maybe help
> them also, though joda looks like being already very well advanced.
>
> +1 for me
>
> Jacques
>
> De : "Jim Barrows" <[hidden email]>
>> Or, at least provide a better starting point then the java date stuff :)
>>
>> On Dec 10, 2007 10:22 AM, Adrian Crum <[hidden email]> wrote:
>>> Jim,
>>>
>>> That looks very interesting! We already have the UtilDateTime class that does pretty much the same
>>> thing. I'll take a look at it - there's a chance we can eliminate a lot of OFBiz code by going with
>>> the joda-time code.
>>>
>>> -Adrian
>>>
>>>
>>> Jim Barrows wrote:
>>>
>>>> What about wrapping joda time (joda-time.sourceforge.net) up in mini-lang?
>>>>
>>>> On Dec 10, 2007 10:04 AM, Chris Howe <[hidden email]> 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 <[hidden email]>
>>>>> To: [hidden email]
>>>>> 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 same
>>>>>
>>>>> convention 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 adjusters
>>>>> produces
>>>>>
>>>>>> an error.
>>>>>>
>>>>>> Adjustments would be performed using the minilang context's locale
>>>>> and
>>>>>
>>>>>> time 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" <[hidden email]>
>>>>>>>
>>>>>>>> I agree with Chris. I haven't looked at the issue lately, but when
>>>>> I
>>>>>
>>>>>>>> first looked at it, it simply performed millisecond
>>>>>>> arithmetic. That might not be the expected behavior.
>>>>>>>
>>>>>>>
>>>>>>>> Date calculation would be a great addition to mini language. Maybe
>>>>> we
>>>>>
>>>>>>>> should discuss how it would look in mini lang code, then an
>>>>>>> implementation could be submitted.
>>>>>>>
>>>>>>>
>>>>>>>> -Adrian
>>>>>>>>
>>>>>>>> Jacques Le Roux <[hidden email]> 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 being
>>>>>>>>> cast to a long.  Also, I don't think the current
>>>>>>>> element structure is best suited for the operations that would be
>>>>>>>> most beneficial for date/time calculations
>>>>>>>>
>>>>>>>>
>>>>>>>>> ----- Original Message ----
>>>>>>>>> From: Jacques Le Roux
>>>>>>>>> To: [hidden email]
>>>>>>>>> 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 interesting
>>>>> patches.
>>>>>
>>>>>>>>> One of them is https://issues.apache.org/jira/browse/OFBIZ-1249
>>>>>>>>> David asked <
>>>>>>>>> do a design and requirements brainstorming discussion on the dev
>>>>> list
>>>>>
>>>>>>>>> before putting this in.
>>>>>>>>> The main thing I'm wondering is if there are other similar
>>>>> requirements
>>>>>
>>>>>>>>> that could be satisfied by small changes in the design of this.>>
>>>>>>>>>
>>>>>>>>> I would like to commit this patch now except if we begin to
>>>>> exchange
>>>>>
>>>>>>>>> about new requirements per David suggestion
>>>>>>>>>
>>>>>>>>> Thanks
>>>>>>>>>
>>>>>>>>> Jacques
>>>>>>>>>
>>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> ---------------------------------
>>>>>>>> Looking for last minute shopping deals?  Find them fast with Yahoo!
>>>>>>>> Search.
>>>>>>>
>>>>>>>
>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>
>>
>>
>> --
>> James A Barrows
>>

Reply | Threaded
Open this post in threaded view
|

Re: Calculate on a DATE object in minilang

Jacques Le Roux
Administrator
In reply to this post by Fabien Carrion
You mean x (X?) being an external parameters ? using a ${}syntax ? Sorry, I can' see the difference with Jacopo's "Tomorrow is
Wednesday" example

De : "Jacopo Cappellato" <[hidden email]>

> 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

What I am missing ?

Jacques

De : "Fabien Carrion" <[hidden email]>

> What if somebody want to do this:
>
> <adjust-date-time field="xDate" from-field="nowTimestamp" days="x"/>
> <format-date field="xName" from-field="xDate" format="EEEE"/>
> <log level="always" message="X days is ${xName}"/>
>
> Output:
>
> "X days is Wednesday"
>
> We may want to add a field to the current date. Would it be possible?
>
> On Dec 10, 2007 11:40 AM, Jim Barrows <[hidden email]> wrote:
> > Or, at least provide a better starting point then the java date stuff :)
> >
> >
> > On Dec 10, 2007 10:22 AM, Adrian Crum <[hidden email]> wrote:
> > > Jim,
> > >
> > > That looks very interesting! We already have the UtilDateTime class that does pretty much the same
> > > thing. I'll take a look at it - there's a chance we can eliminate a lot of OFBiz code by going with
> > > the joda-time code.
> > >
> > > -Adrian
> > >
> > >
> > > Jim Barrows wrote:
> > >
> > > > What about wrapping joda time (joda-time.sourceforge.net) up in mini-lang?
> > > >
> > > > On Dec 10, 2007 10:04 AM, Chris Howe <[hidden email]> 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 <[hidden email]>
> > > >>To: [hidden email]
> > > >>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 same
> > > >>
> > > >>convention 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 adjusters
> > > >>
> > > >> produces
> > > >>
> > > >>>an error.
> > > >>>
> > > >>>Adjustments would be performed using the minilang context's locale
> > > >>
> > > >> and
> > > >>
> > > >>>time 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" <[hidden email]>
> > > >>>>
> > > >>>>>I agree with Chris. I haven't looked at the issue lately, but when
> > > >>
> > > >> I
> > > >>
> > > >>>>>first looked at it, it simply performed millisecond
> > > >>>>
> > > >>>>arithmetic. That might not be the expected behavior.
> > > >>>>
> > > >>>>
> > > >>>>>Date calculation would be a great addition to mini language. Maybe
> > > >>
> > > >> we
> > > >>
> > > >>>>>should discuss how it would look in mini lang code, then an
> > > >>>>
> > > >>>>implementation could be submitted.
> > > >>>>
> > > >>>>
> > > >>>>>-Adrian
> > > >>>>>
> > > >>>>>Jacques Le Roux <[hidden email]> 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 being
> > > >>
> > > >>>>>>cast to a long.  Also, I don't think the current
> > > >>>>>
> > > >>>>>element structure is best suited for the operations that would be
> > > >>>>>most beneficial for date/time calculations
> > > >>>>>
> > > >>>>>
> > > >>>>>>----- Original Message ----
> > > >>>>>>From: Jacques Le Roux
> > > >>>>>>To: [hidden email]
> > > >>>>>>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 interesting
> > > >>
> > > >> patches.
> > > >>
> > > >>>>>>One of them is https://issues.apache.org/jira/browse/OFBIZ-1249
> > > >>>>>>David asked <
> > > >>>>>>do a design and requirements brainstorming discussion on the dev
> > > >>
> > > >> list
> > > >>
> > > >>>>>>before putting this in.
> > > >>>>>>The main thing I'm wondering is if there are other similar
> > > >>
> > > >> requirements
> > > >>
> > > >>>>>>that could be satisfied by small changes in the design of this.>>
> > > >>>>>>
> > > >>>>>>I would like to commit this patch now except if we begin to
> > > >>
> > > >> exchange
> > > >>
> > > >>>>>>about new requirements per David suggestion
> > > >>>>>>
> > > >>>>>>Thanks
> > > >>>>>>
> > > >>>>>>Jacques
> > > >>>>>>
> > > >>>>>>
> > > >>>>>
> > > >>>>>
> > > >>>>>
> > > >>>>>
> > > >>>>>---------------------------------
> > > >>>>>Looking for last minute shopping deals?  Find them fast with Yahoo!
> > > >>
> > > >>>>>Search.
> > > >>>>
> > > >>>>
> > > >>>>
> > > >>
> > > >>
> > > >>
> > > >>
> > > >
> > > >
> > > >
> > >
> > >
> >
> >
> >
> > --
> > James A Barrows
> >
>
>
>
> --
> Fabien Carrion
>
> ()  Campagne du ruban ASCII -- Contre les mails en html
> /\  contre les pieces-jointes Microsoft
> Web: http://fabien.carrion.free.fr/
>

Reply | Threaded
Open this post in threaded view
|

Re: Calculate on a DATE object in minilang

Jacques Le Roux
Administrator
In reply to this post by Jacopo Cappellato
We should 1st create a Jira issue for this, isn'it (maybe there is already one) ? I guess your example is a good base for that using
all adjusters Adrian proposed   years="${year}"... millis="${millis}".
Adrian proposed that the field "field=" could be optionnal, so the adjusters fields, but there must be at least one of them
(including "field=" in them ?) I don't think a such a rule is already used in minilang.

Jacques


De : "Jacopo Cappellato" <[hidden email]>

> 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

Jacques

De : "Jacopo Cappellato" <[hidden email]>

> I'm keeping this thread alive because I have a wish to see the
> <set-calendar> (or <adjust-date-time>) operation implemented: in fact in
> the Minilang service I've committed yesterday to close a financial time
> period we have the requirement to get a Timestamp (older than an
> existing one of a few seconds).
> I'm wondering if someone here could help with this task... maybe Adrian
> "The Lord Of Time" Crum? ;-)
>
> Jacopo
>
>
> Jacques Le Roux wrote:
> > I just had a cursory review, yes seems like a good idea. I agree with Adrian view : rely on joda team as possible. And maybe
help

> > them also, though joda looks like being already very well advanced.
> >
> > +1 for me
> >
> > Jacques
> >
> > De : "Jim Barrows" <[hidden email]>
> >> Or, at least provide a better starting point then the java date stuff :)
> >>
> >> On Dec 10, 2007 10:22 AM, Adrian Crum <[hidden email]> wrote:
> >>> Jim,
> >>>
> >>> That looks very interesting! We already have the UtilDateTime class that does pretty much the same
> >>> thing. I'll take a look at it - there's a chance we can eliminate a lot of OFBiz code by going with
> >>> the joda-time code.
> >>>
> >>> -Adrian
> >>>
> >>>
> >>> Jim Barrows wrote:
> >>>
> >>>> What about wrapping joda time (joda-time.sourceforge.net) up in mini-lang?
> >>>>
> >>>> On Dec 10, 2007 10:04 AM, Chris Howe <[hidden email]> 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 <[hidden email]>
> >>>>> To: [hidden email]
> >>>>> 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 same
> >>>>>
> >>>>> convention 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 adjusters
> >>>>> produces
> >>>>>
> >>>>>> an error.
> >>>>>>
> >>>>>> Adjustments would be performed using the minilang context's locale
> >>>>> and
> >>>>>
> >>>>>> time 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" <[hidden email]>
> >>>>>>>
> >>>>>>>> I agree with Chris. I haven't looked at the issue lately, but when
> >>>>> I
> >>>>>
> >>>>>>>> first looked at it, it simply performed millisecond
> >>>>>>> arithmetic. That might not be the expected behavior.
> >>>>>>>
> >>>>>>>
> >>>>>>>> Date calculation would be a great addition to mini language. Maybe
> >>>>> we
> >>>>>
> >>>>>>>> should discuss how it would look in mini lang code, then an
> >>>>>>> implementation could be submitted.
> >>>>>>>
> >>>>>>>
> >>>>>>>> -Adrian
> >>>>>>>>
> >>>>>>>> Jacques Le Roux <[hidden email]> 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 being
> >>>>>>>>> cast to a long.  Also, I don't think the current
> >>>>>>>> element structure is best suited for the operations that would be
> >>>>>>>> most beneficial for date/time calculations
> >>>>>>>>
> >>>>>>>>
> >>>>>>>>> ----- Original Message ----
> >>>>>>>>> From: Jacques Le Roux
> >>>>>>>>> To: [hidden email]
> >>>>>>>>> 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 interesting
> >>>>> patches.
> >>>>>
> >>>>>>>>> One of them is https://issues.apache.org/jira/browse/OFBIZ-1249
> >>>>>>>>> David asked <
> >>>>>>>>> do a design and requirements brainstorming discussion on the dev
> >>>>> list
> >>>>>
> >>>>>>>>> before putting this in.
> >>>>>>>>> The main thing I'm wondering is if there are other similar
> >>>>> requirements
> >>>>>
> >>>>>>>>> that could be satisfied by small changes in the design of this.>>
> >>>>>>>>>
> >>>>>>>>> I would like to commit this patch now except if we begin to
> >>>>> exchange
> >>>>>
> >>>>>>>>> about new requirements per David suggestion
> >>>>>>>>>
> >>>>>>>>> Thanks
> >>>>>>>>>
> >>>>>>>>> Jacques
> >>>>>>>>>
> >>>>>>>>>
> >>>>>>>>
> >>>>>>>>
> >>>>>>>>
> >>>>>>>> ---------------------------------
> >>>>>>>> Looking for last minute shopping deals?  Find them fast with Yahoo!
> >>>>>>>> Search.
> >>>>>>>
> >>>>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>
> >>>>
> >>>
> >>
> >>
> >> --
> >> James A Barrows
> >>
>

Reply | Threaded
Open this post in threaded view
|

Re: Calculate on a DATE object in minilang

Adrian Crum
Jacques,

If you go back to the start of this thread, you will see that there is an existing Jira issue.

Jacopo,

I would be happy to work on this. It would help if someone could C&P the minilang format we
discussed into the Jira issue, then I will work on it as soon as I'm done with a project at work.

-Adrian

Jacques Le Roux wrote:

> We should 1st create a Jira issue for this, isn'it (maybe there is already one) ? I guess your example is a good base for that using
> all adjusters Adrian proposed   years="${year}"... millis="${millis}".
> Adrian proposed that the field "field=" could be optionnal, so the adjusters fields, but there must be at least one of them
> (including "field=" in them ?) I don't think a such a rule is already used in minilang.
>
> Jacques
>
>
> De : "Jacopo Cappellato" <[hidden email]>
>
>>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
>
>
> Jacques
>
> De : "Jacopo Cappellato" <[hidden email]>
>
>>I'm keeping this thread alive because I have a wish to see the
>><set-calendar> (or <adjust-date-time>) operation implemented: in fact in
>>the Minilang service I've committed yesterday to close a financial time
>>period we have the requirement to get a Timestamp (older than an
>>existing one of a few seconds).
>>I'm wondering if someone here could help with this task... maybe Adrian
>>"The Lord Of Time" Crum? ;-)
>>
>>Jacopo
>>
>>
>>Jacques Le Roux wrote:
>>
>>>I just had a cursory review, yes seems like a good idea. I agree with Adrian view : rely on joda team as possible. And maybe
>
> help
>
>>>them also, though joda looks like being already very well advanced.
>>>
>>>+1 for me
>>>
>>>Jacques
>>>
>>>De : "Jim Barrows" <[hidden email]>
>>>
>>>>Or, at least provide a better starting point then the java date stuff :)
>>>>
>>>>On Dec 10, 2007 10:22 AM, Adrian Crum <[hidden email]> wrote:
>>>>
>>>>>Jim,
>>>>>
>>>>>That looks very interesting! We already have the UtilDateTime class that does pretty much the same
>>>>>thing. I'll take a look at it - there's a chance we can eliminate a lot of OFBiz code by going with
>>>>>the joda-time code.
>>>>>
>>>>>-Adrian
>>>>>
>>>>>
>>>>>Jim Barrows wrote:
>>>>>
>>>>>
>>>>>>What about wrapping joda time (joda-time.sourceforge.net) up in mini-lang?
>>>>>>
>>>>>>On Dec 10, 2007 10:04 AM, Chris Howe <[hidden email]> 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 <[hidden email]>
>>>>>>>To: [hidden email]
>>>>>>>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 same
>>>>>>>
>>>>>>>convention 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 adjusters
>>>>>>>
>>>>>>>produces
>>>>>>>
>>>>>>>
>>>>>>>>an error.
>>>>>>>>
>>>>>>>>Adjustments would be performed using the minilang context's locale
>>>>>>>
>>>>>>>and
>>>>>>>
>>>>>>>
>>>>>>>>time 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" <[hidden email]>
>>>>>>>>>
>>>>>>>>>>I agree with Chris. I haven't looked at the issue lately, but when
>>>>>>>
>>>>>>>I
>>>>>>>
>>>>>>>
>>>>>>>>>>first looked at it, it simply performed millisecond
>>>>>>>>>
>>>>>>>>>arithmetic. That might not be the expected behavior.
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>>Date calculation would be a great addition to mini language. Maybe
>>>>>>>
>>>>>>>we
>>>>>>>
>>>>>>>
>>>>>>>>>>should discuss how it would look in mini lang code, then an
>>>>>>>>>
>>>>>>>>>implementation could be submitted.
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>>-Adrian
>>>>>>>>>>
>>>>>>>>>>Jacques Le Roux <[hidden email]> 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 being
>>>>>>>>>>>cast to a long.  Also, I don't think the current
>>>>>>>>>>
>>>>>>>>>>element structure is best suited for the operations that would be
>>>>>>>>>>most beneficial for date/time calculations
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>>----- Original Message ----
>>>>>>>>>>>From: Jacques Le Roux
>>>>>>>>>>>To: [hidden email]
>>>>>>>>>>>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 interesting
>>>>>>>
>>>>>>>patches.
>>>>>>>
>>>>>>>
>>>>>>>>>>>One of them is https://issues.apache.org/jira/browse/OFBIZ-1249
>>>>>>>>>>>David asked <
>>>>>>>>>>>do a design and requirements brainstorming discussion on the dev
>>>>>>>
>>>>>>>list
>>>>>>>
>>>>>>>
>>>>>>>>>>>before putting this in.
>>>>>>>>>>>The main thing I'm wondering is if there are other similar
>>>>>>>
>>>>>>>requirements
>>>>>>>
>>>>>>>
>>>>>>>>>>>that could be satisfied by small changes in the design of this.>>
>>>>>>>>>>>
>>>>>>>>>>>I would like to commit this patch now except if we begin to
>>>>>>>
>>>>>>>exchange
>>>>>>>
>>>>>>>
>>>>>>>>>>>about new requirements per David suggestion
>>>>>>>>>>>
>>>>>>>>>>>Thanks
>>>>>>>>>>>
>>>>>>>>>>>Jacques
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>---------------------------------
>>>>>>>>>>Looking for last minute shopping deals?  Find them fast with Yahoo!
>>>>>>>>>>Search.
>>>>>>>>>
>>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>
>>>>
>>>>--
>>>>James A Barrows
>>>>
>>
>
>

12