@@ -292,7 +292,7 @@ function $asDatetime (date, skipQuotes) {
292
292
} else if ( date && typeof date . toISOString === 'function' ) {
293
293
return quotes + date . toISOString ( ) + quotes
294
294
} else {
295
- return $asString ( date )
295
+ return $asString ( date , skipQuotes )
296
296
}
297
297
}
298
298
@@ -306,7 +306,7 @@ function $asDate (date, skipQuotes) {
306
306
} else if ( date && typeof date . format === 'function' ) {
307
307
return quotes + date . format ( 'YYYY-MM-DD' ) + quotes
308
308
} else {
309
- return $asString ( date )
309
+ return $asString ( date , skipQuotes )
310
310
}
311
311
}
312
312
@@ -320,20 +320,26 @@ function $asTime (date, skipQuotes) {
320
320
} else if ( date && typeof date . format === 'function' ) {
321
321
return quotes + date . format ( 'HH:mm:ss' ) + quotes
322
322
} else {
323
- return $asString ( date )
323
+ return $asString ( date , skipQuotes )
324
324
}
325
325
}
326
326
327
- function $asString ( str ) {
327
+ function $asString ( str , skipQuotes ) {
328
+ const quotes = skipQuotes === true ? '' : '"'
328
329
if ( str instanceof Date ) {
329
- return '"' + str . toISOString ( ) + '"'
330
+ return quotes + str . toISOString ( ) + quotes
330
331
} else if ( str === null ) {
331
- return '""'
332
+ return quotes + quotes
332
333
} else if ( str instanceof RegExp ) {
333
334
str = str . source
334
335
} else if ( typeof str !== 'string' ) {
335
336
str = str . toString ( )
336
337
}
338
+ // If we skipQuotes it means that we are using it as test
339
+ // no need to test the string length for the render
340
+ if ( skipQuotes ) {
341
+ return str
342
+ }
337
343
338
344
if ( str . length < 42 ) {
339
345
return $asStringSmall ( str )
0 commit comments