Skip to main content
Glama
utils.ts1.13 kB
import { clsx, type ClassValue } from "clsx" import { twMerge } from "tailwind-merge" export function cn(...inputs: ClassValue[]) { return twMerge(clsx(inputs)) } export const formatCurrentDateTime = () => { const now = new Date(); // Get the user's local time zone const timeZone = Intl.DateTimeFormat().resolvedOptions().timeZone; // Format the date in the user's local time zone return now.toLocaleString('en-US', { timeZone, dateStyle: 'medium', timeStyle: 'medium' }) + ` (${getTimeZoneAbbreviation(timeZone)})`; }; // Helper function to get time zone abbreviation function getTimeZoneAbbreviation(timeZone: string): string { try { // Get the time zone abbreviation from the formatted date const options: Intl.DateTimeFormatOptions = { timeZoneName: 'short' }; const shortTimeZone = new Intl.DateTimeFormat('en-US', options) .formatToParts(new Date()) .find(part => part.type === 'timeZoneName')?.value || ''; return shortTimeZone; } catch { // Fallback if there's an error getting the abbreviation return timeZone.split('/').pop() || ''; } }

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/myeong-ga/research-agent-mcp-0.36-pro-preview-06-01'

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