Skip to content

Commit

Permalink
Fix date bug for deadline
Browse files Browse the repository at this point in the history
  • Loading branch information
hampfh committed Oct 29, 2020
1 parent b99d68b commit 82163b4
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions client/src/functions/date_calculations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,16 @@ export function calcTimeLeft(endDate: string): { months: number, weeks: number,
}
}

const months = Math.round(secondsLeft / SECONDS_IN_A_MONTH)
let timeleft = Math.round(secondsLeft % SECONDS_IN_A_MONTH)
const weeks = Math.round(timeleft / SECONDS_IN_A_WEEK)
timeleft = Math.round(timeleft % SECONDS_IN_A_WEEK)
const days = Math.round(timeleft / SECONDS_IN_A_DAY)
timeleft = Math.round(timeleft % SECONDS_IN_A_DAY)
const hours = Math.round(timeleft / SECONDS_IN_AN_HOUR)
timeleft = Math.round(timeleft % SECONDS_IN_AN_HOUR)
const minutes = Math.round(timeleft / 60)
const seconds = Math.round(timeleft % 60)
const months = Math.floor(secondsLeft / SECONDS_IN_A_MONTH)
let timeleft = Math.floor(secondsLeft % SECONDS_IN_A_MONTH)
const weeks = Math.floor(timeleft / SECONDS_IN_A_WEEK)
timeleft = Math.floor(timeleft % SECONDS_IN_A_WEEK)
const days = Math.floor(timeleft / SECONDS_IN_A_DAY)
timeleft = Math.floor(timeleft % SECONDS_IN_A_DAY)
const hours = Math.floor(timeleft / SECONDS_IN_AN_HOUR)
timeleft = Math.floor(timeleft % SECONDS_IN_AN_HOUR)
const minutes = Math.floor(timeleft / 60)
const seconds = Math.floor(timeleft % 60)

return {
months,
Expand Down

0 comments on commit 82163b4

Please sign in to comment.