Skip to content

Commit

Permalink
also add changes of formatting time for CP extension (#129)
Browse files Browse the repository at this point in the history
  • Loading branch information
weeebr committed Feb 15, 2023
1 parent d01953b commit e938324
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions src/helpers/displayChallengePeriod.ts
Expand Up @@ -13,19 +13,19 @@ const formatDate = (diff: IDiff): string => {
let formattedString = "-";

if (days > 0) {
formattedString = `${days} ${days === 1 ? "day" : "days"} ${
hours > 0 ? hours : ""
} ${hours > 0 ? (hours === 1 ? "hour" : "hours") : ""}`;
formattedString = `${days}d ${hours > 0 ? hours : ""}${
hours > 0 ? "h" : ""
}`;
} else if (hours > 0) {
formattedString = `${hours} ${hours === 1 ? "hour" : "hours"} ${
minutes > 0 ? minutes : ""
} ${minutes > 0 ? (minutes === 1 ? "minute" : "minutes") : ""}`;
formattedString = `${hours}h ${minutes > 0 ? minutes : ""}${
minutes > 0 ? "min" : ""
}`;
} else if (minutes > 0) {
formattedString = `${minutes} ${minutes === 1 ? "minute" : "minutes"} ${
seconds > 0 ? seconds : ""
} ${seconds > 0 ? (seconds === 1 ? "second" : "seconds") : ""}`;
formattedString = `${minutes}min ${seconds > 0 ? seconds : ""}${
seconds > 0 ? "sec" : ""
}`;
} else if (seconds > 0) {
formattedString = `${seconds} ${seconds === 1 ? "second" : "seconds"}`;
formattedString = `${seconds}sec`;
}

return formattedString;
Expand Down

0 comments on commit e938324

Please sign in to comment.