You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Helmut Tammen <HT...@htsystemloesungen.de> on 2004/01/15 16:16:59 UTC
[Woody] Error in date convertor?
On a woody form I want to use a field to select a month. Therefore I use
the following code. Everything is looking fine. But when I select
"April" the variable selectedMonth (see below) is set to 31st of March.
When using a workaround (see workaround) I get the right date (1st of
April) but in the form I can´t select the month alone but the month and
year together.
Is it an error of woody?
Helmut
Model:
<wd:field id="month" required="true">
<wd:label>Wählen Sie den Bearbeitungsmonat aus:</wd:label>
<wd:datatype base="date">
<wd:convertor type="formatting">
<wd:patterns>
<wd:pattern>MMMM</wd:pattern>
</wd:patterns>
</wd:convertor>
</wd:datatype>
<wd:selection-list>
<!-- The convertor element here is used to specify how the
values in the value attributes of the wd:item elements
should be interpreted. -->
<wd:convertor type="formatting">
<wd:patterns>
<wd:pattern>MM</wd:pattern>
</wd:patterns>
</wd:convertor>
<wd:item value="01"/>
<wd:item value="02"/>
<wd:item value="03"/>
<wd:item value="04"/>
<wd:item value="05"/>
<wd:item value="06"/>
<wd:item value="07"/>
<wd:item value="08"/>
<wd:item value="09"/>
<wd:item value="10"/>
<wd:item value="11"/>
<wd:item value="12"/>
</wd:selection-list>
</wd:field>
Template:
<wt:widget id="month"/>
Flow:
var model = form.getModel();
var selectedMonth = model.month
Workaround:
<wd:field id="month" required="true">
<wd:label>Wählen Sie den Bearbeitungsmonat aus:</wd:label>
<wd:datatype base="date">
<wd:convertor type="formatting">
<wd:patterns>
<wd:pattern>MMMM.yyyy</wd:pattern>
</wd:patterns>
</wd:convertor>
</wd:datatype>
<wd:selection-list>
<!-- The convertor element here is used to specify how the
values in the value attributes of the wd:item elements
should be interpreted. -->
<wd:convertor type="formatting">
<wd:patterns>
<wd:pattern>dd.MM.yyyy</wd:pattern>
</wd:patterns>
</wd:convertor>
<wd:item value="01.01.2004"/>
<wd:item value="01.02.2004"/>
<wd:item value="01.03.2004"/>
<wd:item value="01.04.2004"/>
<wd:item value="01.05.2004"/>
<wd:item value="01.06.2004"/>
<wd:item value="01.07.2004"/>
<wd:item value="01.08.2004"/>
<wd:item value="01.09.2004"/>
<wd:item value="01.10.2004"/>
<wd:item value="01.11.2004"/>
<wd:item value="01.12.2004"/>
</wd:selection-list>
</wd:field>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
Re: [Woody] Error in date convertor?
Posted by Helmut Tammen <HT...@htsystemloesungen.de>.
Jim Horner schrieb:
>> <wd:pattern>MM</wd:pattern>
>> </wd:patterns>
>> </wd:convertor>
>> <wd:item value="01"/>
>
>
> java.util.Calendar.JANUARY = 0 ... could starting from 1 instead of 0 be the
> problem?
When starting from 0 December is the first month in the list.
When starting from 1 it works fine for Jan., Feb. and March. But from
April on it´s delivering the wrong date (last day of the month before).
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
Re: [Woody] Error in date convertor?
Posted by Jim Horner <jh...@arinbe.com>.
> <wd:pattern>MM</wd:pattern>
> </wd:patterns>
> </wd:convertor>
> <wd:item value="01"/>
java.util.Calendar.JANUARY = 0 ... could starting from 1 instead of 0 be the
problem?
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org