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

378 - Implement dates instead of xxx days #403

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
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
4 changes: 2 additions & 2 deletions dashboard/src/components/FileViewer/FileList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -351,15 +351,15 @@ export default function FileList({
</p>
<div className="grow"></div>

<p className="hidden min-w-[8ch] text-left text-gray-500 @xs:inline">
<p className="@xs:inline hidden min-w-[8ch] text-right text-gray-500">
{file.modification_time || file.creation_time
? formatTimeAgo(
Number(file.modification_time ?? file.creation_time) * 1000
)
: 'Unknown Creation Time'}
</p>

<p className="hidden min-w-[8ch] text-right text-gray-500 @sm:inline">
<p className="@sm:inline hidden min-w-[8ch] text-right text-gray-500">
{file.file_type === 'Directory'
? ''
: file.size
Expand Down
3 changes: 2 additions & 1 deletion dashboard/src/utils/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,8 @@ export const formatTimeAgo = (time_ms: number) => {
const diffMinutes = Math.floor(diff / (1000 * 60));
const diffSeconds = Math.floor(diff / 1000);
if (diffDays > 0) {
return `${diffDays} day${diffDays > 1 ? 's' : ''} ago`;
const date = new Date(time_ms);
return `${date.toLocaleString('default', { month: 'long', year: 'numeric', day: 'numeric' })}`;
} else if (diffHours > 0) {
return `${diffHours} hour${diffHours > 1 ? 's' : ''} ago`;
} else if (diffMinutes > 0) {
Expand Down
Loading