Skip to content

Commit 5dcc234

Browse files
authored
fix: remove error and return default time (#1478)
1 parent 905f8d5 commit 5dcc234

File tree

2 files changed

+2
-3
lines changed

2 files changed

+2
-3
lines changed

src/store/TimeperiodStore.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ export default class TimeperiodStore {
118118
if (dataSegmentClose && dataSegmentClose.length) {
119119
const currentQuote = dataSegmentClose[dataSegmentClose.length - 1];
120120
if (currentQuote.DT) {
121-
const now = this._serverTime.getLocalDate().getTime();
121+
const now = this._serverTime?.getLocalDate()?.getTime();
122122
const diff = now - currentQuote.DT.getTime();
123123

124124
const granularity = this.mainStore.chart.granularity;

src/utils/ServerTime.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,7 @@ class ServerTime {
8484
if (this.serverTimeAtResponse) {
8585
return this.serverTimeAtResponse;
8686
}
87-
88-
throw new Error('Server time is undefined!');
87+
return getUTCEpoch(new Date());
8988
}
9089

9190
getLocalDate() {

0 commit comments

Comments
 (0)