MCPcopy Index your code
hub / github.com/codeaashu/claude-code / formatDateDisplay

Function formatDateDisplay

src/components/mcp/ElicitationDialog.tsx:80–111  ·  view source on GitHub ↗

Format an ISO date/datetime for display, keeping the ISO value for submission.

(isoValue: string, schema: PrimitiveSchemaDefinition)

Source from the content-addressed store, hash-verified

78
79/** Format an ISO date/datetime for display, keeping the ISO value for submission. */
80function formatDateDisplay(isoValue: string, schema: PrimitiveSchemaDefinition): string {
81 try {
82 const date = new Date(isoValue);
83 if (Number.isNaN(date.getTime())) return isoValue;
84 const format = 'format' in schema ? schema.format : undefined;
85 if (format === 'date-time') {
86 return date.toLocaleDateString('en-US', {
87 weekday: 'short',
88 year: 'numeric',
89 month: 'short',
90 day: 'numeric',
91 hour: 'numeric',
92 minute: '2-digit',
93 timeZoneName: 'short'
94 });
95 }
96 // date-only: parse as local date to avoid timezone shift
97 const parts = isoValue.split('-');
98 if (parts.length === 3) {
99 const local = new Date(Number(parts[0]), Number(parts[1]) - 1, Number(parts[2]));
100 return local.toLocaleDateString('en-US', {
101 weekday: 'short',
102 year: 'numeric',
103 month: 'short',
104 day: 'numeric'
105 });
106 }
107 return isoValue;
108 } catch {
109 return isoValue;
110 }
111}
112export function ElicitationDialog(t0) {
113 const $ = _c(7);
114 const {

Callers 1

renderFormFieldsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected