{ "id": "160204", "key": "TIMOB-23403", "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": "2019-11-14T16:25:49.000+0000", "created": "2016-05-12T13:54:32.000+0000", "priority": { "name": "Critical", "id": "1" }, "labels": [ "defect", "iOS" ], "versions": [], "issuelinks": [], "assignee": { "name": "apetkov", "key": "apetkov", "displayName": "Angel Petkov", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2019-11-14T16:25:49.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": "This is the line of code the exception is happening and name variable is \"en-US\", but we also use french as well and is the reason why we are calling moment.locale.\r\n require(\"alloy/moment/lang/\" + name);\r\n\r\n{code}\r\nThread [kroll$1] (Suspended (exception at line 134 in moment.js))\t\r\n\tloadLocale(name) [moment.js:134]\t\r\n\tlocale_locales__getLocale(key) [moment.js:163]\t\r\n\tlocale_locales__getSetGlobalLocale(key, values) [moment.js:142]\t\r\n\tController() [index.js:43]\t\r\n\tcreateController(name, args) [alloy.js:232]\t\r\n\t[Top-level script] [app.js:3]\t\r\n{code}\r\n\r\nIn Run mode this works fine and our date displays correctly for the locale. The example doesn't display date, but out app does.\r\n\r\nI have attached example code to demonstrate this issue. Run the app in Debug mode.", "attachment": [ { "id": "59196", "filename": "AlloyTestProjectMoment.zip", "author": { "name": "cthomas", "key": "cthomas", "displayName": "Christy Thomas", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2016-05-12T13:53:26.000+0000", "size": 8203637, "mimeType": "application/zip" } ], "flagged": false, "summary": "iOS: Debug exception when calling moment.locale(Ti.Locale.currentLocale)", "creator": { "name": "cthomas", "key": "cthomas", "displayName": "Christy Thomas", "active": true, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "cthomas", "key": "cthomas", "displayName": "Christy Thomas", "active": true, "timeZone": "America/Los_Angeles" }, "environment": "Operating System\r\n Name = Mac OS X\r\n Version = 10.11.4\r\n Architecture = 64bit\r\n # CPUs = 8\r\n Memory = 17179869184\r\nNode.js\r\n Node.js Version = 0.12.7\r\n npm Version = 2.11.3\r\nTitanium CLI\r\n CLI Version = 5.0.6\r\nTitanium SDK\r\n SDK Version = 5.2.2.GA\r\n SDK Path = /Users/cthomas/Library/Application Support/Titanium/mobilesdk/osx/5.2.2.GA\r\n Target Platform = iphone\r\nCommand\r\n /usr/local/bin/node /Users/cthomas/.appcelerator/install/5.2.2/package/node_modules/titanium/lib/titanium.js build run --platform ios --log-level trace --sdk 5.2.2.GA --project-dir /Users/cthomas/Documents/Appcelerator_Studio_Workspace/AlloyTestProjectMoment --target simulator --ios-version 9.3 --device-family ipad --deploy-type development --sim-type ipad --sim-version 9.3 --device-id CF85EB59-BD8A-495A-9C53-6AC265B5208A --debug-host localhost:60002 --skip-js-minify --no-colors --no-progress-bars --no-prompt --prompt-type socket-bundle --prompt-port 63272 --config-file /var/folders/25/x4lmh1qn2rd11dkqf4g4jn80680cyz/T/build-1463060085067.json --no-banner --project-dir /Users/cthomas/Documents/Appcelerator_Studio_Workspace/AlloyTestProjectMoment\r\n", "comment": { "comments": [ { "id": "387212", "author": { "name": "apetkov", "key": "apetkov", "displayName": "Angel Petkov", "active": true, "timeZone": "America/Los_Angeles" }, "body": "[~cthomas] Hello, thank you for reporting the issue. It's currently being looked in to, for the time being you can use Titanium.Locale to get the currentLocal and language, which should return the same values. \r\n\r\n{code:javascript}\r\nTi.API.info(Ti.Locale.currentLocale)\r\n{code}", "updateAuthor": { "name": "apetkov", "key": "apetkov", "displayName": "Angel Petkov", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2016-05-31T21:27:19.000+0000", "updated": "2016-05-31T22:28:19.000+0000" }, { "id": "397009", "author": { "name": "francoisvl", "key": "francoisvl", "displayName": "Francois van Lille", "active": true, "timeZone": "Australia/Sydney" }, "body": "I've found that it isn't worth the bother of trying to use the built-in distribution of moment if your app's distribution is likely to be in multiple locales and you won't have i18n translations onboard for all those locales. Instead, just head over to momentjs.com, download moment-with-locales.js and require it instead of the \"alloy/moment\" version...\r\n\r\nSo in practice, I do the following in alloy.js:\r\n\r\n{code:java}\r\n// in the require statement below \"moment-with-locales\" refers to app/lib/moment-with-locales.js, which I renamed from the moment-with-locales.min.js file downloaded from momentjs.com\r\nAlloy.Globals.Moment = require(\"moment-with-locales\");\r\nAlloy.Globals.Moment.locale(Ti.Locale.currentLocale);\r\n{code}\r\n\r\nAnd when I need to use it, simply use\r\n\r\n{code:java}\r\nAlloy.Globals.Moment(oSomeDate).fromNow()\r\n{code}\r\n\r\nor whatever...", "updateAuthor": { "name": "francoisvl", "key": "francoisvl", "displayName": "Francois van Lille", "active": true, "timeZone": "Australia/Sydney" }, "created": "2016-09-23T01:31:20.000+0000", "updated": "2016-09-23T01:32:45.000+0000" }, { "id": "452685", "author": { "name": "ahutton", "key": "ahutton", "displayName": "Alan Hutton", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Unable to reproduce the issue.\r\n\r\nAxway Appcelerator Studio, build: 5.1.4.201909061933 \r\nmacOS : 10.15\r\nNode.js Version : 8.9.1\r\nnpm Version : 5.5.1\r\nAppcelerator CLI : 7.1.1\r\nTitanium CLI\r\nCLI Version : 5.2.1\r\nnode-appc Version : 0.2.49\r\nTitanium SDKs : 8.2.1.GA", "updateAuthor": { "name": "ahutton", "key": "ahutton", "displayName": "Alan Hutton", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2019-11-14T16:25:49.000+0000", "updated": "2019-11-14T16:25:49.000+0000" } ], "maxResults": 5, "total": 5, "startAt": 0 } } }