canvas-lms/packages/intl-polyfills
Charley Kline 58f60746cd Work around Chrome 92 bug with Intl polyfills
Refs CNVS-53338
Fixes FOO-2261
flag=none

The recently added Intl polyfills for non-native date
and time locales worked fine until Chrome 92, which
apparently has some bugs in that area of the code.
Turning on the 'javascript-harmony' flag in the experimental
features fixes the issue, so hopefully it'll be fixed in
the main branch before too long.

In the mean time, this installs a patch that skips the
language polyfilling altogether if a buggy version of Chrome
is detected.

To further bulletproof, do not even attempt the whole polyfill
business if the requested locale is not loadable. I've seen
some odd behavior even on Safari when attempting to load a
polyfill and then falling back.

Test plan:
* Be on Chrome 92
* load up Canvas and watch the browser console
* Note the "Skipping language polyfills for Chrome 92" message
* Change your Canvas language to Norsk (Bokmal) GS/VGS
* That would normally throw a console error because there
  is no polyfiller for that language, but notice that it
  does NOT throw that error
* In console try  new Date().toLocaleDateString()
* That should work and not throw an error
* Extra credit: be on Safari and switch to Haitian Creole,
  and make sure that  new Date().toLocaleDateString() works

Change-Id: I6de3809554e5e0e833cf9c3f20efe18a0917425b
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/271227
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: August Thornton <august@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Product-Review: August Thornton <august@instructure.com>
2021-08-12 00:24:50 +00:00
..
__tests__
index.js Work around Chrome 92 bug with Intl polyfills 2021-08-12 00:24:50 +00:00
package.json Insert language polyfills at page load time 2021-07-03 00:07:55 +00:00