Skip to content

Commit bd4dd96

Browse files
committed
Fix get timestamp of 0
1 parent 4149789 commit bd4dd96

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

packages/core/src/reducers/createActivitiesReducer.ts

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,19 @@ function getSequenceIdOrDeriveFromTimestamp(
6565
activity: WebChatActivity,
6666
ponyfill: GlobalScopePonyfill
6767
): number | undefined {
68-
return activity.channelData?.['webchat:sequence-id'] ?? (+new ponyfill.Date(activity.timestamp) || undefined);
68+
const sequenceId = activity.channelData?.['webchat:sequence-id'];
69+
70+
if (typeof sequenceId === 'number') {
71+
return sequenceId;
72+
}
73+
74+
const { timestamp } = activity;
75+
76+
if (typeof timestamp === 'string') {
77+
return +new ponyfill.Date(timestamp);
78+
}
79+
80+
return undefined;
6981
}
7082

7183
function patchActivity(activity: WebChatActivity, { Date }: GlobalScopePonyfill): WebChatActivity {

0 commit comments

Comments
 (0)