Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.
TypeScript agentic-aiagentsaiai-agentsaiagentsdeveloper-toolsfunction-callinggpt-4javascriptjsllmllmopsmcppythonremote-mcp-serverssetypescript
Add date format validation for changelog entries - Validate YYYY-MM-DD format in schema and runtime - Throws clear error on malformed dates
Sushmithamalleshc28beba4f338
diff --git a/fumadocs/lib/source.ts b/fumadocs/lib/source.tsindex b8f6f52ac..52174ea70 100644--- a/fumadocs/lib/source.ts+++ b/fumadocs/lib/source.ts@@ -71,14 +71,26 @@ export function formatDate(dateStr: string): string {});}+const DATE_REGEX = /^\d{4}-\d{2}-\d{2}$/;++function validateDateFormat(dateStr: string): void {+ if (!DATE_REGEX.test(dateStr)) {+ throw new Error(+ `Invalid date format: "${dateStr}". Expected YYYY-MM-DD (e.g., "2025-12-29")`+ );+ }+}+export function dateToChangelogUrl(dateStr: string): string {// Convert "2025-12-29" to "/docs/changelog/2025/12/29"+ validateDateFormat(dateStr);const [year, month, day] = dateStr.split('-');return `/docs/changelog/${year}/${month}/${day}`;}export function dateToSlug(dateStr: string): string[] {// Convert "2025-12-29" to ["2025", "12", "29"]+ validateDateFormat(dateStr);const [year, month, day] = dateStr.split('-');return [year, month, day];}diff --git a/fumadocs/source.config.ts b/fumadocs/source.config.tsindex 9ca976237..2e2d33422 100644--- a/fumadocs/source.config.ts+++ b/fumadocs/source.config.ts@@ -72,7 +72,9 @@ export const changelog = defineCollections({type: 'doc',dir: 'content/changelog',schema: frontmatterSchema.extend({- date: z.string(),+ date: z.string().regex(/^\d{4}-\d{2}-\d{2}$/, {+ message: 'Date must be in YYYY-MM-DD format (e.g., "2025-12-29")',+ }),}),});