tracker issue : CF-4203797

select a category, or use search below
(searches all categories and all time range)
Title:

[ANeff] Bug for: dateTimeFormat() inconsistent escaping of string literals

| View in Tracker

Status/Resolution/Reason: To Fix/Fixed/FixLater

Reporter/Name(from Bugbase): Aaron Neff / ()

Created: 12/18/2018

Components: Language, Functions

Versions: 2018

Failure Type: Incorrectly functioning

Found In Build/Fixed In Build: 2018.0.0.310739 / 2020.0.0.314559

Priority/Frequency: Normal / Very few users will encounter

Locale/System: / Windows 10 64 bit

Vote Count: 0

Issue: dateTimeFormat() inconsistent escaping of string literals

Repro:
-----------
<cfscript>
  myDateTime = createDateTime(2018)
  writeOutput(myDateTime.dateTimeFormat("dddd 'at' HH:nn"))//Monday at 00:00 (good)
  writeOutput('<br>' & myDateTime.dateTimeFormat('dddd "at" HH:nn'))//Monday "aA" 00:00 (bad)
</cfscript>
-----------

Actual Result:
Monday at 00:00
Monday "aA" 00:00

Expected Result:
Monday at 00:00
Monday at 00:00

Summary: CF allows single and double quotes to be used interchangeably. Same should be allowed here.

Documentation: The DateTimeFormat() doc's "mask" description should probably have a note at the bottom saying something like "To escape specific strings in the mask from formatting, wrap them with quotes."

Related URL: https://helpx.adobe.com/coldfusion/cfml-reference/coldfusion-functions/functions-c-d/DateTimeFormat.html

Attachments:

Comments:

Credit to David Byers. Related URL: https://coldfusion.adobe.com/2018/12/quick-tip-escaping-string-literals-in-datetimeformat/
Comment by Aaron N.
30068 | December 18, 2018 04:33:06 AM GMT