Skip to content

Commit eca6465

Browse files
authored
fix millisecond error (#15203)
1 parent 8bf5986 commit eca6465

File tree

1 file changed

+4
-3
lines changed
  • airbyte-webapp/src/packages/cloud/views/layout/MainView

1 file changed

+4
-3
lines changed

airbyte-webapp/src/packages/cloud/views/layout/MainView/MainView.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,11 +65,12 @@ const MainView: React.FC = (props) => {
6565
} else if (alertToShow === "trial") {
6666
const { trialExpiryTimestamp } = cloudWorkspace;
6767

68-
//calculate difference between timestamp (in epoch seconds) and now (in epoch seconds)
69-
const trialRemainingSeconds = trialExpiryTimestamp ? trialExpiryTimestamp - Date.now() / 1000 : 0;
68+
//calculate difference between timestamp (in epoch milliseconds) and now (in epoch milliseconds)
69+
//empty timestamp is 0
70+
const trialRemainingMilliseconds = trialExpiryTimestamp ? trialExpiryTimestamp - Date.now() : 0;
7071

7172
//calculate days (rounding up if decimal)
72-
const trialRemainingDays = Math.ceil(trialRemainingSeconds / (24 * 60 * 60));
73+
const trialRemainingDays = Math.ceil(trialRemainingMilliseconds / (1000 * 60 * 60 * 24));
7374

7475
return formatMessage({ id: "trial.alertMessage" }, { value: trialRemainingDays });
7576
}

0 commit comments

Comments
 (0)