Page 1 of 2 12 LastLast
Results 1 to 10 of 17

Thread: Showing full date in date field

  1. #1
    Sencha Premium Member sencha-dev2's Avatar
    Join Date
    Jun 2012
    Location
    France
    Posts
    59
    Answers
    2
    Vote Rating
    0
      0  

    Question Showing full date in date field

    Hi, I wish to show the full parsed date in a datefield. I effectively saw the date was always 01/01/01 for example.

    As the application I'm developping targets from the baby to the elders, I might need to show the centuries in addition of what's already shown.

    I'd be glad to know if there's a way to show : 01/01/1901.

    Thanks in advance.

    ---------

    I searched through documentation but I saw no property which could fit...

  2. #2
    Touch Premium Member
    Join Date
    Jun 2011
    Posts
    1,099
    Answers
    113
    Vote Rating
    100
      0  

    Default

    you need to set the "format" config of the datefield to show the date how you like it to be shown.

  3. #3
    Sencha User Tim Toady's Avatar
    Join Date
    Feb 2010
    Location
    Pennsylvania
    Posts
    603
    Answers
    67
    Vote Rating
    284
      0  

    Default

    It shows the full year by default. See the live example in the docs. There is a format configuration you can define for alternate formats.

    http://docs.sencha.com/ext-js/4-1/#!...ate-cfg-format

  4. #4
    Sencha User
    Join Date
    May 2011
    Location
    Ukraine, Rivne
    Posts
    250
    Answers
    44
    Vote Rating
    44
      0  

    Default

    Use format config (see supported formats http://docs.sencha.com/ext-js/4-1/#!/api/Ext.Date) -
    PHP Code:
    {
            
    xtype'datefield',
            
    format'm/d/Y'


  5. #5
    Sencha Premium Member sencha-dev2's Avatar
    Join Date
    Jun 2012
    Location
    France
    Posts
    59
    Answers
    2
    Vote Rating
    0
      0  

    Default

    Thank you for your quick answers, but I'm already using format config and it doesn't change anything... It desperately remains 01/01/01...

  6. #6
    Sencha User Tim Toady's Avatar
    Join Date
    Feb 2010
    Location
    Pennsylvania
    Posts
    603
    Answers
    67
    Vote Rating
    284
      0  

    Default

    you probably have m/d/y (lowercase Y). If you just delete the format you should be set.

  7. #7
    Sencha Premium Member sencha-dev2's Avatar
    Join Date
    Jun 2012
    Location
    France
    Posts
    59
    Answers
    2
    Vote Rating
    0
      0  

    Default

    I'm sorry, but here's my code :

    Code:
    {
        xtype: 'datefield',
        name: 'dateEffet',
        fieldLabel: 'Date d\'effet ',
        format: 'd/m/Y',
        labelWidth: 120,
        width: 379,
        allowBlank: false
    }
    I'm actually using an upper Y... This is why I don't understand...

    --------------------------------------

    Maybe can help : I set its value with a getForm().setValues(res), res being an xhr answer array-parsed. I use it to fill my form, which this datefield belongs to. Can it be caused by this ? I'd precise when I show my form blank, I set its value with setValue(new Date()). Doesn't change anything though.
    Last edited by sencha-dev2; 13 Aug 2012 at 7:24 AM. Reason: precisions

  8. #8
    Sencha User Tim Toady's Avatar
    Join Date
    Feb 2010
    Location
    Pennsylvania
    Posts
    603
    Answers
    67
    Vote Rating
    284
      0  

    Default

    Oh I see why you are using format now. The European way makes so much more sense. Is it possible it is getting overridden somewhere? d/m/Y should show it the way you want. In fact I even ran the code you specified just to double check and it works.

  9. #9
    Touch Premium Member
    Join Date
    Jun 2011
    Posts
    1,099
    Answers
    113
    Vote Rating
    100
      0  

    Default

    take a look at the altFormats config and the example in the API Docs:

    http://docs.sencha.com/ext-js/4-0/#!...orm.field.Date

    your value which you are setting to the datefield should be in one of the formats specified either in the format config or the altFormats config.

  10. #10
    Sencha User Tim Toady's Avatar
    Join Date
    Feb 2010
    Location
    Pennsylvania
    Posts
    603
    Answers
    67
    Vote Rating
    284
      0  

    Default

    Had an idea. Are you using locale? The french locale has the d/m/y format specified. If you are including the locale script after your code it could be your issue.

    --Edit
    On second thought, I don't think locale would override a format specified on a object config, but I do wonder if it is somehow related. If you are using locale, try removing it temporarily and see if anything changes.

Page 1 of 2 12 LastLast

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •