Results 1 to 10 of 10

Thread: datepicker and return format

  1. #1
    Sencha User
    Join Date
    Feb 2011
    Posts
    3

    Question datepicker and return format

    Hi,

    I have a difference in values following the recovery method.
    if I insert 01-01-2010 in the datepicker :

    Return by getValues (date object)
    Fri Jan 01 2010 00:00:00 GMT+0100 (Paris,Madrid)

    Return by submit form (var post in my php script)
    2009-12-31T23:00:00.000Z

    what is the problem ?

    (Sry for my dirty English )

  2. #2
    Sencha User psenough's Avatar
    Join Date
    Apr 2011
    Location
    Finland
    Posts
    24

    Default

    i have same problem that is not allowing me to save / reload from localstorage
    saves output of picked as "1981-01-01T22:00:00.000Z"
    and doesnt accept that format when loading..


    also tried using

    Ext.apply(Ext.util.Format, {
    defaultDateFormat: 'd-m-Y'
    });
    seems to ignore it
    Last edited by psenough; 14 Apr 2011 at 11:29 PM. Reason: extra info

  3. #3

  4. #4
    Sencha User psenough's Avatar
    Join Date
    Apr 2011
    Location
    Finland
    Posts
    24

    Default

    Quote Originally Posted by sharky View Post
    thats more of an explanation on the existance of the different date formats than an actual solution.

  5. #5
    Sencha User psenough's Avatar
    Join Date
    Apr 2011
    Location
    Finland
    Posts
    24

    Default

    tried parsing it with one of the patterns listed here
    http://dev.sencha.com/deploy/touch/docs/?class=Date
    but seems none match the extra .000Z
    have no idea what they are or why are they getting added, but i reckon its a bug O_o
    have to check the sourcecode to fix it if no devs show up :/

  6. #6
    Sencha User
    Join Date
    Feb 2011
    Posts
    3

    Default

    Z = Timezone offset in seconds (negative if west of UTC, positive if east) -43200 to 50400

    Documents you about dates in ISO-8601 : http://en.wikipedia.org/wiki/ISO_8601

    Time zone designators

    There are no time zone designators in ISO 8601. Time is only represented as local time or in relation to UTC.

    if no UTC relation information is given with a time representation, the time is assumed to be in local time. While it may be safe to assume local time when communicating in the same time zone, it is ambiguous when used in communicating across different time zones. It is usually preferable to indicate a time zone (zone designator) using the standards notation.

    If the time is in UTC, add a 'Z' directly after the time without a space. 'Z' is the zone designator for the zero UTC offset. "09:30 UTC" is therefore represented as "09:30Z" or "0930Z". "14:45:15 UTC" would be "14:45:15Z" or "144515Z".
    UTC time is also known as 'Zulu' time, since 'Zulu' is the NATO phonetic alphabet word for 'Z'.

  7. #7
    Sencha User psenough's Avatar
    Join Date
    Apr 2011
    Location
    Finland
    Posts
    24

    Default

    makes sense. so the saving is being done ok.

    its just the loading from localstorage store model into a datepickerfield that doesnt seem to be working. text loads fine into textfield. have to debug.

  8. #8
    Sencha User psenough's Avatar
    Join Date
    Apr 2011
    Location
    Finland
    Posts
    24

    Default

    found a solution on another thread
    model field required a mandatory use of dateFormat:'c'

    {name: 'ourDate', type:'date', dateFormat:'c'},

    very badly documented if you ask me

  9. #9
    Sencha User
    Join Date
    Aug 2009
    Posts
    41

    Default

    Quote Originally Posted by psenough View Post
    found a solution on another thread
    model field required a mandatory use of dateFormat:'c'

    {name: 'ourDate', type:'date', dateFormat:'c'},

    very badly documented if you ask me
    Doesn't work for me

  10. #10
    Sencha User
    Join Date
    Sep 2011
    Location
    Zrich, Switzerland
    Posts
    19

    Default

    I had the same problem. I solved it by a workaround. My application is working within the same timezone so I send my proxy request with extra params:

    Code:
    this.store.proxy.extraParams = {
                        fromDate: fromDate.format('Y-m-d G:i'),
                        toDate: toDate.format('Y-m-d G:i'),
                        action: 'insert'
                        };
    so I can be sure that I handle with a string which gets not converted by the proxy.

    After inserting the data I just reload my list from the server instead of using the store which is actually just substracts or add add the timezone to the date fields.

    maybe there is a better way...

Similar Threads

  1. DatePicker format
    By Trifling in forum Sencha Touch 1.x: Discussion
    Replies: 6
    Last Post: 11 Feb 2011, 2:40 AM
  2. return format of json Dates
    By steverc in forum Ext 3.x: Help & Discussion
    Replies: 6
    Last Post: 8 Jan 2010, 7:19 AM
  3. DatePicker cannot return the right date
    By Tooy in forum Ext GWT: Bugs (2.x)
    Replies: 0
    Last Post: 28 Jun 2009, 6:12 PM
  4. Return Date to Datepicker Element
    By Jack_S in forum Ext 2.x: Help & Discussion
    Replies: 2
    Last Post: 29 Aug 2008, 7:55 AM
  5. Should Format.usMoney(null) return $0.00?
    By NOSLOW in forum Ext 2.x: Help & Discussion
    Replies: 1
    Last Post: 5 May 2008, 5:40 AM

Posting Permissions

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