Skip to main content
Glama
formatIsoDateTime.ts767 B
/** * Helper function to format ISO datetime strings according to Mapbox API requirements. * It converts the format YYYY-MM-DDThh:mm:ss (with seconds but no timezone) to * YYYY-MM-DDThh:mm (no seconds, no timezone) by removing the seconds part. * Other valid formats are left unchanged. */ export const formatIsoDateTime = (dateTime: string): string => { // Regex for matching YYYY-MM-DDThh:mm:ss format (with seconds but no timezone) const dateWithSecondsNoTz = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}$/; if (dateWithSecondsNoTz.test(dateTime)) { // Extract up to the minutes part only, dropping the seconds return dateTime.substring(0, dateTime.lastIndexOf(':')); } // Return unchanged if it's already in a valid format return dateTime; };

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/Waldzell-Agentics/mcp-server'

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