{ "id": "175414", "key": "TIMOB-28073", "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": "20950", "name": "Release 9.1.0", "archived": false, "released": true, "releaseDate": "2020-08-25" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2020-08-11T11:24:17.000+0000", "created": "2020-08-07T03:06:24.000+0000", "priority": { "name": "High", "id": "2" }, "labels": [ "DateTimeFormat", "Intl", "android", "date" ], "versions": [ { "id": "20950", "name": "Release 9.1.0", "archived": false, "released": true, "releaseDate": "2020-08-25" } ], "issuelinks": [ { "id": "59104", "type": { "id": "10003", "name": "Relates", "inward": "relates to", "outward": "relates to" }, "outwardIssue": { "id": "175962", "key": "TIMOB-28319", "fields": { "summary": "Ti.Android Test Suite: Titanium.Android TIMOB-28073 Android only", "status": { "description": "The issue is open and ready for the assignee to start work on it.", "name": "Open", "id": "1", "statusCategory": { "id": 2, "key": "new", "colorName": "blue-gray", "name": "To Do" } }, "priority": { "name": "None", "id": "6" }, "issuetype": { "id": "10100", "description": "This Issue Type is used to create Zephyr Test within Jira.", "name": "Test", "subtask": false } } } } ], "assignee": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2021-01-18T08:20:37.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": "10202", "name": "Android", "description": "Android Platform" } ], "description": "*Summary:*\r\nIf you set up {{Intl.DateTimeFormat}} to use 12-hour time and fractional digits on Android 8.x, then it will log an error and output a different format. This is not an issue on older or new Android OS versions.\r\n\r\n*Steps to reproduce:*\r\n# Build and run the below code on Android 8.\r\n# Notice an error gets logged: {{Failed to generate 'best' date pattern.}}\r\n# Notice displayed date is {{\"3/31/20 8:15 PM\"}} which doesn't match format settings.\r\n\r\n{code:javascript}\r\nvar date = new Date(Date.UTC(2020, 2, 31, 20, 15, 30, 123));\r\nvar formatter = new Intl.DateTimeFormat('en-US', {\r\n\tyear: 'numeric',\r\n\tmonth: '2-digit',\r\n\tday: '2-digit',\r\n\thour: 'numeric',\r\n\tminute: '2-digit',\r\n\tsecond: '2-digit',\r\n\tfractionalSecondDigits: 3,\r\n\thour12: true,\r\n\ttimeZone: 'UTC'\r\n});\r\nvar window = Ti.UI.createWindow();\r\nwindow.add(Ti.UI.createLabel({ text: formatter.format(date) }));\r\nwindow.open();\r\n{code}\r\n\r\n*Result:*\r\nThe following error gets logged...\r\n{code}\r\n[ERROR] DateTimeFormatProxy: (main) [37,37] Failed to generate 'best' date pattern.\r\n[ERROR] DateTimeFormatProxy: java.lang.IllegalArgumentException: Illegal pattern character 'b'\r\n[ERROR] DateTimeFormatProxy: \tat java.text.SimpleDateFormat.compile(SimpleDateFormat.java:870)\r\n[ERROR] DateTimeFormatProxy: \tat java.text.SimpleDateFormat.initialize(SimpleDateFormat.java:684)\r\n[ERROR] DateTimeFormatProxy: \tat java.text.SimpleDateFormat.(SimpleDateFormat.java:623)\r\n{code}\r\n\r\n*Expected Result:*\r\nNo error should be logged.\r\nThe displayed date should be...\r\n{code}\r\n03/31/2020, 8:15:30.123 PM\r\n{code}\r\n\r\n*Cause:*\r\nThis is a bug on Google's end. It is adding invalid format character {{'b'}} for the AM/PM component when it should be using format character {{'a'}} instead. This used to be a bug in Oracle's JDK as well...\r\nhttps://bugs.openjdk.java.net/browse/JDK-8209047\r\n\r\nTitanium was correctly catching the exception and falling-back to use a basic date/time format, but unfortunately that means it won't match the given format settings. (Having the fallback is still a good thing.)\r\n", "attachment": [], "flagged": false, "summary": "Android: DateTimeFormat mishandles some combinations of settings on Android 8", "creator": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "environment": null, "comment": { "comments": [ { "id": "456366", "author": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "body": "PR (master): https://github.com/appcelerator/titanium_mobile/pull/11874", "updateAuthor": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2020-08-07T03:20:01.000+0000", "updated": "2020-08-07T03:20:01.000+0000" }, { "id": "456381", "author": { "name": "cwilliams", "key": "cwilliams", "displayName": "Christopher Williams", "active": true, "timeZone": "America/New_York" }, "body": "merged to master, auto-backported and merged to 9_1_X and 9_3_X", "updateAuthor": { "name": "cwilliams", "key": "cwilliams", "displayName": "Christopher Williams", "active": true, "timeZone": "America/New_York" }, "created": "2020-08-07T20:48:40.000+0000", "updated": "2020-08-07T20:48:40.000+0000" }, { "id": "456399", "author": { "name": "smohammed", "key": "smohammed", "displayName": "Samir Mohammed", "active": true, "timeZone": "America/Los_Angeles" }, "body": "*Closing ticket*. Improvement verified in SDK version {{9.1.0.v20200810120239}}, {{9.2.0.v20200810085310}} and {{9.3.0.v20200810090511}}. Tested using the test case mentioned above.\r\n\r\n*Test and other information can be found at:*\r\nhttps://github.com/appcelerator/titanium_mobile/pull/11874\r\n\r\n*Test Environment*\r\n{code:java}\r\nMacOS Big Sur: 11.0 Beta\r\nXcode: 12.0 Beta \r\nJava Version: 1.8.0_242\r\nAndroid NDK: 21.3.6528147\r\nNode.js: 12.18.1\r\n\"\"NPM\":\"5.0.0\",\"CLI\":\"8.1.0-master.5\"\"\r\nAPI29 Pixel XL emulator\r\n{code}", "updateAuthor": { "name": "smohammed", "key": "smohammed", "displayName": "Samir Mohammed", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2020-08-11T11:23:48.000+0000", "updated": "2020-08-11T11:23:48.000+0000" } ], "maxResults": 3, "total": 3, "startAt": 0 } } }