Skip to content

Commit

Permalink
Use global.isNaN
Browse files Browse the repository at this point in the history
  • Loading branch information
compulim committed Jan 23, 2019
1 parent be8564c commit 8888b6e
Show file tree
Hide file tree
Showing 20 changed files with 34 additions and 26 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- `component`: Fix [#1547](https://github.com/Microsoft/BotFramework-WebChat/issues/1547). Fixed unhandled activity type should be forwarded to custom middleware, by [@compulim](https://github.com/compulim) in PR [#1569](https://github.com/Microsoft/BotFramework-WebChat/pull/1569)
- `playground`: Fix [#1610](https://github.com/Microsoft/BotFramework-WebChat/issues/1610). Fixed bot and user avatar initials not working, by [@compulim](https://github.com/compulim) in PR [#1611](https://github.com/Microsoft/BotFramework-WebChat/pull/1611)
- `bundle`: Fix [#1613](https://github.com/Microsoft/BotFramework-WebChat/issues/1613). Pass conversationId to DirectLineJS constructor, by [@neetu-das](https://github.com/neetu-das) in PR [#1614](https://github.com/Microsoft/BotFramework-WebChat/pull/1614)
- `component`: Fix [#1626](https://github.com/Microsoft/BotFramework-WebChat/issues/1626). Fixed `Number.isNaN` is not available in IE11, by [@compulim](https://github.com/compulim) in PR [#1627](https://github.com/Microsoft/BotFramework-WebChat/pull/1627)

### Removed
- `botAvatarImage` and `userAvatarImage` props, as they are moved inside `styleOptions`, in PR [#1486](https://github.com/Microsoft/BotFramework-WebChat/pull/1486)
Expand Down
2 changes: 1 addition & 1 deletion packages/component/src/Localization/cs-CZ.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ export default {
'Upload file': 'Nahrát soubor',
'VAT': 'DPH'
// 'X minutes ago':
}
}
2 changes: 1 addition & 1 deletion packages/component/src/Localization/de-DE.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ export default {
// 'Upload file': '',
'VAT': 'VAT'
// 'X minutes ago':
}
}
2 changes: 1 addition & 1 deletion packages/component/src/Localization/el-GR.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ export default {
// 'Upload file': '',
'VAT': 'VAT'
// 'X minutes ago':
}
}
5 changes: 3 additions & 2 deletions packages/component/src/Localization/en-US.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,14 @@ function userSaidSomething(avatarInitials, text, timestamp) {

function xMinutesAgo(dateStr) {
const date = new Date(dateStr);
const dateTime = date.getTime();

if (Number.isNaN(date.valueOf())) {
if (isNaN(dateTime)) {
return dateStr;
}

const now = Date.now();
const deltaInMs = now - new Date(date).getTime();
const deltaInMs = now - dateTime;
const deltaInMinutes = Math.floor(deltaInMs / 60000);
const deltaInHours = Math.floor(deltaInMs / 3600000);

Expand Down
2 changes: 1 addition & 1 deletion packages/component/src/Localization/fi-FI.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ export default {
'Upload file': 'Lataa tiedosto',
'VAT': 'ALV'
// 'X minutes ago':
}
}
5 changes: 3 additions & 2 deletions packages/component/src/Localization/fr-FR.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
function xMinutesAgo(dateStr) {
const date = new Date(dateStr);
const dateTime = date.getTime();

if (Number.isNaN(date.valueOf())) {
if (isNaN(dateTime)) {
return dateStr;
}

const now = Date.now();
const deltaInMs = now - new Date(date).getTime();
const deltaInMs = now - dateTime;
const deltaInMinutes = Math.floor(deltaInMs / 60000);
const deltaInHours = Math.floor(deltaInMs / 3600000);

Expand Down
2 changes: 1 addition & 1 deletion packages/component/src/Localization/hu-HU.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ export default {
// 'Upload file': '',
'VAT': 'ÁFA'
// 'X minutes ago':
}
}
2 changes: 1 addition & 1 deletion packages/component/src/Localization/it-IT.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ export default {
// 'Upload file': '',
'VAT': 'VAT'
// 'X minutes ago':
}
}
5 changes: 3 additions & 2 deletions packages/component/src/Localization/ja-JP.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
function xMinutesAgo(dateStr) {
const date = new Date(dateStr);
const dateTime = date.getTime();

if (Number.isNaN(date.valueOf())) {
if (isNaN(dateTime)) {
return dateStr;
}

const now = Date.now();
const deltaInMs = now - new Date(date).getTime();
const deltaInMs = now - dateTime;
const deltaInMinutes = Math.floor(deltaInMs / 60000);
const deltaInHours = Math.floor(deltaInMs / 3600000);

Expand Down
2 changes: 1 addition & 1 deletion packages/component/src/Localization/ko-KR.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ export default {
// 'Upload file': '',
'VAT': '부가세'
// 'X minutes ago':
}
}
2 changes: 1 addition & 1 deletion packages/component/src/Localization/lv-LV.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ export default {
// 'Upload file': '',
'VAT': 'VAT'
// 'X minutes ago':
}
}
2 changes: 1 addition & 1 deletion packages/component/src/Localization/pt-BR.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ export default {
'Upload file': 'Subir arquivo',
'VAT': 'VAT'
// 'X minutes ago':
}
}
2 changes: 1 addition & 1 deletion packages/component/src/Localization/pt-PT.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ export default {
// 'Upload file': '',
'VAT': 'IVA'
// 'X minutes ago':
}
}
5 changes: 3 additions & 2 deletions packages/component/src/Localization/ru-RU.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
function xMinutesAgo(dateStr) {
const date = new Date(dateStr);
const dateTime = date.getTime();

if (Number.isNaN(date.valueOf())) {
if (isNaN(dateTime)) {
return dateStr;
}

const now = Date.now();
const deltaInMs = now - new Date(date).getTime();
const deltaInMs = now - dateTime;
const deltaInMinutes = Math.floor(deltaInMs / 60000);
const deltaInHours = Math.floor(deltaInMs / 3600000);

Expand Down
2 changes: 1 addition & 1 deletion packages/component/src/Localization/sv-SE.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ export default {
// 'Upload file': '',
'VAT': 'Moms'
// 'X minutes ago':
}
}
2 changes: 1 addition & 1 deletion packages/component/src/Localization/tr-TR.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ export default {
// 'Upload file': '',
'VAT': 'KDV'
// 'X minutes ago':
}
}
5 changes: 3 additions & 2 deletions packages/component/src/Localization/zh-HANS.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
function xMinutesAgo(dateStr) {
const date = new Date(dateStr);
const dateTime = date.getTime();

if (Number.isNaN(date.valueOf())) {
if (isNaN(dateTime)) {
return dateStr;
}

const now = Date.now();
const deltaInMs = now - new Date(date).getTime();
const deltaInMs = now - dateTime;
const deltaInMinutes = Math.floor(deltaInMs / 60000);
const deltaInHours = Math.floor(deltaInMs / 3600000);

Expand Down
5 changes: 3 additions & 2 deletions packages/component/src/Localization/zh-HANT.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
function xMinutesAgo(dateStr) {
const date = new Date(dateStr);
const dateTime = date.getTime();

if (Number.isNaN(date.valueOf())) {
if (isNaN(dateTime)) {
return dateStr;
}

const now = Date.now();
const deltaInMs = now - new Date(date).getTime();
const deltaInMs = now - dateTime;
const deltaInMinutes = Math.floor(deltaInMs / 60000);
const deltaInHours = Math.floor(deltaInMs / 3600000);

Expand Down
5 changes: 3 additions & 2 deletions packages/component/src/Localization/zh-YUE.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
function xMinutesAgo(dateStr) {
const date = new Date(dateStr);
const dateTime = date.getTime();

if (Number.isNaN(date.valueOf())) {
if (isNaN(dateTime)) {
return dateStr;
}

const now = Date.now();
const deltaInMs = now - new Date(date).getTime();
const deltaInMs = now - dateTime;
const deltaInMinutes = Math.floor(deltaInMs / 60000);
const deltaInHours = Math.floor(deltaInMs / 3600000);

Expand Down

0 comments on commit 8888b6e

Please sign in to comment.