From f525f8680d2093c2f8f5380157a21f80f98ea6d9 Mon Sep 17 00:00:00 2001 From: Jacob Baskin Date: Mon, 31 Jul 2017 14:00:46 -0400 Subject: [PATCH] In JsonFormatter, output dates as ISO 8601 strings, per OpenAPI spec. --- lib/utils/JsonFormatterPipe.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/utils/JsonFormatterPipe.ts b/lib/utils/JsonFormatterPipe.ts index 8de93236..af821d22 100644 --- a/lib/utils/JsonFormatterPipe.ts +++ b/lib/utils/JsonFormatterPipe.ts @@ -35,6 +35,8 @@ function valueToHTML(value) { level++; output += arrayToHTML(value); level--; + } else if (value && value.constructor === Date) { + output += decorateWithSpan('"' + value.toISOString() + '"', 'type-string'); } else if (valueType === 'object') { level++; output += objectToHTML(value);