Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-27890] Android: Add Intl.DateTimeFormat support

GitHub Issuen/a
TypeNew Feature
PriorityMedium
StatusClosed
ResolutionFixed
Resolution Date2020-07-19T14:16:34.000+0000
Affected Version/sn/a
Fix Version/sRelease 9.1.0
ComponentsAndroid
LabelsDateTimeFormat, Intl, android, format, locale, localization, parity
ReporterJoshua Quick
AssigneeJoshua Quick
Created2020-05-08T18:35:37.000+0000
Updated2020-07-30T13:04:49.000+0000

Description

*Summary:* On Android, we should add support for JavaScript class Intl.DateTimeFormat. https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat/DateTimeFormat This is already supported on iOS. We should add it to Android for parity. *Note:* To add official Intl support to V8, we would have to #if it in, but this involves adding the ICU (International Components for Unicode) C++ library which is about 20 MB per architecture. This is too big and is not mobile friendly. Especially since Google Play has a 100 MB limit on APKs. So, the most reasonable solution is to implement this ourselves in Java. *Alternatives:* On older Titanium versions, your only option to generate localized date/time strings was via APIs: * [String.formatDate()](https://docs.appcelerator.com/platform/latest/#!/api/Global.String-method-formatDate) * [String.formatTime()](https://docs.appcelerator.com/platform/latest/#!/api/Global.String-method-formatTime)

Comments

  1. Joshua Quick 2020-05-09

    PR (master): https://github.com/appcelerator/titanium_mobile/pull/11698
  2. Christopher Williams 2020-07-19

    manually rebase/merged to master, 9_1_X, 9_3_X
  3. Joshua Quick 2020-07-21

    There's a bug with formatToParts() on Android 4.4. Fixed via PRs... PR (master): https://github.com/appcelerator/titanium_mobile/pull/11830 PR (9.1.x): https://github.com/appcelerator/titanium_mobile/pull/11831
  4. Christopher Williams 2020-07-21

    Fix has been merged to master, 9_1_X and 9_3_X.
  5. Samir Mohammed 2020-07-30

    *Closing ticket*. Fix verified in SDK version 9.1.0.v20200724110711, 9.2.0.v20200724112452 and 9.3.0.v20200724114100. Test and other information can be found at: https://github.com/appcelerator/titanium_mobile/pull/11698 PR (master): https://github.com/appcelerator/titanium_mobile/pull/11830 PR (9.1.x): https://github.com/appcelerator/titanium_mobile/pull/11831 *Test Environment*
       MacOS Big Sur: 11.0 Beta
       Xcode: 12.0 Beta 
       Java Version: 1.8.0_242
       Android NDK: 21.3.6528147
       Node.js: 12.18.1
       ""NPM":"5.0.0","CLI":"8.1.0-master.5""
       API19 Nexus5X
       API29 Pixel XL emulator
       

JSON Source