{ "id": "175893", "key": "TIMOB-28278", "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": "21177", "name": "Release 9.3.1", "archived": false, "released": true, "releaseDate": "2021-01-26" } ], "resolution": null, "resolutiondate": null, "created": "2020-12-09T08:57:11.000+0000", "priority": { "name": "Critical", "id": "1" }, "labels": [ "Intl", "android", "date", "datetime", "localization", "parity" ], "versions": [ { "id": "20950", "name": "Release 9.1.0", "archived": false, "released": true, "releaseDate": "2020-08-25" } ], "issuelinks": [], "assignee": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2020-12-18T19:31:31.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": "Run the following code on your web-browser, iOS and Android:\r\n{code:js}\r\nnew Date(2020, 11, 9).toLocaleDateString('en');\r\n{code}\r\nThe results are:\r\n* Web: 12/9/2020\r\n* iOS: 12/9/2020\r\n* Android: 12/9/{color:red}20{color} <-- YY instead of YYYY\r\n\r\nIt seems like Android uses the wrong year format.", "attachment": [], "flagged": false, "summary": "Android: localized date/time format should default to numeric", "creator": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "subtasks": [], "reporter": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "environment": null, "comment": { "comments": [ { "id": "457850", "author": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "body": "This is not a bug.\r\n\r\nIt's using the default pattern coming from the current locale. This just means the current locale is set up to use a 2 digit year. I've seen different locales provide 4 digit years on my devices as well. A great example of this is a Japanese \"ja-JP\" locale which does an ISO format of \"yyyy/mm/dd\" and requires a 4 digit year. Basically it's supposed to use the pattern the system is configured for.\r\nhttps://stackoverflow.com/questions/22719346/tolocaledatestring-is-not-returning-dd-mm-yyyy-format\r\n\r\nIf you want a consistent format, then you will need to do this...\r\n{code:javascript}\r\nnew Date(2020, 11, 9).toLocaleDateString(Ti.Locale.currentLocale, {\r\n\tmonth: 'numeric', // Will be 1-2 digits.\r\n\tday: 'numeric', // Will be 1-2 digits.\r\n\tyear: 'numeric', // Will always be 4 digits.\r\n});\r\n{code}\r\n", "updateAuthor": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2020-12-09T18:01:31.000+0000", "updated": "2020-12-09T18:01:31.000+0000" }, { "id": "457851", "author": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "body": "I don't understand. We do pass the locale to the {{toLocaleDateString}} function and all other platforms return the format correctly - on the same environment / locale.", "updateAuthor": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "created": "2020-12-09T18:09:27.000+0000", "updated": "2020-12-09T18:09:27.000+0000" }, { "id": "457852", "author": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Currently, the {{toLocaleDateString()}} and {{toLocaleTimeString()}} methods use the \"short\" date/time patterns defined by the system.\r\nhttps://github.com/appcelerator/titanium_mobile/blob/master/common/Resources/ti.internal/extensions/js/Date.js\r\n\r\nBut after having a look at Mozilla's docs [here|https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toLocaleDateString], the date/time components are supposed to be set to \"numeric\" if undefined. I can't find where this is documented in the ECMA spec (they say it's \"implementation defined\"), but I can see now this appears to be the expected behavior. Here's the quote from Mozilla's docs...\r\nbq. The default value for each date-time component property is undefined, but if the weekday, year, month, day properties are all undefined, then year, month, and day are assumed to be \"numeric\".\r\n\r\nSo, you're right. We should change it to default to \"numeric\".", "updateAuthor": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2020-12-09T21:23:42.000+0000", "updated": "2020-12-09T21:23:42.000+0000" }, { "id": "457853", "author": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "body": "Thanks for the insight, Josh! Also, thanks for the workaround - we will patch the SDK and are ready to go then :-)", "updateAuthor": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "created": "2020-12-09T21:52:48.000+0000", "updated": "2020-12-09T21:52:48.000+0000" }, { "id": "457858", "author": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "body": "PR (master): https://github.com/appcelerator/titanium_mobile/pull/12332", "updateAuthor": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2020-12-10T03:29:27.000+0000", "updated": "2020-12-10T03:29:27.000+0000" }, { "id": "457917", "author": { "name": "ssekhri", "key": "ssekhri", "displayName": "Satyam Sekhri", "active": true, "timeZone": "America/Los_Angeles" }, "body": "FR Passed.\r\nWaiting for Jenkins build.", "updateAuthor": { "name": "ssekhri", "key": "ssekhri", "displayName": "Satyam Sekhri", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2020-12-16T22:23:06.000+0000", "updated": "2020-12-16T22:23:06.000+0000" }, { "id": "457935", "author": { "name": "cwilliams", "key": "cwilliams", "displayName": "Christopher Williams", "active": true, "timeZone": "America/New_York" }, "body": "merged to master, backport PR merged to 9_3_X for 9.3.1 target", "updateAuthor": { "name": "cwilliams", "key": "cwilliams", "displayName": "Christopher Williams", "active": true, "timeZone": "America/New_York" }, "created": "2020-12-18T19:28:11.000+0000", "updated": "2020-12-18T19:31:28.000+0000" } ], "maxResults": 7, "total": 7, "startAt": 0 } } }