Skip to content

Commit 2331184

Browse files
authored
Merge pull request #47 from OS2ConTicki/hotfix/ie-11
JOBCAMP-116: Made stuff work in IE11
2 parents 24266ca + ea602c7 commit 2331184

File tree

5 files changed

+70
-30
lines changed

5 files changed

+70
-30
lines changed

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,15 @@
1717
"core-js": "^3.0.0",
1818
"date-fns": "^2.15.0",
1919
"date-fns-tz": "^1.0.10",
20+
"date-time-format-timezone": "^1.0.22",
2021
"debounce": "^1.2.0",
2122
"jquery": "^3.4.1",
2223
"node-sass": "^4.13.1",
2324
"popper.js": "^1.16.1",
2425
"prop-types": "^15.7.2",
2526
"raw-html-react": "^1.2.3",
2627
"react": "^16.13.1",
28+
"react-app-polyfill": "^1.0.6",
2729
"react-bootstrap": "^1.3.0",
2830
"react-dom": "^16.13.1",
2931
"react-router-dom": "^5.2.0",

public/dist/entry.js

Lines changed: 11 additions & 11 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/components/utils/dateHandler.jsx

Lines changed: 8 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@ import { utcToZonedTime, format } from 'date-fns-tz'
33
import { da, enGB } from 'date-fns/locale'
44
import AppStateContext from '../../context/appStateContext'
55

6+
// We need this for time zone support in IE 11.
7+
// https://www.npmjs.com/package/date-time-format-timezone
8+
require('date-time-format-timezone')
9+
610
const locales = { da, en: enGB }
711

812
const getCurrentTimeZone = () => {
@@ -41,31 +45,18 @@ export const formatTime = (date, formatStr = 'p') => {
4145
}
4246

4347
export function getDateByLanguage (inputDate, language) {
44-
const date = new Date(inputDate)
45-
const lang = language === 'en' ? 'en-EN' : 'da-DA'
46-
const dateOptions = {
47-
year: 'numeric',
48-
month: 'long',
49-
day: 'numeric'
50-
}
51-
return date.toLocaleDateString(lang, dateOptions)
48+
return formatDate(inputDate, 'PPP')
5249
}
5350

5451
export function getDate (inputDate) {
5552
const date = new Date(inputDate)
5653
return date.toDateString()
5754
}
5855
export function getDayByLanguage (inputDate, language) {
59-
const lang = language === 'en' ? 'en-EN' : 'da-DA'
60-
const dayOptions = {
61-
weekday: 'long'
62-
}
56+
const day = formatDate(inputDate, 'EEEE')
57+
const capitalize = ([first, ...rest], lowerRest = false) => first.toUpperCase() + (lowerRest ? rest.join('').toLowerCase() : rest.join(''))
6358

64-
const date = new Date(inputDate)
65-
let helperStartDate = date.toLocaleDateString(lang, dayOptions)
66-
helperStartDate =
67-
helperStartDate.charAt(0).toUpperCase() + helperStartDate.slice(1)
68-
return helperStartDate
59+
return capitalize(day)
6960
}
7061

7162
export function getTime (inputDate, language) {

src/entry.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
1+
// https://www.npmjs.com/package/react-app-polyfill
2+
import 'react-app-polyfill/ie11'
3+
import 'react-app-polyfill/stable'
4+
15
import './entry.scss'
26
import ConferenceApp from './ConferenceApp'
7+
38
require('typeface-roboto')
9+
410
window.ConferenceApp = ConferenceApp

yarn.lock

Lines changed: 43 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1495,6 +1495,11 @@ arrify@^2.0.1:
14951495
resolved "https://registry.yarnpkg.com/arrify/-/arrify-2.0.1.tgz#c9655e9331e0abcd588d2a7cad7e9956f66701fa"
14961496
integrity sha512-3duEwti880xqi4eAMN8AyR4a0ByT90zoYdLlevfrvU43vb0YZwZVfxOgxWrLXXXpyugL0hNZc9G6BiB5B3nUug==
14971497

1498+
asap@~2.0.6:
1499+
version "2.0.6"
1500+
resolved "https://registry.yarnpkg.com/asap/-/asap-2.0.6.tgz#e50347611d7e690943208bbdafebcbc2fb866d46"
1501+
integrity sha1-5QNHYR1+aQlDIIu9r+vLwvuGbUY=
1502+
14981503
asn1.js@^4.0.0:
14991504
version "4.10.1"
15001505
resolved "https://registry.yarnpkg.com/asn1.js/-/asn1.js-4.10.1.tgz#b9c2bf5805f1e64aadeed6df3a2bfafb5a73f5a0"
@@ -2424,7 +2429,7 @@ core-js-compat@^3.6.2:
24242429
browserslist "^4.8.5"
24252430
semver "7.0.0"
24262431

2427-
core-js@^3.0.0:
2432+
core-js@^3.0.0, core-js@^3.5.0:
24282433
version "3.6.5"
24292434
resolved "https://registry.yarnpkg.com/core-js/-/core-js-3.6.5.tgz#7395dc273af37fb2e50e9bd3d9fe841285231d1a"
24302435
integrity sha512-vZVEEwZoIsI+vPEuoF9Iqf5H7/M3eeQqWlQnYa8FSKKePuYTf5MWnxb5SDAzCa60b3JBRS5g9b+Dq7b1y/RCrA==
@@ -2735,6 +2740,11 @@ date-fns@^2.15.0:
27352740
resolved "https://registry.yarnpkg.com/date-fns/-/date-fns-2.15.0.tgz#424de6b3778e4e69d3ff27046ec136af58ae5d5f"
27362741
integrity sha512-ZCPzAMJZn3rNUvvQIMlXhDr4A+Ar07eLeGsGREoWU19a3Pqf5oYa+ccd+B3F6XVtQY6HANMFdOQ8A+ipFnvJdQ==
27372742

2743+
date-time-format-timezone@^1.0.22:
2744+
version "1.0.22"
2745+
resolved "https://registry.yarnpkg.com/date-time-format-timezone/-/date-time-format-timezone-1.0.22.tgz#6bb4713aac3bf36338738b59c374583cfcbe6246"
2746+
integrity sha512-4hEeKPpNlbFO05ldht9FwJEy2g1xL7kU3dTPY5hNSd1AyMjrrIeUS54kSWgt/KdttYshhjDMIonU+vCmL4NjVw==
2747+
27382748
debounce@^1.2.0:
27392749
version "1.2.0"
27402750
resolved "https://registry.yarnpkg.com/debounce/-/debounce-1.2.0.tgz#44a540abc0ea9943018dc0eaa95cce87f65cd131"
@@ -6736,6 +6746,13 @@ promise-inflight@^1.0.1:
67366746
resolved "https://registry.yarnpkg.com/promise-inflight/-/promise-inflight-1.0.1.tgz#98472870bf228132fcbdd868129bad12c3c029e3"
67376747
integrity sha1-mEcocL8igTL8vdhoEputEsPAKeM=
67386748

6749+
promise@^8.0.3:
6750+
version "8.1.0"
6751+
resolved "https://registry.yarnpkg.com/promise/-/promise-8.1.0.tgz#697c25c3dfe7435dd79fcd58c38a135888eaf05e"
6752+
integrity sha512-W04AqnILOL/sPRXziNicCjSNRruLAuIHEOVBazepu0545DDNGYHz7ar9ZgZ1fMU8/MA4mVxp5rkBWRi6OXIy3Q==
6753+
dependencies:
6754+
asap "~2.0.6"
6755+
67396756
prop-types-extra@^1.1.0:
67406757
version "1.1.1"
67416758
resolved "https://registry.yarnpkg.com/prop-types-extra/-/prop-types-extra-1.1.1.tgz#58c3b74cbfbb95d304625975aa2f0848329a010b"
@@ -6863,6 +6880,13 @@ quick-lru@^4.0.1:
68636880
resolved "https://registry.yarnpkg.com/quick-lru/-/quick-lru-4.0.1.tgz#5b8878f113a58217848c6482026c73e1ba57727f"
68646881
integrity sha512-ARhCpm70fzdcvNQfPoy49IaanKkTlRWF2JMzqhcJbhSFRZv7nPTvZJdcY7301IPmvW+/p0RgIWnQDLJxifsQ7g==
68656882

6883+
raf@^3.4.1:
6884+
version "3.4.1"
6885+
resolved "https://registry.yarnpkg.com/raf/-/raf-3.4.1.tgz#0742e99a4a6552f445d73e3ee0328af0ff1ede39"
6886+
integrity sha512-Sq4CW4QhwOHE8ucn6J34MqtZCeWFP2aQSmrlroYgqAV1PjStIhJXxYuTgUIfkEk7zTLjmIjLmU5q+fbD1NnOJA==
6887+
dependencies:
6888+
performance-now "^2.1.0"
6889+
68666890
randombytes@^2.0.0, randombytes@^2.0.1, randombytes@^2.0.5, randombytes@^2.1.0:
68676891
version "2.1.0"
68686892
resolved "https://registry.yarnpkg.com/randombytes/-/randombytes-2.1.0.tgz#df6f84372f0270dc65cdf6291349ab7a473d4f2a"
@@ -6900,6 +6924,18 @@ raw-html-react@^1.2.3:
69006924
dependencies:
69016925
cheerio "^1.0.0-rc.2"
69026926

6927+
react-app-polyfill@^1.0.6:
6928+
version "1.0.6"
6929+
resolved "https://registry.yarnpkg.com/react-app-polyfill/-/react-app-polyfill-1.0.6.tgz#890f8d7f2842ce6073f030b117de9130a5f385f0"
6930+
integrity sha512-OfBnObtnGgLGfweORmdZbyEz+3dgVePQBb3zipiaDsMHV1NpWm0rDFYIVXFV/AK+x4VIIfWHhrdMIeoTLyRr2g==
6931+
dependencies:
6932+
core-js "^3.5.0"
6933+
object-assign "^4.1.1"
6934+
promise "^8.0.3"
6935+
raf "^3.4.1"
6936+
regenerator-runtime "^0.13.3"
6937+
whatwg-fetch "^3.0.0"
6938+
69036939
react-bootstrap@^1.3.0:
69046940
version "1.3.0"
69056941
resolved "https://registry.yarnpkg.com/react-bootstrap/-/react-bootstrap-1.3.0.tgz#d9dde4ad554e9cd21d1465e8b5e5ef6679cae6a1"
@@ -7139,7 +7175,7 @@ regenerate@^1.4.0:
71397175
resolved "https://registry.yarnpkg.com/regenerate/-/regenerate-1.4.1.tgz#cad92ad8e6b591773485fbe05a485caf4f457e6f"
71407176
integrity sha512-j2+C8+NtXQgEKWk49MMP5P/u2GhnahTtVkRIHr5R5lVRlbKvmQ+oS+A5aLKWp2ma5VkT8sh6v+v4hbH0YHR66A==
71417177

7142-
regenerator-runtime@^0.13.2, regenerator-runtime@^0.13.4:
7178+
regenerator-runtime@^0.13.2, regenerator-runtime@^0.13.3, regenerator-runtime@^0.13.4:
71437179
version "0.13.7"
71447180
resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.13.7.tgz#cac2dacc8a1ea675feaabaeb8ae833898ae46f55"
71457181
integrity sha512-a54FxoJDIr27pgf7IgeQGxmqUNYrcV338lf/6gH456HZ/PhX+5BcwHXG9ajESmwe6WRO0tAzRUrRmNONWgkrew==
@@ -9126,6 +9162,11 @@ websocket-extensions@>=0.1.1:
91269162
resolved "https://registry.yarnpkg.com/websocket-extensions/-/websocket-extensions-0.1.4.tgz#7f8473bc839dfd87608adb95d7eb075211578a42"
91279163
integrity sha512-OqedPIGOfsDlo31UNwYbCFMSaO9m9G/0faIHj5/dZFDMFqPTcx6UwqyOy3COEaEOg/9VsGIpdqn62W5KhoKSpg==
91289164

9165+
whatwg-fetch@^3.0.0:
9166+
version "3.4.1"
9167+
resolved "https://registry.yarnpkg.com/whatwg-fetch/-/whatwg-fetch-3.4.1.tgz#e5f871572d6879663fa5674c8f833f15a8425ab3"
9168+
integrity sha512-sofZVzE1wKwO+EYPbWfiwzaKovWiZXf4coEzjGP9b2GBVgQRLQUZ2QcuPpQExGDAW5GItpEm6Tl4OU5mywnAoQ==
9169+
91299170
which-module@^2.0.0:
91309171
version "2.0.0"
91319172
resolved "https://registry.yarnpkg.com/which-module/-/which-module-2.0.0.tgz#d9ef07dce77b9902b8a3a8fa4b31c3e3f7e6e87a"

0 commit comments

Comments
 (0)