You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Allen Gilliland <al...@sun.com> on 2007/06/05 19:48:12 UTC

datetimepicker shows 1907 when populated from existing value

I'm having a problem with the datetimepicker where it always thinks the 
year is 1907 when it gets loaded from an existing value.  I have only 
been able to find this thread on the issue which suggests there is a bug 
but doesn't really provide any real work around ...

http://www.mail-archive.com/user@struts.apache.org/msg61093.html

I am using a String to store the value from the date picker as suggested 
by the last message in the thread but I am still getting the same behavior.

Is there any solution or work around to this problem using struts 2.0.6?

-- Allen

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: datetimepicker shows 1907 when populated from existing value

Posted by Allen Gilliland <al...@sun.com>.

Musachy Barroso wrote:
> On 6/5/07, Allen Gilliland <al...@sun.com> wrote:
>>
>> I am just using the default settings ...
>>
>> <s:datetimepicker name="bean.dateString" />
>>
>> when the form is submitted i see that there are actually 2 values
>> submitted, the dojo.bean.dateString and bean.dateString.  the format for
>> dojo.bean.dateString is RFC 3339 and the format of bean.dateString is
>> DateFormat.SHORT (mm/dd/yy).
> 
> 
> That's the bug you mentioned earlier, the value in
> dojo.bean.dateStringshould be the text that is entered on the date
> picker(which is ignored by
> S2), and the one in bean.dateString should be the RFC, but they are 
> switched
> :(
> 
> 
> 
>> i am assuming that when the datetimepicker is being initialized from an
>> existing value it has to be looking at the value of bean.dateString,
>> which if i select today has a value of "6/5/07".  perhaps it's not
>> properly converting that display date into the RFC 3339 value it uses
>> internally?
> 
> 
> When the date picker gets the value from the stack, if it isn't a Date
> object, it will try to parse it using the value of the displayFormat, and
> then format it to RFC (Dojo wants it in  RFC). If the value cannot be 
> parsed
> then it will be passed to Dojo as is. That's why I suggested to use RFC
> 3339.
> 
> On 2.1 the datepicker will be able to use Calendar, Date and String fields
> (different formats will be used to try to parse from the String,
> SimpleDateFormat.*, RFC 3399, and displayFormat)
> 
> //I almost sound like I'm trying to sell 2.1 :)

I wish it was already out so that I could use it.

In any case, it sounds like there are a number of bugs with the current 
datetimepicker so I think I'll find an alternative solution until 2.1 
comes out and the bugs are worked out.

Thanks for the explanation.

-- Allen


> 
> musachy
> 
> 
> -- Allen
>>
>>
>> Musachy Barroso wrote:
>> > What is the format of the date in the string? If you stick to RFC 3339
>> it
>> > should be fine : yyyy-MM-dd (this is just the value, the display format
>> can
>> > be set using the "displayFormat" attribute)
>> >
>> > musachy
>> >
>> > On 6/5/07, Allen Gilliland <al...@sun.com> wrote:
>> >>
>> >> I'm having a problem with the datetimepicker where it always thinks 
>> the
>> >> year is 1907 when it gets loaded from an existing value.  I have only
>> >> been able to find this thread on the issue which suggests there is a
>> bug
>> >> but doesn't really provide any real work around ...
>> >>
>> >> http://www.mail-archive.com/user@struts.apache.org/msg61093.html
>> >>
>> >> I am using a String to store the value from the date picker as
>> suggested
>> >> by the last message in the thread but I am still getting the same
>> >> behavior.
>> >>
>> >> Is there any solution or work around to this problem using struts 
>> 2.0.6
>> ?
>> >>
>> >> -- Allen
>> >>
>> >> ---------------------------------------------------------------------
>> >> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> >> For additional commands, e-mail: user-help@struts.apache.org
>> >>
>> >>
>> >
>> >
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>>
>>
> 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: datetimepicker shows 1907 when populated from existing value

Posted by Musachy Barroso <mu...@gmail.com>.
On 6/5/07, Allen Gilliland <al...@sun.com> wrote:
>
> I am just using the default settings ...
>
> <s:datetimepicker name="bean.dateString" />
>
> when the form is submitted i see that there are actually 2 values
> submitted, the dojo.bean.dateString and bean.dateString.  the format for
> dojo.bean.dateString is RFC 3339 and the format of bean.dateString is
> DateFormat.SHORT (mm/dd/yy).


That's the bug you mentioned earlier, the value in
dojo.bean.dateStringshould be the text that is entered on the date
picker(which is ignored by
S2), and the one in bean.dateString should be the RFC, but they are switched
:(



> i am assuming that when the datetimepicker is being initialized from an
> existing value it has to be looking at the value of bean.dateString,
> which if i select today has a value of "6/5/07".  perhaps it's not
> properly converting that display date into the RFC 3339 value it uses
> internally?


When the date picker gets the value from the stack, if it isn't a Date
object, it will try to parse it using the value of the displayFormat, and
then format it to RFC (Dojo wants it in  RFC). If the value cannot be parsed
then it will be passed to Dojo as is. That's why I suggested to use RFC
3339.

On 2.1 the datepicker will be able to use Calendar, Date and String fields
(different formats will be used to try to parse from the String,
SimpleDateFormat.*, RFC 3399, and displayFormat)

//I almost sound like I'm trying to sell 2.1 :)

musachy


-- Allen
>
>
> Musachy Barroso wrote:
> > What is the format of the date in the string? If you stick to RFC 3339
> it
> > should be fine : yyyy-MM-dd (this is just the value, the display format
> can
> > be set using the "displayFormat" attribute)
> >
> > musachy
> >
> > On 6/5/07, Allen Gilliland <al...@sun.com> wrote:
> >>
> >> I'm having a problem with the datetimepicker where it always thinks the
> >> year is 1907 when it gets loaded from an existing value.  I have only
> >> been able to find this thread on the issue which suggests there is a
> bug
> >> but doesn't really provide any real work around ...
> >>
> >> http://www.mail-archive.com/user@struts.apache.org/msg61093.html
> >>
> >> I am using a String to store the value from the date picker as
> suggested
> >> by the last message in the thread but I am still getting the same
> >> behavior.
> >>
> >> Is there any solution or work around to this problem using struts 2.0.6
> ?
> >>
> >> -- Allen
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> >> For additional commands, e-mail: user-help@struts.apache.org
> >>
> >>
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>


-- 
"Hey you! Would you help me to carry the stone?" Pink Floyd

Re: datetimepicker shows 1907 when populated from existing value

Posted by Allen Gilliland <al...@sun.com>.
I am just using the default settings ...

<s:datetimepicker name="bean.dateString" />

when the form is submitted i see that there are actually 2 values 
submitted, the dojo.bean.dateString and bean.dateString.  the format for 
dojo.bean.dateString is RFC 3339 and the format of bean.dateString is 
DateFormat.SHORT (mm/dd/yy).

if i start with a fresh form and no pre-populated data, select a date 
and submit, the value is properly in 2007.  but if that field is 
pre-populated because of a validation error or from existing data then 
it seems to always show 1907, both in the date selector and in the value 
if i submit the form again.

i am assuming that when the datetimepicker is being initialized from an 
existing value it has to be looking at the value of bean.dateString, 
which if i select today has a value of "6/5/07".  perhaps it's not 
properly converting that display date into the RFC 3339 value it uses 
internally?

-- Allen


Musachy Barroso wrote:
> What is the format of the date in the string? If you stick to RFC 3339 it
> should be fine : yyyy-MM-dd (this is just the value, the display format can
> be set using the "displayFormat" attribute)
> 
> musachy
> 
> On 6/5/07, Allen Gilliland <al...@sun.com> wrote:
>>
>> I'm having a problem with the datetimepicker where it always thinks the
>> year is 1907 when it gets loaded from an existing value.  I have only
>> been able to find this thread on the issue which suggests there is a bug
>> but doesn't really provide any real work around ...
>>
>> http://www.mail-archive.com/user@struts.apache.org/msg61093.html
>>
>> I am using a String to store the value from the date picker as suggested
>> by the last message in the thread but I am still getting the same
>> behavior.
>>
>> Is there any solution or work around to this problem using struts 2.0.6?
>>
>> -- Allen
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>>
>>
> 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: datetimepicker shows 1907 when populated from existing value

Posted by Musachy Barroso <mu...@gmail.com>.
What is the format of the date in the string? If you stick to RFC 3339 it
should be fine : yyyy-MM-dd (this is just the value, the display format can
be set using the "displayFormat" attribute)

musachy

On 6/5/07, Allen Gilliland <al...@sun.com> wrote:
>
> I'm having a problem with the datetimepicker where it always thinks the
> year is 1907 when it gets loaded from an existing value.  I have only
> been able to find this thread on the issue which suggests there is a bug
> but doesn't really provide any real work around ...
>
> http://www.mail-archive.com/user@struts.apache.org/msg61093.html
>
> I am using a String to store the value from the date picker as suggested
> by the last message in the thread but I am still getting the same
> behavior.
>
> Is there any solution or work around to this problem using struts 2.0.6?
>
> -- Allen
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>


-- 
"Hey you! Would you help me to carry the stone?" Pink Floyd