Titanium JIRA Archive
Alloy (ALOY)

[ALOY-263] Implement Ti.UI.Picker parser (DATE & DATE_TIME)

GitHub Issuen/a
TypeImprovement
PriorityLow
StatusClosed
ResolutionFixed
Resolution Date2014-05-09T00:38:14.000+0000
Affected Version/sn/a
Fix Version/sAlloy 1.4.0, 2014 Sprint 08
ComponentsXML
Labelsnotable, qe-testadded
ReporterTony Lukasavage
AssigneeTim Poulsen
Created2012-09-13T06:11:33.000+0000
Updated2014-06-20T22:54:57.000+0000

Description

Need to determine a valid format for dates in the markup to be passed to the minDate, maxDate, and value properties, since they expect Javascript Date objects.

Comments

  1. Tim Poulsen 2013-03-26

    Tried this today, of course it failed, then I found this ticket.
       <Picker id="picker" top="50" 
          type="Ti.UI.PICKER_TYPE_DATE"
          minDate="2013,0,1" 
          maxDate="2014,11,31" 
          value="2014,3,12">
       </Picker>
       
    Seems like the obvious way to implement support would be to simply pass the values of the minDate, maxDate, and value attributes to the new Date() constructor. Thus, values could be any string that the Date() constructor accepts. Alternatively, since moment.js is built in, you could pass the values to moment() and accept whatever strings it supports.
  2. Tim Poulsen 2014-03-18

    PR: https://github.com/appcelerator/alloy/pull/349 Functional test 1. Run the associated ALOY-263 test app. You should get a date-style picker. 2. Edit the views/index.xml or styles/index.tss and change any of the value, minDate, or maxDate values to an invalid date string (e.g. 2013,0,0). Then build. The build will fail with an error message noting which field contained the invalid date. 3. Note that the value of the text field, while a parseable date string, is not converted to a date object (or its toString() representation).
  3. Tim Poulsen 2014-04-15

    PR merged
  4. Tim Poulsen 2014-04-21

    Reopening due to feedback from Ben that some valid JavaScript date strings are not working as expected.
  5. Tim Poulsen 2014-04-21

    Reimplemented using moment.js to support a broader variety of string formats for the date/time values. In this new implementation, you cannot use milliseconds as a value for any of the date attributes. But anything else parseable by moment should work. New PR merged, https://github.com/appcelerator/alloy/pull/367
  6. Federico Casali 2014-05-09

    Verified working as expected on iOS 7, Android 4.3 and MobileWeb. TiSDK 3.3.0.v20140507163312 Alloy 1.4.0-dev Appcelerator Studio 3.3.0.201405011408 CLI 3.3.0-dev Closing.

JSON Source