You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@wicket.apache.org by Daniel Stoch <da...@gmail.com> on 2010/08/20 16:31:15 UTC

DateTextField converter does not honor current locale

Hi,

I think there is a small bug in
org.apache.wicket.extensions.markup.html.form.DateTextField.
A DateConverter is created in the constructor:

                converter = new DateConverter()
		{
			private static final long serialVersionUID = 1L;

			/**
			 * @see org.apache.wicket.util.convert.converters.DateConverter#getDateFormat(java.util.Locale)
			 */
			@Override
			public DateFormat getDateFormat(Locale locale)
			{
				return new SimpleDateFormat(DateTextField.this.datePattern);
			}
		};

But I think getDateFormat(...) method should looks like:

@Override
public DateFormat getDateFormat(Locale locale)
{
        if (locale == null)
	{
		locale = Locale.getDefault();
	}
	return new SimpleDateFormat(DateTextField.this.datePattern. locale);
}

--
Daniel

Re: DateTextField converter does not honor current locale

Posted by Daniel Stoch <da...@gmail.com>.
WICKET-3025
(https://issues.apache.org/jira/browse/WICKET-3025)

--
Daniel

On Fri, Aug 20, 2010 at 6:42 PM, Igor Vaynberg <ig...@gmail.com> wrote:
> please file a jira issue
>
> -igor
>
> On Fri, Aug 20, 2010 at 7:31 AM, Daniel Stoch <da...@gmail.com> wrote:
>> Hi,
>>
>> I think there is a small bug in
>> org.apache.wicket.extensions.markup.html.form.DateTextField.
>> A DateConverter is created in the constructor:
>>
>>                converter = new DateConverter()
>>                {
>>                        private static final long serialVersionUID = 1L;
>>
>>                        /**
>>                         * @see org.apache.wicket.util.convert.converters.DateConverter#getDateFormat(java.util.Locale)
>>                         */
>>                        @Override
>>                        public DateFormat getDateFormat(Locale locale)
>>                        {
>>                                return new SimpleDateFormat(DateTextField.this.datePattern);
>>                        }
>>                };
>>
>> But I think getDateFormat(...) method should looks like:
>>
>> @Override
>> public DateFormat getDateFormat(Locale locale)
>> {
>>        if (locale == null)
>>        {
>>                locale = Locale.getDefault();
>>        }
>>        return new SimpleDateFormat(DateTextField.this.datePattern. locale);
>> }
>>
>> --
>> Daniel
>>
>

Re: DateTextField converter does not honor current locale

Posted by Igor Vaynberg <ig...@gmail.com>.
please file a jira issue

-igor

On Fri, Aug 20, 2010 at 7:31 AM, Daniel Stoch <da...@gmail.com> wrote:
> Hi,
>
> I think there is a small bug in
> org.apache.wicket.extensions.markup.html.form.DateTextField.
> A DateConverter is created in the constructor:
>
>                converter = new DateConverter()
>                {
>                        private static final long serialVersionUID = 1L;
>
>                        /**
>                         * @see org.apache.wicket.util.convert.converters.DateConverter#getDateFormat(java.util.Locale)
>                         */
>                        @Override
>                        public DateFormat getDateFormat(Locale locale)
>                        {
>                                return new SimpleDateFormat(DateTextField.this.datePattern);
>                        }
>                };
>
> But I think getDateFormat(...) method should looks like:
>
> @Override
> public DateFormat getDateFormat(Locale locale)
> {
>        if (locale == null)
>        {
>                locale = Locale.getDefault();
>        }
>        return new SimpleDateFormat(DateTextField.this.datePattern. locale);
> }
>
> --
> Daniel
>