{ "id": "119299", "key": "AC-2528", "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": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2014-07-28T17:28:43.000+0000", "created": "2013-08-30T09:39:35.000+0000", "labels": [], "versions": [], "issuelinks": [], "assignee": { "name": "mpmiranda", "key": "mpmiranda", "displayName": "Mauro Parra-Miranda", "active": true, "timeZone": "America/Mexico_City" }, "updated": "2016-03-08T07:41:35.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 creating an allday event the day is not entered into the devices calendar on the correct day. When setting allday to false the event is added at the correct time points.\r\n\r\nTest Case:\r\n\r\n{code}\r\nvar t = ('2013-08-04 00:00:00').split(/[- :]/);\r\nvar start = new Date(t[0], t[1]-1, t[2], t[3], t[4], t[5]); \r\n\r\nvar t = ('2013-08-04 23:59:59').split(/[- :]/);\r\nvar end = new Date(t[0], t[1]-1, t[2], t[3], t[4], t[5]); \r\n\r\nTi.API.info('start: '+start); \r\nTi.API.info('end: '+end); \r\n\r\nvar CALENDAR_TO_USE = 1;\r\nvar defCalendar = Ti.Calendar.getCalendarById(CALENDAR_TO_USE); \r\n\r\ndefCalendar.createEvent({\r\n title: 'test',\r\n notes: 'notes',\r\n location: 'Some address',\r\n begin: start,\r\n end: end,\r\n allDay: true\r\n});\r\n{code}\r\n\r\nConsole will print:\r\n{code}\r\nstart: Sun Aug 04 2013 00:00:00 GMT+0200 (CEST)\r\nend: Sun Aug 04 2013 23:59:59 GMT+0200 (CEST)\r\n{code}\r\n\r\nBut the event is added to August 3rd on the device.", "attachment": [ { "id": "42007", "filename": "device-2013-08-30-113837.png", "author": { "name": "sschueller", "key": "sschueller", "displayName": "Stefan Schüller", "active": true, "timeZone": "Europe/Berlin" }, "created": "2013-08-30T09:39:35.000+0000", "size": 680488, "mimeType": "image/png" }, { "id": "42619", "filename": "device-2013-09-19-165812.png", "author": { "name": "sschueller", "key": "sschueller", "displayName": "Stefan Schüller", "active": true, "timeZone": "Europe/Berlin" }, "created": "2013-09-19T14:59:04.000+0000", "size": 96515, "mimeType": "image/png" } ], "flagged": false, "summary": "Creating an allday event on Android shifts the day back by one on device", "creator": { "name": "sschueller", "key": "sschueller", "displayName": "Stefan Schüller", "active": true, "timeZone": "Europe/Berlin" }, "subtasks": [], "reporter": { "name": "sschueller", "key": "sschueller", "displayName": "Stefan Schüller", "active": true, "timeZone": "Europe/Berlin" }, "environment": "Android 4.1.2, Samsung Galaxy S3, Ti 3.1.2GA", "comment": { "comments": [ { "id": "271688", "author": { "name": "morahman", "key": "morahman", "displayName": "Motiur Rahman", "active": true, "timeZone": "Asia/Dhaka" }, "body": "Hi Stefan Schüller,\r\nYour code is incomplete could you provide runnable code so that i can past into the app.js file and reproduce this issue. And you can also follow [this link|http://docs.appcelerator.com/titanium/3.0/#!/api/Titanium.Calendar]\r\n\r\nThanks, ", "updateAuthor": { "name": "morahman", "key": "morahman", "displayName": "Motiur Rahman", "active": true, "timeZone": "Asia/Dhaka" }, "created": "2013-09-18T07:21:06.000+0000", "updated": "2013-09-18T07:38:16.000+0000" }, { "id": "271699", "author": { "name": "sschueller", "key": "sschueller", "displayName": "Stefan Schüller", "active": true, "timeZone": "Europe/Berlin" }, "body": "The code I posted is exactly what I have in my app.js. The app will show the splash and do nothing other than this so you need to force close it. I found the Problem in another app but I can not post it, this is why I create this app as a test.\r\n\r\nExact Process:\r\n# Start monitor from android SDK\r\n# Connect Android phone\r\n# In Titanium Run on Android Device\r\n# App launches with splash screen\r\n# Observe log output on monitor\r\n# Close app and check calendar on device.\r\n\r\nThanks,\r\n\r\nStefan\r\n", "updateAuthor": { "name": "sschueller", "key": "sschueller", "displayName": "Stefan Schüller", "active": true, "timeZone": "Europe/Berlin" }, "created": "2013-09-18T08:24:15.000+0000", "updated": "2013-09-18T08:24:57.000+0000" }, { "id": "271711", "author": { "name": "sschueller", "key": "sschueller", "displayName": "Stefan Schüller", "active": true, "timeZone": "Europe/Berlin" }, "body": "Hi Motiur,\r\n\r\nHere is a version with a window and a button. It will print what it wanted to do into the two labels. When you check the phone calendar you will see it added it to the wrong day.\r\n\r\n{code}\r\n\r\nvar w = Titanium.UI.createWindow({backgroundColor:'#000'});\r\n\r\nvar view = Titanium.UI.createView({});\r\n\r\nvar button = Titanium.UI.createButton({\r\n height: 100,\r\n width: 300,\r\n top: '20%',\r\n title: 'add event'\r\n});\r\n\r\nvar label1 = Titanium.UI.createLabel({\r\n\ttop: '40%',\r\n\tcolor: '#fff'\r\n});\r\nvar label2 = Titanium.UI.createLabel({\r\n\ttop: '42%',\r\n\tcolor: '#fff'\r\n});\r\n\r\nbutton.addEventListener('click',function(e)\r\n{\r\n\t// If no time is defined set all day\r\n\tvar t = ('2013-08-04 00:00:00').split(/[- :]/);\r\n\tvar start = new Date(t[0], t[1]-1, t[2], t[3], t[4], t[5]); \r\n\t\r\n\tvar t = ('2013-08-04 23:59:59').split(/[- :]/);\r\n\tvar end = new Date(t[0], t[1]-1, t[2], t[3], t[4], t[5]); \r\n\t\r\n\tTi.API.info('start: '+start); \r\n\tTi.API.info('end: '+end); \r\n\t\r\n\tlabel1.text = 'start: '+start;\r\n\tlabel2.text = 'end: '+end;\r\n\t\r\n\tvar CALENDAR_TO_USE = 1;\r\n\tvar defCalendar = Ti.Calendar.getCalendarById(CALENDAR_TO_USE); \r\n\t\r\n\tdefCalendar.createEvent({\r\n\t title: 'test',\r\n\t notes: 'notes',\r\n\t location: 'Some address',\r\n\t begin: start,\r\n\t end: end,\r\n\t allDay: true\r\n\t});\r\n});\r\n\r\nview.add(button);\r\nview.add(label1);\r\nview.add(label2);\r\nw.add(view);\r\nw.open();\r\n{code}\r\n\r\nLet me know if you need anything else.\r\n\r\nThanks,\r\n\r\nStefan", "updateAuthor": { "name": "sschueller", "key": "sschueller", "displayName": "Stefan Schüller", "active": true, "timeZone": "Europe/Berlin" }, "created": "2013-09-18T10:00:04.000+0000", "updated": "2013-09-18T11:12:39.000+0000" }, { "id": "271761", "author": { "name": "morahman", "key": "morahman", "displayName": "Motiur Rahman", "active": true, "timeZone": "Asia/Dhaka" }, "body": "Hi Stefan Schüller,\nI have tested your code, you just split the date and time then show it in console and label and it occurs perfectly but you said that allday event the day is not entered into the devices calendar on the correct day, i don't reproduce this issue. You can follow [this link|http://docs.appcelerator.com/titanium/latest/#!/api/Titanium.Calendar] and try to solve it. Then know me.\n\nThanks, ", "updateAuthor": { "name": "morahman", "key": "morahman", "displayName": "Motiur Rahman", "active": true, "timeZone": "Asia/Dhaka" }, "created": "2013-09-18T16:31:53.000+0000", "updated": "2013-09-18T16:31:53.000+0000" }, { "id": "271907", "author": { "name": "sschueller", "key": "sschueller", "displayName": "Stefan Schüller", "active": true, "timeZone": "Europe/Berlin" }, "body": "Hi Motiur,\n\nI still doesn't work for me (even on the latest SDK 3.1.3). I adjusted my test code to use the almost exact same code as the example in the documentation:\n\n{code}\nvar w = Titanium.UI.createWindow({backgroundColor:'#000'});\n \nvar view = Titanium.UI.createView({});\n \nvar button = Titanium.UI.createButton({\n height: 100,\n width: 300,\n top: '20%',\n title: 'add event'\n});\n \nvar label1 = Titanium.UI.createLabel({\n top: '40%',\n color: '#fff'\n});\nvar label2 = Titanium.UI.createLabel({\n top: '42%',\n color: '#fff'\n});\n \nbutton.addEventListener('click',function(e)\n{\n\t\n\tvar CALENDAR_TO_USE = 1;\n\tvar calendar = Ti.Calendar.getCalendarById(CALENDAR_TO_USE);\n\t\n\t// Create the event\n\tvar eventBegins = new Date(2013, 07, 04, 00, 00, 00);\n\tvar eventEnds = new Date(2013, 07, 04, 23, 59, 59);\n\t\n\tTi.API.info('start: '+eventBegins); \n\tTi.API.info('end: '+eventEnds); \n \n\tlabel1.text = 'start: '+eventBegins;\n\tlabel2.text = 'end: '+eventEnds;\n\t\n\tvar details = {\n\t title: 'Do some stuff',\n\t description: \"I'm going to do some stuff at this time.\",\n\t begin: eventBegins,\n\t end: eventEnds,\n\t allDay: true\n\t};\n\t\n\tvar event = calendar.createEvent(details);\t \n\n});\n \nview.add(button);\nview.add(label1);\nview.add(label2);\nw.add(view);\nw.open();\n{code}\n\nIt is still off by one day. The event should be added to August 4th but is added to August 3rd on the devices calendar. This is on a Samsung Galaxy S3 (GT-I9300), Android 4.1.2.\n\n", "updateAuthor": { "name": "sschueller", "key": "sschueller", "displayName": "Stefan Schüller", "active": true, "timeZone": "Europe/Berlin" }, "created": "2013-09-19T14:58:26.000+0000", "updated": "2013-09-19T14:58:26.000+0000" }, { "id": "283714", "author": { "name": "shossain", "key": "shossain", "displayName": "Shak Hossain", "active": false, "timeZone": "America/Los_Angeles" }, "body": "@Stefan - Thanks for sending us your code. We will test it ASAP and post an update for you.", "updateAuthor": { "name": "shossain", "key": "shossain", "displayName": "Shak Hossain", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2013-12-11T01:38:10.000+0000", "updated": "2013-12-11T01:38:10.000+0000" }, { "id": "283876", "author": { "name": "ewieber", "key": "ewieber", "displayName": "Eric Wieber", "active": false, "timeZone": "America/Los_Angeles" }, "body": "Hi Stefan,\n\nI was unable to reproduce this issue on our Galaxy S2 and Galaxy S3 devices.\nThis could be a timezone issue. According to the documentation for Date():\n\n\"The JavaScript Date object provides uniform behavior across platforms. The time value can be passed between systems to represent the same moment in time and if used to create a local date object, will reflect the local equivalent of the time. The JavaScript Date object supports a number of UTC (universal) methods, as well as local time methods. UTC, also known as Greenwich Mean Time (GMT), refers to the time as set by the World Time Standard. The local time is the time known to the computer where JavaScript is executed.\"\n\nIt looks like your device is in the CEST GMT+0200 timezone, could you please verify what timezone your device is set to? You could also consider setting the calendar event to start several hours later in the day to see if the event is then on the correct day, as a test. If that is the case, you may need to modify your code to account for different timezones.", "updateAuthor": { "name": "ewieber", "key": "ewieber", "displayName": "Eric Wieber", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2013-12-11T22:01:43.000+0000", "updated": "2013-12-11T22:01:43.000+0000" }, { "id": "291632", "author": { "name": "sschueller", "key": "sschueller", "displayName": "Stefan Schüller", "active": true, "timeZone": "Europe/Berlin" }, "body": "The timezone on the device is GMT +2. \r\n\r\nSetting eventBegins hours to 02 works but I don't understand why setting a non all day event works correctly placing the item at the correct time and a fullday event does not.\r\n\r\nAdding a non allday event correctly I need to do this:\r\n{code}\r\n var eventBegins = new Date(2013, 07, 04, 12, 00, 00);\r\n var eventEnds = new Date(2013, 07, 04, 13, 00, 00);\r\n var details = {\r\n title: 'Do some stuff',\r\n description: \"I'm going to do some stuff at this time.\",\r\n begin: eventBegins,\r\n end: eventEnds,\r\n allDay: false\r\n };\r\n{code}\r\n\r\nFor an allday event I need to do this (makes no sense that the timezone is checked here but not above):\r\n{code}\r\n var eventBegins = new Date(2013, 07, 04, 02, 00, 00);\r\n var eventEnds = new Date(2013, 07, 04, 23, 59, 59);\r\n var details = {\r\n title: 'Do some stuff',\r\n description: \"I'm going to do some stuff at this time.\",\r\n begin: eventBegins,\r\n end: eventEnds,\r\n allDay: true\r\n };\r\n{code}", "updateAuthor": { "name": "sschueller", "key": "sschueller", "displayName": "Stefan Schüller", "active": true, "timeZone": "Europe/Berlin" }, "created": "2014-02-06T15:51:15.000+0000", "updated": "2014-02-06T15:51:54.000+0000" }, { "id": "291887", "author": { "name": "sschueller", "key": "sschueller", "displayName": "Stefan Schüller", "active": true, "timeZone": "Europe/Berlin" }, "body": "Just FYI, in iOS I do not need to account for the GMT offset. This code works fine on an iOS device with GMT +2 but does not work on an Android device with GMT +2\n{code}\nvar w = Titanium.UI.createWindow({backgroundColor:'#000'});\n \nvar view = Titanium.UI.createView({});\n \nvar button = Titanium.UI.createButton({\n height: 100,\n width: 300,\n top: '20%',\n title: 'add event'\n});\n \nvar label1 = Titanium.UI.createLabel({\n top: '40%',\n color: '#fff'\n});\nvar label2 = Titanium.UI.createLabel({\n top: '42%',\n color: '#fff'\n});\n \n\nfunction addEvent(){\n\n\tif (Ti.Platform.osname === 'android') {\n\t\tvar CALENDAR_TO_USE = 1;\n\t\tvar calendar = Ti.Calendar.getCalendarById(CALENDAR_TO_USE);\n\t} else {\n\t\tvar calendar = Ti.Calendar.defaultCalendar;\t\t\t\n\t}\n\n\t// Create the event\n\tvar eventBegins = new Date(2014, 01, 20, 00, 00, 00);\n\tvar eventEnds = new Date(2014, 01, 20, 23, 59, 59);\n\t\n Ti.API.info('start: '+eventBegins); \n Ti.API.info('end: '+eventEnds); \n \n label1.text = 'start: '+eventBegins;\n label2.text = 'end: '+eventEnds;\n\t\n\tvar details = {\n\t title: 'Do some stuff',\n\t description: \"I'm going to do some stuff at this time.\",\n\t begin: eventBegins,\n\t end: eventEnds,\n\t allDay: true\n\t};\n\t\n\tvar event = calendar.createEvent(details);\t\n\t\n\tif (Ti.Platform.osname === 'iphone') {\n\t\tevent.save(Ti.Calendar.SPAN_THISEVENT);\n\t}\n}\n \n \nbutton.addEventListener('click',function(e)\n{\n\tif (Ti.Platform.osname === 'android') {\n\t\taddEvent();\n\t} else {\n\t\tif(Ti.Calendar.eventsAuthorization == Ti.Calendar.AUTHORIZATION_AUTHORIZED) {\n\t\t\taddEvent();\n\t\t} else {\n\t\t Ti.Calendar.requestEventsAuthorization(function(e){\n\t\t\t\taddEvent();\n\t\t });\t\t\t\t\t\t\t\t\n\t\t}\n\t}\n});\n \nview.add(button);\nview.add(label1);\nview.add(label2);\nw.add(view);\nw.open();\n{code}", "updateAuthor": { "name": "sschueller", "key": "sschueller", "displayName": "Stefan Schüller", "active": true, "timeZone": "Europe/Berlin" }, "created": "2014-02-07T09:17:34.000+0000", "updated": "2014-02-07T09:17:34.000+0000" }, { "id": "299729", "author": { "name": "bneil", "key": "bneil", "displayName": "Brandon Neil", "active": true, "timeZone": "America/Chicago" }, "body": "I have also run into this issue and setting all day events to a day past to account for our -5:00 or -06:00 timezone offset. This only occurs on Android on allday events that are longer than one day. My only major difference between the code above is I'm using the bundled moment.js that is included with alloy to create the dates.\n\nTi 3.2.2.GA\n\nNexus 7 - 4.4.2\nSamsung Galaxy S3 - 4.3\nMoto Droid Razor HD - 4.1.2\nMoto Droid Razr - 2.3.7", "updateAuthor": { "name": "bneil", "key": "bneil", "displayName": "Brandon Neil", "active": true, "timeZone": "America/Chicago" }, "created": "2014-04-03T16:35:39.000+0000", "updated": "2014-04-03T16:35:39.000+0000" }, { "id": "315995", "author": { "name": "mpmiranda", "key": "mpmiranda", "displayName": "Mauro Parra-Miranda", "active": true, "timeZone": "America/Mexico_City" }, "body": "Fixed in 3.3.0.GA. Tested with Moto X with Android 4.4.2. ", "updateAuthor": { "name": "mpmiranda", "key": "mpmiranda", "displayName": "Mauro Parra-Miranda", "active": true, "timeZone": "America/Mexico_City" }, "created": "2014-07-28T17:28:43.000+0000", "updated": "2014-07-28T17:28:43.000+0000" } ], "maxResults": 13, "total": 13, "startAt": 0 } } }