Skip to main content
Glama
time.utils.ts688 B
/** * @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 }); }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/eyaltoledano/claude-task-master'

If you have feedback or need assistance with the MCP directory API, please join our Discord server