{ "id": "151963", "key": "AC-460", "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": "11", "description": "Is not a bug in our product", "name": "Not Our Bug" }, "resolutiondate": "2015-12-03T09:26:50.000+0000", "created": "2015-10-12T16:01:26.000+0000", "labels": [ "alloy", "moment", "windows" ], "versions": [ { "id": "17032", "name": "Appcelerator Studio 4.3.0", "archived": false, "released": false } ], "issuelinks": [], "assignee": { "name": "mrahman", "key": "mrahman", "displayName": "Mostafizur Rahman", "active": true, "timeZone": "Asia/Dhaka" }, "updated": "2015-12-03T09:52:41.000+0000", "status": { "description": "A resolution has been taken, and it is awaiting verification by reporter. From here issues are either reopened, or are closed.", "name": "Resolved", "id": "5", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "components": [ { "id": "14544", "name": "Alloy", "description": "Please enter tickets related to the Alloy here." }, { "id": "14548", "name": "Titanium SDK & CLI", "description": "Please enter tickets related to the MobileSDK here." } ], "description": "I'm porting an app from iOS/Android to Windows Phone. It's a scheduling app that relies heavily on the momentjs library to manage and compare dates.\r\n\r\nI have noticed that the moment startOf and endOf functions are reporting the wrong dates, they are out by a number of days, not just hours.\r\n\r\nI have included a sample index.js file from a clean project, the output from this when I run it is:\r\n\r\n[INFO] : today string = Mon Oct 12 2015 16:48:38 GMT+0100\r\n[INFO] : startOfToday string = Thu Oct 08 2015 00:00:00 GMT-2300\r\n[INFO] : startOfToday unix = 1444345200\r\n[INFO] : endOfToday string = Thu Oct 08 2015 23:59:59 GMT+0100\r\n[INFO] : endOfToday unix = 1444345199\r\n\r\nAs you can see, the current date is Oct 12th, but the startOf('day') and endOf('day') functions are way out. I have tried it in a browser on my machine and they all check out, so I can only think it is an issue with the JS runtime.\r\n", "attachment": [ { "id": "56976", "filename": "index.js", "author": { "name": "welsh11", "key": "welsh11", "displayName": "Byron Davies", "active": true, "timeZone": "Europe/London" }, "created": "2015-10-12T16:01:01.000+0000", "size": 498, "mimeType": "application/javascript" } ], "flagged": false, "summary": "Windows: MomentJS startOf() and endOf() functions seem to report the wrong date", "creator": { "name": "welsh11", "key": "welsh11", "displayName": "Byron Davies", "active": true, "timeZone": "Europe/London" }, "subtasks": [], "reporter": { "name": "welsh11", "key": "welsh11", "displayName": "Byron Davies", "active": true, "timeZone": "Europe/London" }, "environment": "OS: Windows 10\r\nTi version: 5.0.2.GA\r\nAlloy: 1.7.5\r\nDevice: Windows Phone 8.1\r\nRegion: United Kingdom", "comment": { "comments": [ { "id": "367342", "author": { "name": "welsh11", "key": "welsh11", "displayName": "Byron Davies", "active": true, "timeZone": "Europe/London" }, "body": "I've done some further investigation and I think that there is an issue with the Javascript Date() object within (presumably) the JSCore for Windows.\r\n\r\nThis can be highlighted if you run the following:\r\n\r\nvar plainDate = new Date();\r\nconsole.log('plainDate string = ' + plainDate);\r\nplainDate.setHours(23);\r\nplainDate.setMinutes(0);\r\nplainDate.setSeconds(0);\r\nplainDate.setMilliseconds(0);\r\nconsole.log('plainDate endOfDay = ' + plainDate);\r\n\r\n\r\nThe Ti console will show:\r\n\r\n[INFO] : plainDate string = Tue Oct 20 2015 21:25:48 GMT+0100 (GMT Summer Time)\r\n[INFO] : plainDate endOfDay = Sat Oct 24 2015 23:00:00 GMT+0100 (GMT Summer Time)\r\n\r\nIf you change 'setHours' to 22 you don't get this issue. I believe therefore that this is an issue with the day not rolling over properly due to Daylight Savings Time (currently we are 1 hour ahead).\r\nYou seem to get an extra day added to the 'plainDate' object each time you modify it.\r\n\r\nMoment is backed by this Date object and the various date functions, and therefore it is completely unreliable.", "updateAuthor": { "name": "welsh11", "key": "welsh11", "displayName": "Byron Davies", "active": true, "timeZone": "Europe/London" }, "created": "2015-10-20T20:31:57.000+0000", "updated": "2015-10-20T20:31:57.000+0000" }, { "id": "367510", "author": { "name": "fokkezb", "key": "fokke", "displayName": "Fokke Zandbergen", "active": true, "timeZone": "Europe/Amsterdam" }, "body": "Not the first time Windows is having issues with dates: TIMOB-18855", "updateAuthor": { "name": "fokkezb", "key": "fokke", "displayName": "Fokke Zandbergen", "active": true, "timeZone": "Europe/Amsterdam" }, "created": "2015-10-22T05:16:55.000+0000", "updated": "2015-10-22T05:16:55.000+0000" }, { "id": "367566", "author": { "name": "welsh11", "key": "welsh11", "displayName": "Byron Davies", "active": true, "timeZone": "Europe/London" }, "body": "In order to move forward I was temporarily looking to use the JS runtime in a WebView and use evalJS() to get around this (hacky I know), but I don't think it is implemented.\r\n\r\nMy project is effectively dead in the water until this is fixed as it relies heavily on dates and date manipulation.", "updateAuthor": { "name": "welsh11", "key": "welsh11", "displayName": "Byron Davies", "active": true, "timeZone": "Europe/London" }, "created": "2015-10-22T20:50:45.000+0000", "updated": "2015-10-22T20:50:45.000+0000" }, { "id": "370234", "author": { "name": "welsh11", "key": "welsh11", "displayName": "Byron Davies", "active": true, "timeZone": "Europe/London" }, "body": "Just an update, now we have left Daylight savings time, the issue seems to have fixed itself for me. This'll of course rear it's head again in 6 months.....", "updateAuthor": { "name": "welsh11", "key": "welsh11", "displayName": "Byron Davies", "active": true, "timeZone": "Europe/London" }, "created": "2015-11-13T19:07:52.000+0000", "updated": "2015-11-13T19:07:52.000+0000" }, { "id": "372039", "author": { "name": "welsh11", "key": "welsh11", "displayName": "Byron Davies", "active": true, "timeZone": "Europe/London" }, "body": "Hi there,\r\n\r\nIt's been marked as 'Not Our Bug'.\r\n\r\nIs there a bit more explanation on this? \r\nWhere is the bug? \r\nWho's responsibility is it to fix?\r\nHave any support tickets been raised, etc...\r\n\r\nThanks", "updateAuthor": { "name": "welsh11", "key": "welsh11", "displayName": "Byron Davies", "active": true, "timeZone": "Europe/London" }, "created": "2015-12-03T09:52:41.000+0000", "updated": "2015-12-03T09:52:41.000+0000" } ], "maxResults": 6, "total": 6, "startAt": 0 } } }