You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Josh Kamau <jo...@gmail.com> on 2010/02/05 09:25:03 UTC

Application-wide date formate

Hi guys;

Kindly help me set the application-wide date format independent of the
locale.


regards.

Re: Application-wide date formate

Posted by Stijn Maller <st...@gmail.com>.
Doesn't help with your date picker problem, but to set the application-wide
format you can call this in your application's init method:

((ConverterLocator)getConverterLocator()).set(Date.class, new
PatternDateConverter(DATE_PATTERN, true))

On 5 February 2010 09:25, Josh Kamau <jo...@gmail.com> wrote:

> Hi guys;
>
> Kindly help me set the application-wide date format independent of the
> locale.
>
>
> regards.
>

Re: Application-wide date formate

Posted by Josh Kamau <jo...@gmail.com>.
I did this and it worked.

txtStartDate = new DateTextField("txtStartDate", new
Model<Date>(startDate.toDate()),"dd-MMM-yyyy");

josh.

On Fri, Feb 5, 2010 at 12:22 PM, Peter Thomas <pt...@gmail.com> wrote:

> On Fri, Feb 5, 2010 at 2:42 PM, Josh Kamau <jo...@gmail.com> wrote:
>
> > Hi guys;
> >
> > I am getting frustrated trying to display date in the format
> "dd-MMM-yyyy"
> > e.g 05-FEB-2010.
> >
> > i am using a TextField<Date> and a
> > org.apache.wicket.extensions.yui.calendar.DatePicker . I have added the
> > date
> > picker to the textfield as required.
> >
> > After i pick the date from the datepicker popup, i want to to insert the
> > date in the above format. I have tried writting a converter, overriding
> the
> > get/setModelObject on the textfield among other things but it wont work.
> > Anyone suggest a different date picker component that i can use?
> >
>
> You can try roll your own picker using YUI, here's some code I wrote that
> does this:
>
>
> http://fisheye3.atlassian.com/browse/j-trac/trunk/jtrac/src/main/java/info/jtrac/wicket/yui/YuiCalendar.java?r=HEAD
>
>
> http://fisheye3.atlassian.com/browse/j-trac/trunk/jtrac/src/main/webapp/resources/yui/calendar/calendar-utils.js?r=HEAD
>
> I had to use some extra JS (see link above) to set the format on the YUI
> side, hope this helps.  Disclaimer: code is a little old though, old
> version
> of YUI, referencing JS from context relative path not really recommended -
> prefer relative to java package etc.
>
> - Peter
>
>
>
> >
> > regards.
> >
> > Josh
> >
> > On Fri, Feb 5, 2010 at 11:25 AM, Josh Kamau <jo...@gmail.com>
> wrote:
> >
> > > Hi guys;
> > >
> > > Kindly help me set the application-wide date format independent of the
> > > locale.
> > >
> > >
> > > regards.
> > >
> >
>

Re: Application-wide date formate

Posted by Peter Thomas <pt...@gmail.com>.
On Fri, Feb 5, 2010 at 2:42 PM, Josh Kamau <jo...@gmail.com> wrote:

> Hi guys;
>
> I am getting frustrated trying to display date in the format "dd-MMM-yyyy"
> e.g 05-FEB-2010.
>
> i am using a TextField<Date> and a
> org.apache.wicket.extensions.yui.calendar.DatePicker . I have added the
> date
> picker to the textfield as required.
>
> After i pick the date from the datepicker popup, i want to to insert the
> date in the above format. I have tried writting a converter, overriding the
> get/setModelObject on the textfield among other things but it wont work.
> Anyone suggest a different date picker component that i can use?
>

You can try roll your own picker using YUI, here's some code I wrote that
does this:

http://fisheye3.atlassian.com/browse/j-trac/trunk/jtrac/src/main/java/info/jtrac/wicket/yui/YuiCalendar.java?r=HEAD

http://fisheye3.atlassian.com/browse/j-trac/trunk/jtrac/src/main/webapp/resources/yui/calendar/calendar-utils.js?r=HEAD

I had to use some extra JS (see link above) to set the format on the YUI
side, hope this helps.  Disclaimer: code is a little old though, old version
of YUI, referencing JS from context relative path not really recommended -
prefer relative to java package etc.

- Peter



>
> regards.
>
> Josh
>
> On Fri, Feb 5, 2010 at 11:25 AM, Josh Kamau <jo...@gmail.com> wrote:
>
> > Hi guys;
> >
> > Kindly help me set the application-wide date format independent of the
> > locale.
> >
> >
> > regards.
> >
>

Re: Application-wide date formate

Posted by Josh Kamau <jo...@gmail.com>.
Hi guys;

I am getting frustrated trying to display date in the format "dd-MMM-yyyy"
e.g 05-FEB-2010.

i am using a TextField<Date> and a
org.apache.wicket.extensions.yui.calendar.DatePicker . I have added the date
picker to the textfield as required.

After i pick the date from the datepicker popup, i want to to insert the
date in the above format. I have tried writting a converter, overriding the
get/setModelObject on the textfield among other things but it wont work.
Anyone suggest a different date picker component that i can use?

regards.

Josh

On Fri, Feb 5, 2010 at 11:25 AM, Josh Kamau <jo...@gmail.com> wrote:

> Hi guys;
>
> Kindly help me set the application-wide date format independent of the
> locale.
>
>
> regards.
>