Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove days from countdown timeAgo #12141

Merged
merged 6 commits into from
May 23, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 1 addition & 7 deletions apps/core/src/hooks/useTimeAgo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ const TIME_LABEL = {
const ONE_SECOND = 1000;
const ONE_MINUTE = ONE_SECOND * 60;
const ONE_HOUR = ONE_MINUTE * 60;
const ONE_DAY = ONE_HOUR * 24;

/**
* Formats a timestamp using `timeAgo`, and automatically updates it when the value is small.
Expand Down Expand Up @@ -82,12 +81,7 @@ export const timeAgo = (
let timeUnit: [string, number][];
let timeCol = Math.abs(timeNow - epochMilliSecs);

if (timeCol >= ONE_DAY) {
timeUnit = [
[TIME_LABEL.day[dateKeyType], ONE_DAY],
[TIME_LABEL.hour[dateKeyType], ONE_HOUR],
];
} else if (timeCol >= ONE_HOUR) {
if (timeCol >= ONE_HOUR) {
timeUnit = [
[TIME_LABEL.hour[dateKeyType], ONE_HOUR],
[TIME_LABEL.min[dateKeyType], ONE_MINUTE],
Expand Down