Re: Override tapestry5 datefield default format

abangkis <[email protected]>
Newsgroups gmane.comp.java.tapestry.user
Message-ID <CAGqeSzUtivS9MAN0R=yAU2dJa7vNu375bGuWer2HrqA_JW5UEQ@mail.gmail.com>
Hi thiago,

Sorry, i'm having a bit of trouble understanding your explanation.

Lets say i pick April 10th, 2018 from my date picker in my page. It will
fill the field with 04/10/2018.  While the format we expected is
10-04-2018. I could override the field and specify the format in the
template

<t:datefield t:id="birthdate" value="borrower?.birthdate"
*format="dd-MM-yyyy"* t:mixins="formgroup"/>

but that means i have to do this for every datepicker i have.

I was thinking maybe there's some kind of contribution that I can override
in the app module. Something like

@Contribute(DateField.class)
public static void overrideDefaultFormat(MappedConfiguration configuration)
{

configuration.add(SymbolConstants.DATEFIELD_DEFAULT_FORMAT, "dd-MM-yyyy");
}

I hope this clear up my question.

Regards


On Tue, Apr 10, 2018 at 8:17 PM, Thiago H. de Paula Figueiredo <
[email protected]> wrote:

> Hello!
>
> The default format is taken from
> DateFormat.getDateInstance(DateFormat.SHORT, locale), where locale is got
> through @Inject. Is your desired date format the one returned by that
> method for your locale?
>
> On Tue, Apr 10, 2018 at 5:26 AM, abangkis <[email protected]> wrote:
>
> > Hi, is there a quick way to override tapestry datefield default format?
> In
> > a single datefield i can do
> >
> > <t:datefield t:id="birthdate" value="borrower?.birthdate"
> > format="dd-MM-yyyy"
> >     t:mixins="formgroup"/>
> >
> > But it became very repetitive for many pages.
> >
> > Regards
> >
> >
> >
> > --
> > http://www.mreunionlabs.net/ <http://www.mreunion-labs.net/>
> > twitter : @mreunionlabs @abangkis
> > page : https://plus.google.com/104168782385184990771
> >
>
>
>
> --
> Thiago
>



-- 
http://www.mreunionlabs.net/ <http://www.mreunion-labs.net/>
twitter : @mreunionlabs @abangkis
page : https://plus.google.com/104168782385184990771
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.