1. #1
    Ext User
    Join Date
    Mar 2009
    Posts
    2
    Vote Rating
    0
    lensesby is on a distinguished road

      0  

    Default How to change date format after a date field has been created?

    How to change date format after a date field has been created?


    I defined " format: 'm/d/Y' " in my date field configuration, but i need to give my user another format choice 'd/m/Y'. I searched in the forum, but can't find how to change the format setting after a date field has been created. May be i shouldn't do it this way, can anyone give me some advice? thanks

  2. #2
    Sencha - Community Support Team jay@moduscreate.com's Avatar
    Join Date
    Mar 2007
    Location
    Frederick MD, NYC, DC
    Posts
    16,169
    Vote Rating
    28
    jay@moduscreate.com is a jewel in the rough jay@moduscreate.com is a jewel in the rough jay@moduscreate.com is a jewel in the rough jay@moduscreate.com is a jewel in the rough

      0  

    Default


    Have you looked at the API?

    altFormats : String

    Multiple date formats separated by "|" to try when parsing a user input value and it doesn't match the defined format (defaults to 'm/d/Y|n/j/Y|n/j/y|m/j/y|n/d/y|m/j/Y|n/d/Y|m-d-y|m-d-Y|m/d|m-d|md|mdy|mdY|d|Y-m-d').

    Jay Garcia @ModusJesus || Modus Create co-founder
    Ext JS in Action author
    Sencha Touch in Action author

    Get in touch for Ext JS & Sencha Touch Touch Training

    We are also working on Video-based Sencha Touch training: Check it out here.

  3. #3
    Ext User
    Join Date
    Mar 2009
    Posts
    2
    Vote Rating
    0
    lensesby is on a distinguished road

      0  

    Default


    If i set "altFormat", that makes my datefield accept both 'm/d/Y' and 'd/m/Y' format.
    But my idea is : if user choose 'm/d/Y', then 'd/m/Y' will be consider error, and vice versa.
    In another word, after my datefield was created, user can change the format and make that format be the only valid one.

    thanks for your reply.