{ "id": "118735", "key": "TIMOB-14953", "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": [ { "id": "17706", "name": "Release 5.4.0", "archived": false, "released": true, "releaseDate": "2016-08-11" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2016-02-22T19:48:39.000+0000", "created": "2013-08-19T14:22:20.000+0000", "priority": { "name": "Low", "id": "4" }, "labels": [ "defect", "ios", "qe-5.4.0" ], "versions": [ { "id": "14982", "description": "Release 3.2.0", "name": "Release 3.2.0", "archived": false, "released": true, "releaseDate": "2013-12-19" } ], "issuelinks": [], "assignee": { "name": "apetkov", "key": "apetkov", "displayName": "Angel Petkov", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2016-08-08T19:25:52.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": "on iOS getEventsBetweenDates method is not working:\r\n- it is misspelled: **getEventsBeteenDates** (missing \"w\")\r\n- if I call the method this way, no matter what I'm trying to put as arguments (dates or strings) is not working\r\n\r\nif I put a strings (like \"2014-02-19T16:17:46+01:00\") I get\r\n\r\n{code}\r\n\"*** -[EKEventStore predicateForEventsWithStartDate:endDate:calendars:]: startDate is nil\";\r\n{code} \r\n\r\nif I put dates I get\r\n{code}\r\nmessage = \"Invalid type passed to function\";\r\nnativeLocation = \"-[TiCalendarCalendar getEventsBeteenDates:] (TiCalendarCalendar.m:157)\";\r\nnativeReason = \"expected: String, was: __NSDate\";\r\n{code}", "attachment": [], "flagged": false, "summary": "iOS: Ti.Calendar getEventsBetweenDates is not working", "creator": { "name": "rborn", "key": "rborn", "displayName": "Dan Tamas", "active": true, "timeZone": "Europe/Berlin" }, "subtasks": [], "reporter": { "name": "rborn", "key": "rborn", "displayName": "Dan Tamas", "active": true, "timeZone": "Europe/Berlin" }, "environment": "iOS6", "closedSprints": [ { "id": 585, "state": "closed", "name": "2016 Sprint 5 SDK", "startDate": "2016-02-27T01:30:43.377Z", "endDate": "2016-03-12T01:30:00.000Z", "completeDate": "2016-03-14T11:50:17.995Z", "originBoardId": 114 } ], "comment": { "comments": [ { "id": "268035", "author": { "name": "ndustri", "key": "ndustri", "displayName": "Sean Hunter", "active": true, "timeZone": "America/New_York" }, "body": "Here is the fix for now... After fixing the misspelling in TiCalendarCalendar.m, the getEventsBetweenDates is expecting two date strings in full UTC format like so: yyyy-MM-ddTHH:mm:ss.SSS+0000\n\nMy javascript example:\n{code:title=getEventsBetweenDates.js|borderStyle=solid}\nvar date1 = new Date();\nvar date2 = new Date();\ndate2.setHours(date1.getHours() + 24);\n\nvar date1ISO = date1.toISOString();\nvar date2ISO = date2.toISOString();\n\ndate1ISO = date1ISO.replace(\"Z\", \"+0000\");\ndate2ISO = date2ISO.replace(\"Z\", \"+0000\");\n\nvar events = Ti.Calendar.defaultCalendar.getEventsBetweenDates(date1ISO, date2ISO); \n{code} \n\nWorks perfectly.", "updateAuthor": { "name": "ndustri", "key": "ndustri", "displayName": "Sean Hunter", "active": true, "timeZone": "America/New_York" }, "created": "2013-08-24T20:54:13.000+0000", "updated": "2013-08-24T20:54:13.000+0000" }, { "id": "268082", "author": { "name": "rborn", "key": "rborn", "displayName": "Dan Tamas", "active": true, "timeZone": "Europe/Berlin" }, "body": "Hi Sean, thnx for the workaround. I use a module for now but this needs to be fixed.\n", "updateAuthor": { "name": "rborn", "key": "rborn", "displayName": "Dan Tamas", "active": true, "timeZone": "Europe/Berlin" }, "created": "2013-08-26T09:03:20.000+0000", "updated": "2013-08-26T09:03:20.000+0000" }, { "id": "340899", "author": { "name": "bradenpowers", "key": "bradenpowers", "displayName": "Braden Powers", "active": true, "timeZone": "America/New_York" }, "body": "This is still an issue. Could we get a fix in place for this?", "updateAuthor": { "name": "bradenpowers", "key": "bradenpowers", "displayName": "Braden Powers", "active": true, "timeZone": "America/New_York" }, "created": "2015-01-28T01:32:07.000+0000", "updated": "2015-01-28T01:32:07.000+0000" }, { "id": "377149", "author": { "name": "melissa7mb", "key": "melissa7mb", "displayName": "Melissa Chan", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Has there been any updates in regards to the spelling issue here? This bug is of low priority, but it forces developers to make the fix themselves when they update Titanium/add new developers to their project. Thanks!", "updateAuthor": { "name": "melissa7mb", "key": "melissa7mb", "displayName": "Melissa Chan", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2016-02-17T22:43:11.000+0000", "updated": "2016-02-17T22:43:11.000+0000" }, { "id": "377184", "author": { "name": "Yrkh8trnoy", "key": "yrkh8trnoy", "displayName": "Kiley Williams", "active": true, "timeZone": "America/Vancouver" }, "body": "+1 We encountered this last year, and it still is a very serious pain that we need to modify the file in the titanium library folder every time we want to use a new build of the platform.\r\n\r\nWhat is the time frame for this fix? It seems to be a simple mispelling as @Melissa said above.", "updateAuthor": { "name": "Yrkh8trnoy", "key": "yrkh8trnoy", "displayName": "Kiley Williams", "active": true, "timeZone": "America/Vancouver" }, "created": "2016-02-18T07:06:50.000+0000", "updated": "2016-02-18T07:06:50.000+0000" }, { "id": "377421", "author": { "name": "apetkov", "key": "apetkov", "displayName": "Angel Petkov", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Changes spelling and did a change so you can pass in Date objects and strings , instead of just strings. \r\n\r\n{code:javascript}\r\nvar date1 = new Date(new Date().getTime() + 3000),\r\n date2 = new Date(new Date().getTime() + 900000);\r\n date3 = new Date(new Date().getTime() + 1000000);\r\n Ti.API.info(date1);\r\n defCalendar = null;\r\n \r\nif (Ti.Calendar.hasCalendarPermissions()) {\r\n getEventsBetweenDates();\r\n performCalendarReadFunctions();\r\n} else {\r\n Ti.Calendar.requestCalendarPermissions(function(e) {\r\n if (e.success) {\r\n getEventsBetweenDates();\r\n performCalendarReadFunctions();\r\n } else {\r\n Ti.API.error(e.error);\r\n alert('Access to calendar is not allowed');\r\n }\r\n });\r\n}\r\n\r\nfunction getEventsBetweenDates() {\r\n defCalendar = Ti.Calendar.defaultCalendar;\r\n\r\n var event1 = defCalendar.createEvent({\r\n title: 'Sample Event',\r\n notes: 'This is a test event which has some values assigned to it.',\r\n location: 'Appcelerator Inc',\r\n begin: date1,\r\n end: date2,\r\n availability: Ti.Calendar.AVAILABILITY_FREE,\r\n allDay: false,\r\n });\r\n\r\n var event2 = defCalendar.createEvent({\r\n title: 'Sample Event',\r\n notes: 'This is a test event which has some values assigned to it.',\r\n location: 'Appcelerator Inc',\r\n begin: date2,\r\n end: date3,\r\n availability: Ti.Calendar.AVAILABILITY_FREE,\r\n allDay: false,\r\n });\r\n\r\n event1.save(Ti.Calendar.SPAN_THISEVENT);\r\n event2.save(Ti.Calendar.SPAN_THISEVENT);\r\n}\r\n\r\nfunction performCalendarReadFunctions() {\r\n // date2.setHours(date1.getHours() + 24);\r\n \r\n var date1ISO = date1.toISOString();\r\n var date2ISO = date2.toISOString();\r\n \r\n date1ISO = date1ISO.replace(\"Z\", \"+0000\");\r\n date2ISO = date2ISO.replace(\"Z\", \"+0000\");\r\n \r\n var events = defCalendar.getEventsBetweenDates(date1, date2); \r\n Ti.API.info(events);\r\n \r\n Ti.API.info(events.length);\r\n}\r\n{code}\r\nPR pending: https://github.com/appcelerator/titanium_mobile/pull/7756", "updateAuthor": { "name": "apetkov", "key": "apetkov", "displayName": "Angel Petkov", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2016-02-20T00:45:00.000+0000", "updated": "2016-08-08T17:37:54.000+0000" }, { "id": "377444", "author": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "body": "[~ndustri] [~rborn] Can you validate that the PR is working for your use cases as well? I need to setup some demo dates first to finish CR and FT on this ticket. Thanks guys!", "updateAuthor": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "created": "2016-02-20T16:01:10.000+0000", "updated": "2016-02-20T16:01:10.000+0000" }, { "id": "377450", "author": { "name": "Yrkh8trnoy", "key": "yrkh8trnoy", "displayName": "Kiley Williams", "active": true, "timeZone": "America/Vancouver" }, "body": "(y)(y)", "updateAuthor": { "name": "Yrkh8trnoy", "key": "yrkh8trnoy", "displayName": "Kiley Williams", "active": true, "timeZone": "America/Vancouver" }, "created": "2016-02-20T18:51:02.000+0000", "updated": "2016-02-20T18:51:02.000+0000" }, { "id": "392657", "author": { "name": "htbryant", "key": "htbryant", "displayName": "Harry Bryant", "active": true, "timeZone": "Europe/London" }, "body": "Verified as fixed.\r\n\r\nTested On:\r\n\r\niPhone 6S (9.3.3) Device \r\nMac OSX El Capitan 10.11.6\r\nTi SDK: 5.4.0.v20160804185318\r\nAppc Studio: 4.7.0.201607250649\r\nAppc NPM: 4.2.7\t\r\nApp CLI: 5.4.0-40\r\nXcode 7.3.1\r\nNode v4.4.7\r\n\r\n*Closing ticket.*", "updateAuthor": { "name": "htbryant", "key": "htbryant", "displayName": "Harry Bryant", "active": true, "timeZone": "Europe/London" }, "created": "2016-08-08T19:25:02.000+0000", "updated": "2016-08-08T19:25:02.000+0000" } ], "maxResults": 10, "total": 10, "startAt": 0 } } }