{ "id": "104171", "key": "AC-2347", "fields": { "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false }, "project": { "id": "12217", "key": "AC", "name": "Appcelerator - INBOX", "projectCategory": { "id": "10000", "description": "", "name": "Customer Service" } }, "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": "2013-03-15T18:16:09.000+0000", "created": "2012-10-30T23:07:45.000+0000", "labels": [ "date", "datepicker", "datetime", "locale", "picker", "triage" ], "versions": [], "issuelinks": [], "assignee": { "name": "mpmiranda", "key": "mpmiranda", "displayName": "Mauro Parra-Miranda", "active": true, "timeZone": "America/Mexico_City" }, "updated": "2017-02-15T00:22:13.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": "14548", "name": "Titanium SDK & CLI", "description": "Please enter tickets related to the MobileSDK here." } ], "description": "When getting the value back from a datepicker \"change\" event, the returned values from February 16, 1986 to February 28, 1986 are reported wrong. All other dates are reported normally.\r\n\r\nNo date treatment is being made on the event data.\r\n\r\n{code:javascript}\r\nvar win = Ti.UI.createWindow();\r\n\r\n// Picker Animations\r\nvar slideIn = Ti.UI.createAnimation({\r\n\tbottom : -40\r\n});\r\nvar slideOut = Ti.UI.createAnimation({\r\n\tbottom : -288\r\n});\r\n\r\n// Birthday Picker\r\nvar birthPickerView = Ti.UI.createView({\r\n\theight : 288,\r\n\t//bottom : -288,\r\n\tzIndex : 9\r\n});\r\nvar birthPicker = Ti.UI.createPicker({\r\n\ttop : 40,\r\n\ttype : Ti.UI.PICKER_TYPE_DATE,\r\n\tlocale : Ti.Platform.locale,\r\n\tselectionIndicator : true,\r\n\tminDate : new Date(1900, 0, 1),\r\n\tmaxDate : new Date(1997, 11, 31)\r\n});\r\nbirthPickerView.add(birthPicker);\r\nvar birthPickerLabel = Ti.UI.createLabel({\r\n\ttext : \"Your Birthday\",\r\n\tcolor : \"#fff\",\r\n\tfont : {\r\n\t\tfontWeight : \"bold\",\r\n\t\tfontSize : 16\r\n\t},\r\n\tshadowColor : \"#000\",\r\n\tshadowOffset : {\r\n\t\tx : 0.5,\r\n\t\ty : 0.5\r\n\t}\r\n});\r\nbirthPickerSpace = Ti.UI.createButton({\r\n\tstyle : Ti.UI.iPhone.SystemButtonStyle.FIXED_SPACE,\r\n\twidth : 29\r\n}, function() {\r\n});\r\nbirthPickerOKButton = Ti.UI.createButton({\r\n\ttitle : \"Confirm\",\r\n\tstyle : Ti.UI.iPhone.SystemButtonStyle.DONE\r\n}, function() {\r\n\tbirthPickerView.animate(slideOut);\r\n});\r\n\r\nvar birthPickerToolbar = Ti.UI.iOS.createToolbar({\r\n\ttop : 0,\r\n\theight : 40,\r\n\titems : [birthPickerLabel, birthPickerSpace, birthPickerOKButton]\r\n});\r\nbirthPickerView.add(birthPickerToolbar);\r\nwin.add(birthPickerView);\r\n\r\nbirthPicker.addEventListener(\"change\", function(e) {\r\n\tconsole.log(\"Date Object: \" + e);\r\n\tconsole.log(\"Date Value: \" + e.value);\r\n\tconsole.log(\"Date: \" + e.value.getDate());\r\n\tconsole.log(\"Day: \" + e.value.getDay());\r\n\tconsole.log(\"Date String: \" + e.value.toDateString());\r\n\tconsole.log(\"ISO String: \" + e.value.toISOString());\r\n\tconsole.log(\"Full Date: \" + e.value.toString());\r\n\tvar selDate = \"Formatted Date: \" + e.value.getDate() + \"/\" + String(Number(e.value.getMonth()) + 1) + \"/\" + e.value.getFullYear();\r\n\tconsole.log(selDate);\r\n\t//fBirthdayLabel.setText(selDate);\r\n});\r\n\r\nwin.open();\r\n{code}\r\n\r\n\r\n\r\nExample:\r\n\r\nSelected Date: February 14, 1986\r\n\r\n{code}\r\n[INFO] {\r\n\r\n source = \"[object TiUIPicker]\";\r\n\r\n type = change;\r\n\r\n value = \"1986-02-14 02:00:00 +0000\";\r\n\r\n}\r\n\r\n[INFO] 1986-02-14 02:00:00 +0000\r\n\r\n[INFO] 14\r\n\r\n[INFO] 5\r\n\r\n[INFO] Fri Feb 14 1986\r\n\r\n[INFO] 1986-02-14T02:00:00.000Z\r\n\r\n[INFO] Fri Feb 14 1986 00:00:00 GMT-0200 (BRST)\r\n{code}\r\n\r\n\r\n\r\nSelected Date: February 18, 1986\r\n\r\n{code}\r\n[INFO] {\r\n\r\n source = \"[object TiUIPicker]\";\r\n\r\n type = change;\r\n\r\n value = \"1986-02-18 02:00:00 +0000\";\r\n\r\n}\r\n\r\n[INFO] 1986-02-18 02:00:00 +0000\r\n\r\n[INFO] 17\r\n\r\n[INFO] 1\r\n\r\n[INFO] Mon Feb 17 1986\r\n\r\n[INFO] 1986-02-18T02:00:00.000Z\r\n\r\n[INFO] Mon Feb 17 1986 23:00:00 GMT-0300 (BRT)\r\n\r\n{code}\r\n\r\n\r\nSo as you might see, the objects returned on Feb are returned with times different than 0, so, every date between the aforementioned range is getting returned with one day less when you call .getDate() on the result value of the change event.\r\n\r\nIt might be related to locale, but if I left locale out I lose the picker translation and that is unacceptable.\r\n\r\nAny hints?\r\n\r\n", "attachment": [ { "id": "33998", "filename": "datepicker-pt-br.png", "author": { "name": "dsefton", "key": "dsefton", "displayName": "Daniel Sefton", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2012-12-06T23:04:02.000+0000", "size": 90410, "mimeType": "image/png" } ], "flagged": false, "summary": "iOS 6: DatePicker dates between February 16, 1986 and February 28, 1986 are wrongly reported", "creator": { "name": "ygbr", "key": "ygbr", "displayName": "Ygor Lemos", "active": true, "timeZone": "America/Sao_Paulo" }, "subtasks": [], "reporter": { "name": "ygbr", "key": "ygbr", "displayName": "Ygor Lemos", "active": true, "timeZone": "America/Sao_Paulo" }, "environment": "iOS6 Ti Mobile SDK 2.1.3.GA", "comment": { "comments": [ { "id": "225617", "author": { "name": "ygbr", "key": "ygbr", "displayName": "Ygor Lemos", "active": true, "timeZone": "America/Sao_Paulo" }, "body": "For now, I've solved this using the ISOString Date, manually stripping the date and ignoring the weird time that comes together with the date.\n\n\n{code:javascript}\nvar selDate = e.value.toISOString().split(\"T\")[0].split(\"-\").reverse().join(\"/\")\n{code}\n\nthis solves it... but isn't ideal...", "updateAuthor": { "name": "ygbr", "key": "ygbr", "displayName": "Ygor Lemos", "active": true, "timeZone": "America/Sao_Paulo" }, "created": "2012-10-30T23:25:51.000+0000", "updated": "2012-10-30T23:25:51.000+0000" }, { "id": "230266", "author": { "name": "dsefton", "key": "dsefton", "displayName": "Daniel Sefton", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Cannot reproduce on iOS 6 simulator with Ti Studio 3.0, Ti SDK 2.1.3 GA, 2.1.4 GA or 3.0 RC. e.g. When setting February 18th, it's reported correctly (all values are 18). Like you said, could be specific to your locale.", "updateAuthor": { "name": "dsefton", "key": "dsefton", "displayName": "Daniel Sefton", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2012-12-06T19:43:06.000+0000", "updated": "2012-12-06T19:43:06.000+0000" }, { "id": "230280", "author": { "name": "ygbr", "key": "ygbr", "displayName": "Ygor Lemos", "active": true, "timeZone": "America/Sao_Paulo" }, "body": "I've used Brazil for the location and Portuguese - Brazil for this specific case.", "updateAuthor": { "name": "ygbr", "key": "ygbr", "displayName": "Ygor Lemos", "active": true, "timeZone": "America/Sao_Paulo" }, "created": "2012-12-06T20:55:11.000+0000", "updated": "2012-12-06T20:55:11.000+0000" }, { "id": "230326", "author": { "name": "dsefton", "key": "dsefton", "displayName": "Daniel Sefton", "active": true, "timeZone": "America/Los_Angeles" }, "body": "I'm afraid I can't reproduce it with that locale either (\"pt-BR\"), on TiSDK 2.1.3 GA, 2.1.4 GA or 3.0 RC. See screenshot.", "updateAuthor": { "name": "dsefton", "key": "dsefton", "displayName": "Daniel Sefton", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2012-12-06T23:04:02.000+0000", "updated": "2012-12-06T23:04:02.000+0000" }, { "id": "242480", "author": { "name": "ingo", "key": "ingo", "displayName": "Ingo Muschenetz", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Please reopen if we can reproduce this issue.", "updateAuthor": { "name": "ingo", "key": "ingo", "displayName": "Ingo Muschenetz", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2013-03-15T18:16:09.000+0000", "updated": "2013-03-15T18:16:09.000+0000" }, { "id": "407064", "author": { "name": "ygbr", "key": "ygbr", "displayName": "Ygor Lemos", "active": true, "timeZone": "America/Sao_Paulo" }, "body": "This still happens on Titanium 5.5.1.GA :O", "updateAuthor": { "name": "ygbr", "key": "ygbr", "displayName": "Ygor Lemos", "active": true, "timeZone": "America/Sao_Paulo" }, "created": "2017-02-15T00:22:13.000+0000", "updated": "2017-02-15T00:22:13.000+0000" } ], "maxResults": 6, "total": 6, "startAt": 0 } } }