mirror of
https://github.com/eyaltoledano/claude-task-master.git
synced 2026-01-30 06:12:05 +00:00
feat: sort briefs by updated at (#1409)
This commit is contained in:
@@ -31,6 +31,7 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@supabase/supabase-js": "^2.57.4",
|
||||
"date-fns": "^4.1.0",
|
||||
"fs-extra": "^11.3.2",
|
||||
"simple-git": "^3.28.0",
|
||||
"steno": "^4.0.2",
|
||||
|
||||
@@ -50,6 +50,7 @@ export * from './common/errors/index.js';
|
||||
|
||||
// Utils
|
||||
export * from './common/utils/index.js';
|
||||
export * from './utils/time.utils.js';
|
||||
|
||||
// ========== Domain-Specific Type Exports ==========
|
||||
|
||||
|
||||
@@ -3,13 +3,13 @@
|
||||
* Handles fetching and managing organizations and briefs from the API
|
||||
*/
|
||||
|
||||
import { SupabaseClient } from '@supabase/supabase-js';
|
||||
import type { SupabaseClient } from '@supabase/supabase-js';
|
||||
import {
|
||||
ERROR_CODES,
|
||||
TaskMasterError
|
||||
} from '../../../common/errors/task-master-error.js';
|
||||
import { getLogger } from '../../../common/logger/index.js';
|
||||
import { Database } from '../../../common/types/database.types.js';
|
||||
import type { Database } from '../../../common/types/database.types.js';
|
||||
import type { Brief } from '../../briefs/types.js';
|
||||
|
||||
/**
|
||||
@@ -171,7 +171,8 @@ export class OrganizationService {
|
||||
title
|
||||
)
|
||||
`)
|
||||
.eq('account_id', orgId);
|
||||
.eq('account_id', orgId)
|
||||
.order('updated_at', { ascending: false });
|
||||
|
||||
if (error) {
|
||||
throw new TaskMasterError(
|
||||
|
||||
18
packages/tm-core/src/utils/time.utils.ts
Normal file
18
packages/tm-core/src/utils/time.utils.ts
Normal file
@@ -0,0 +1,18 @@
|
||||
/**
|
||||
* @fileoverview Time utilities for formatting relative timestamps
|
||||
* Shared across CLI, MCP, extension, and other interfaces
|
||||
*/
|
||||
|
||||
import { formatDistanceToNow } from 'date-fns';
|
||||
|
||||
/**
|
||||
* Format a date as relative time from now (e.g., "2 hours ago", "3 days ago")
|
||||
* @param date - Date string or Date object to format
|
||||
* @returns Relative time string (e.g., "less than a minute ago", "5 minutes ago", "2 weeks ago")
|
||||
*/
|
||||
export function formatRelativeTime(date: string | Date): string {
|
||||
const dateObj = typeof date === 'string' ? new Date(date) : date;
|
||||
|
||||
// Use date-fns for robust formatting with proper edge case handling
|
||||
return formatDistanceToNow(dateObj, { addSuffix: true });
|
||||
}
|
||||
Reference in New Issue
Block a user