Unverified Commit baba146f authored by chrisgarrity's avatar chrisgarrity Committed by GitHub

Merge pull request #4895 from chrisgarrity/relative-time-polyfill

Add @formatjs/relativetimeformat-polyfill
parents f60a8c71 ae2bc24f
This diff is collapsed.
...@@ -54,6 +54,9 @@ ...@@ -54,6 +54,9 @@
"scratch-storage": "^0.5.1" "scratch-storage": "^0.5.1"
}, },
"devDependencies": { "devDependencies": {
"@formatjs/intl-locale": "^2.4.13",
"@formatjs/intl-pluralrules": "^4.0.6",
"@formatjs/intl-relativetimeformat": "^8.0.3",
"ajv": "6.4.0", "ajv": "6.4.0",
"async": "3.1.0", "async": "3.1.0",
"autoprefixer": "6.3.6", "autoprefixer": "6.3.6",
...@@ -91,6 +94,7 @@ ...@@ -91,6 +94,7 @@
"glob": "5.0.15", "glob": "5.0.15",
"google-libphonenumber": "3.2.6", "google-libphonenumber": "3.2.6",
"html-webpack-plugin": "2.22.0", "html-webpack-plugin": "2.22.0",
"i": "^0.3.6",
"iso-3166-2": "0.4.0", "iso-3166-2": "0.4.0",
"jest": "^23.6.0", "jest": "^23.6.0",
"json-loader": "0.5.2", "json-loader": "0.5.2",
...@@ -108,6 +112,7 @@ ...@@ -108,6 +112,7 @@
"minilog": "2.0.8", "minilog": "2.0.8",
"node-dir": "0.1.16", "node-dir": "0.1.16",
"node-sass": "4.14.1", "node-sass": "4.14.1",
"npm": "^6.14.11",
"pako": "0.2.8", "pako": "0.2.8",
"plotly.js": "1.47.4", "plotly.js": "1.47.4",
"po2icu": "0.0.2", "po2icu": "0.0.2",
......
// IMPORTANT: any changes to the time algorithm also need to be made in the corresponding // IMPORTANT: any changes to the time algorithm also need to be made in the corresponding
// scratchr2 file 'lib/format-time.js' // scratchr2 file 'lib/format-time.js'
require('./relative-time-polyfill');
/** /**
Given a timestamp in the future, calculate the largest, closest unit to show. Given a timestamp in the future, calculate the largest, closest unit to show.
On the high end we stop at hours. e.g. 15 days is still counted in hours not days or weeks. On the high end we stop at hours. e.g. 15 days is still counted in hours not days or weeks.
......
// this file should only be `required` in the format-time
// when Intl.RelativeTimeFormat is not available (Safari < 14), but
// we're not currently able to do the code splitting in www, and it
// is always included. To reduce the amount of data that's loaded limit
// the number of languages loaded to just the top few that are still using
// safari <14. These seven account for most uses.
// relativetimeformat depends on locale which also needs to be polyfilled in
// safari <14
require('@formatjs/intl-locale/polyfill');
require('@formatjs/intl-pluralrules');
require('@formatjs/intl-relativetimeformat/polyfill');
require('@formatjs/intl-relativetimeformat/locale-data/en');
require('@formatjs/intl-relativetimeformat/locale-data/ar');
require('@formatjs/intl-relativetimeformat/locale-data/es');
require('@formatjs/intl-relativetimeformat/locale-data/fr');
require('@formatjs/intl-relativetimeformat/locale-data/ja');
require('@formatjs/intl-relativetimeformat/locale-data/tr');
require('@formatjs/intl-relativetimeformat/locale-data/zh');
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment