Hi!

Your question was clear. There's no such configuration symbol due to the
way way DateField defines which format to use, which is calling
DateFormat.getDateInstance(DateFormat.SHORT, locale).

A possibility is to create your own DateField class by copying the source
from the Tapestry one, customizing it to your needs and contributing it to
the ComponentOverride service. Something like this, not tested:

public static void contributeComponentOverride(MappedConfiguration<Class,
Class> configuration) {
    configuration.add(DateField.class, YourDateField.class);
}

Doing this, Tapestry will use YourDateField instead of DateField when you
have a <t:datefield> or <input t:type="DateField">.

On Tue, Apr 10, 2018 at 1:04 PM, abangkis <abang...@gmail.com> wrote:

> 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 <
> thiag...@gmail.com> 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 <abang...@gmail.com> 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
>



-- 
Thiago

Reply via email to