{ "id": "62644", "key": "TIMOB-2012", "fields": { "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false }, "project": { "id": "10153", "key": "TIMOB", "name": "Titanium SDK/CLI", "projectCategory": { "id": "10100", "description": "Titanium and related SDKs used in application development", "name": "Client" } }, "fixVersions": [], "resolution": { "id": "5", "description": "All attempts at reproducing this issue failed, or not enough information was available to reproduce the issue. Reading the code produces no clues as to why this behavior would occur. If more information appears later, please reopen the issue.", "name": "Cannot Reproduce" }, "resolutiondate": "2012-03-14T13:41:37.000+0000", "created": "2011-04-15T03:08:04.000+0000", "priority": { "name": "High", "id": "2" }, "labels": [ "parity" ], "versions": [ { "id": "11225", "name": "Release 1.5.0", "archived": true, "released": true, "releaseDate": "2010-12-14" } ], "issuelinks": [], "assignee": { "name": "stephentramer", "key": "stephentramer", "displayName": "Stephen Tramer", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2012-03-14T13:41:37.000+0000", "status": { "description": "The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.", "name": "Closed", "id": "6", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "components": [ { "id": "10206", "name": "iOS", "description": "iOS Platform" } ], "description": "{html}

I'm running:

\r\n

Titanium SDK Version: 1.4.0
\r\nIphone SDK Version: 3.2/4.0
\r\nTitanium Developer: 1.2.1

\r\n

Unfortunately i cannot use this simple code to get the value of\r\na datepicker:

\r\n
\r\nvar myDatePicker = Ti.UI.createPicker({\r\n    type:Ti.UI.PICKER_TYPE_DATE_AND_TIME,\r\n    top: 0\r\n});\r\n\r\ndebug( myDatePicker.value ); // returns null\r\n
\r\n

KitchenSink shows how to get the value with an event ( and it\r\nworks! ), but not when you need it outside an datepicker's\r\nevent.

{html}", "attachment": [], "flagged": false, "summary": "iOS: Datepicker returns null value", "creator": { "name": "fernando", "key": "fernando", "displayName": "Fernando", "active": true, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "fernando", "key": "fernando", "displayName": "Fernando", "active": true, "timeZone": "America/Los_Angeles" }, "environment": null, "comment": { "comments": [ { "id": "127250", "author": { "name": "ernesto", "key": "ernesto", "displayName": "Ernesto", "active": true, "timeZone": "America/Los_Angeles" }, "body": "{html}

I've also seen this issue.

\n

The workaround is manually updating the picker's value inside an\nonChange callback:

\n
\npicker.addEventListener('change', function(e) { picker.value = e.value; });\n
{html}", "updateAuthor": { "name": "ernesto", "key": "ernesto", "displayName": "Ernesto", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T03:08:04.000+0000", "updated": "2011-04-15T03:08:04.000+0000" }, { "id": "127251", "author": { "name": "stephentramer", "key": "stephentramer", "displayName": "Stephen Tramer", "active": true, "timeZone": "America/Los_Angeles" }, "body": "{html}

Continuously get 'null' using the following sample code - maybe\nanother Apple bug regarding the date picker? Wouldn't be the first\ntime.

\n
\nvar win = Ti.UI.createWindow({backgroundColor:'white'});\nvar myDatePicker = Ti.UI.createPicker({\n    type:Ti.UI.PICKER_TYPE_DATE_AND_TIME,\n    top: 0\n});\n\nTi.API.info('Pre-add value: '+myDatePicker.value);\nwin.add(myDatePicker);\nTi.API.info('Post-add value: '+myDatePicker.value);\n\nwin.addEventListener('focus', function() {\n    Ti.API.info('Focus value: '+myDatePicker.value);\n});\nwin.addEventListener('open', function() {\n    Ti.API.info('Open value: '+myDatePicker.value);\n});\n\nwin.open();\n\nvar timer = setTimeout(function() {\n    Ti.API.info('Timer value: '+myDatePicker.value);\n}, 1000);\n
{html}", "updateAuthor": { "name": "stephentramer", "key": "stephentramer", "displayName": "Stephen Tramer", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T03:08:05.000+0000", "updated": "2011-04-15T03:08:05.000+0000" }, { "id": "177170", "author": { "name": "pdowsett", "key": "pdowsett", "displayName": "Paul Dowsett", "active": true, "timeZone": "Europe/London" }, "body": "This issue does not occur for the following environment:\r\n\r\n* 1.8.0.1 (12/22/11 13:09 fbdc96f)\r\n* iOS 4.3.2\r\n* iphone simulator\r\n\r\n{code:lang=javascript|title=app.js}\r\nTitanium.UI.setBackgroundColor('#000');\r\n\r\nvar win1 = Ti.UI.createWindow({\r\n\tbackgroundColor:'white',\r\n\tfullscreen:false,\r\n\texitOnClose:true\r\n});\r\n\r\nvar minDate = new Date(2011,11,1);\r\n\r\nvar maxDate = new Date(2012,11,31);\r\n\r\nvar value = new Date();\r\n\r\nvar picker = Ti.UI.createPicker({\r\n\tlocale:'fr',\r\n\ttype:Ti.UI.PICKER_TYPE_DATE_AND_TIME,\r\n\tminDate:minDate,\r\n\tmaxDate:maxDate,\r\n\tvalue:value\r\n});\r\npicker.setLocale('fr');\r\nTi.API.info('The current picker value is: ' + picker.value)\r\nwin1.add(picker);\r\n\r\nwin1.open();\r\n{code}\r\n\r\n{code:lang=none|title=Output}\r\n[INFO] One moment, building ...\r\n[INFO] Titanium SDK version: 1.8.0.1 (12/22/11 13:09 fbdc96f)\r\n[INFO] iPhone Device family: universal\r\n[INFO] iPhone SDK version: 4.3\r\n[INFO] iPhone simulated device: iphone\r\n[INFO] Launching application in Simulator\r\n[INFO] Launched application in Simulator (0.89 seconds)\r\n[INFO] Found 4.3.2 patch installed\r\n[INFO] Application started\r\n[INFO] testing11/1.0 (1.8.0.1.fbdc96f)\r\n[INFO] Application started\r\n[INFO] testing11/1.0 (1.8.0.1.fbdc96f)\r\n[INFO] The current picker value is: Mon Dec 26 2011 02:57:36 GMT+0000 (GMT)\r\n{code}", "updateAuthor": { "name": "pdowsett", "key": "pdowsett", "displayName": "Paul Dowsett", "active": true, "timeZone": "Europe/London" }, "created": "2011-12-25T19:05:10.000+0000", "updated": "2011-12-25T19:05:10.000+0000" }, { "id": "177171", "author": { "name": "pdowsett", "key": "pdowsett", "displayName": "Paul Dowsett", "active": true, "timeZone": "Europe/London" }, "body": "Steve\r\n\r\nPlease would you take a look at my last comment? Can this ticket be closed now?\r\n\r\nThanks", "updateAuthor": { "name": "pdowsett", "key": "pdowsett", "displayName": "Paul Dowsett", "active": true, "timeZone": "Europe/London" }, "created": "2011-12-25T19:06:32.000+0000", "updated": "2011-12-25T19:06:32.000+0000" }, { "id": "177302", "author": { "name": "stephentramer", "key": "stephentramer", "displayName": "Stephen Tramer", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Cannot reproduce in 1.9.0.d9bac09.", "updateAuthor": { "name": "stephentramer", "key": "stephentramer", "displayName": "Stephen Tramer", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-12-27T11:26:07.000+0000", "updated": "2011-12-27T11:26:07.000+0000" }, { "id": "179111", "author": { "name": "nhuynh", "key": "nhuynh", "displayName": "Natalie Huynh", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Tested with 1.9.0.v20120112104633", "updateAuthor": { "name": "nhuynh", "key": "nhuynh", "displayName": "Natalie Huynh", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2012-01-12T13:20:17.000+0000", "updated": "2012-01-12T13:20:17.000+0000" }, { "id": "181365", "author": { "name": "mpettiford", "key": "mpettiford", "displayName": "Michael Pettiford", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Reopening/closing to add/remove labels", "updateAuthor": { "name": "mpettiford", "key": "mpettiford", "displayName": "Michael Pettiford", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2012-02-01T10:58:54.000+0000", "updated": "2012-02-01T10:58:54.000+0000" } ], "maxResults": 7, "total": 7, "startAt": 0 } } }